GUACAMOLE-292: Store user profile information within PostgreSQL/MySQL database.

This commit is contained in:
Michael Jumper
2017-03-07 13:23:13 -08:00
parent 06fb054ae2
commit a34d3facc4
8 changed files with 242 additions and 43 deletions

View File

@@ -397,16 +397,16 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
private void putUnrestrictedAttributes(Map<String, String> attributes) {
// Set full name attribute
attributes.put(User.Attribute.FULL_NAME, "Testy McTesterson"); // TODO
attributes.put(User.Attribute.FULL_NAME, getModel().getFullName());
// Set email address attribute
attributes.put(User.Attribute.EMAIL_ADDRESS, "test@test.test"); // TODO
attributes.put(User.Attribute.EMAIL_ADDRESS, getModel().getEmailAddress());
// Set organization attribute
attributes.put(User.Attribute.ORGANIZATION, "Example, Inc."); // TODO
attributes.put(User.Attribute.ORGANIZATION, getModel().getOrganization());
// Set role attribute
attributes.put(User.Attribute.ORGANIZATIONAL_ROLE, "Senior Lead Architect"); // TODO
attributes.put(User.Attribute.ORGANIZATIONAL_ROLE, getModel().getOrganizationalRole());
}
@@ -526,16 +526,16 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
private void setUnrestrictedAttributes(Map<String, String> attributes) {
// Translate full name attribute
logger.info("FULL NAME: \"{}\"", attributes.get(User.Attribute.FULL_NAME)); // TODO
getModel().setFullName(attributes.get(User.Attribute.FULL_NAME));
// Translate email address attribute
logger.info("EMAIL ADDRESS: \"{}\"", attributes.get(User.Attribute.EMAIL_ADDRESS)); // TODO
getModel().setEmailAddress(attributes.get(User.Attribute.EMAIL_ADDRESS));
// Translate organization attribute
logger.info("ORGANIZATION: \"{}\"", attributes.get(User.Attribute.ORGANIZATION)); // TODO
getModel().setOrganization(attributes.get(User.Attribute.ORGANIZATION));
// Translate role attribute
logger.info("ORGANIZATIONAL ROLE: \"{}\"", attributes.get(User.Attribute.ORGANIZATIONAL_ROLE)); // TODO
getModel().setOrganizationalRole(attributes.get(User.Attribute.ORGANIZATIONAL_ROLE));
}

View File

@@ -92,6 +92,28 @@ public class UserModel extends ObjectModel {
*/
private String timeZone;
/**
* The user's full name, or null if this is not known.
*/
private String fullName;
/**
* The email address of the user, or null if this is not known.
*/
private String emailAddress;
/**
* The organization, company, group, etc. that the user belongs to, or null
* if this is not known.
*/
private String organization;
/**
* The role that the user has at the organization, company, group, etc.
* they belong to, or null if this is not known.
*/
private String organizationalRole;
/**
* Creates a new, empty user.
*/
@@ -351,4 +373,93 @@ public class UserModel extends ObjectModel {
this.timeZone = timeZone;
}
/**
* Returns the user's full name, if known. If not available, null is
* returned.
*
* @return
* The user's full name, or null if this is not known.
*/
public String getFullName() {
return fullName;
}
/**
* Sets the user's full name.
*
* @param fullName
* The user's full name, or null if this is not known.
*/
public void setFullName(String fullName) {
this.fullName = fullName;
}
/**
* Returns the email address of the user, if known. If not available, null
* is returned.
*
* @return
* The email address of the user, or null if this is not known.
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* Sets the email address of the user.
*
* @param emailAddress
* The email address of the user, or null if this is not known.
*/
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
/**
* Returns the organization, company, group, etc. that the user belongs to,
* if known. If not available, null is returned.
*
* @return
* The organization, company, group, etc. that the user belongs to, or
* null if this is not known.
*/
public String getOrganization() {
return organization;
}
/**
* Sets the organization, company, group, etc. that the user belongs to.
*
* @param organization
* The organization, company, group, etc. that the user belongs to, or
* null if this is not known.
*/
public void setOrganization(String organization) {
this.organization = organization;
}
/**
* Returns the role that the user has at the organization, company, group,
* etc. they belong to. If not available, null is returned.
*
* @return
* The role that the user has at the organization, company, group, etc.
* they belong to, or null if this is not known.
*/
public String getOrganizationalRole() {
return organizationalRole;
}
/**
* Sets the role that the user has at the organization, company, group,
* etc. they belong to.
*
* @param organizationalRole
* The role that the user has at the organization, company, group, etc.
* they belong to, or null if this is not known.
*/
public void setOrganizationalRole(String organizationalRole) {
this.organizationalRole = organizationalRole;
}
}