diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java index 1c6582749..c2c7f7212 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java @@ -66,17 +66,6 @@ public class ModeledUser extends ModeledDirectoryObject implements Us */ private static final Logger logger = LoggerFactory.getLogger(ModeledUser.class); - /** - * The name of the attribute which holds the user's full name, if known. - */ - public static final String FULL_NAME_ATTRIBUTE_NAME = "full-name"; - - /** - * The name of the attribute which holds the user's email address, if - * known. - */ - public static final String EMAIL_ADDRESS_ATTRIBUTE_NAME = "email-address"; - /** * The name of the attribute which controls whether a user account is * disabled. @@ -124,8 +113,8 @@ public class ModeledUser extends ModeledDirectoryObject implements Us * form. */ public static final Form PROFILE = new Form("profile", Arrays.asList( - new TextField(FULL_NAME_ATTRIBUTE_NAME), - new EmailField(EMAIL_ADDRESS_ATTRIBUTE_NAME) + new TextField(User.Attribute.FULL_NAME), + new EmailField(User.Attribute.EMAIL_ADDRESS) )); /** @@ -406,10 +395,10 @@ public class ModeledUser extends ModeledDirectoryObject implements Us private void putUnrestrictedAttributes(Map attributes) { // Set full name attribute - attributes.put(FULL_NAME_ATTRIBUTE_NAME, "Testy McTesterson"); // TODO + attributes.put(User.Attribute.FULL_NAME, "Testy McTesterson"); // TODO // Set email address attribute - attributes.put(EMAIL_ADDRESS_ATTRIBUTE_NAME, "test@test.test"); // TODO + attributes.put(User.Attribute.EMAIL_ADDRESS, "test@test.test"); // TODO } @@ -529,10 +518,10 @@ public class ModeledUser extends ModeledDirectoryObject implements Us private void setUnrestrictedAttributes(Map attributes) { // Translate full name attribute - logger.info("FULL NAME: \"{}\"", attributes.get(FULL_NAME_ATTRIBUTE_NAME)); // TODO + logger.info("FULL NAME: \"{}\"", attributes.get(User.Attribute.FULL_NAME)); // TODO // Translate email address attribute - logger.info("EMAIL ADDRESS: \"{}\"", attributes.get(EMAIL_ADDRESS_ATTRIBUTE_NAME)); // TODO + logger.info("EMAIL ADDRESS: \"{}\"", attributes.get(User.Attribute.EMAIL_ADDRESS)); // TODO } diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json index c6ce14b04..bf73c35d8 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json @@ -79,8 +79,6 @@ "FIELD_HEADER_DISABLED" : "Login disabled:", "FIELD_HEADER_EXPIRED" : "Password expired:", - "FIELD_HEADER_EMAIL_ADDRESS" : "Email address:", - "FIELD_HEADER_FULL_NAME" : "Full name:", "FIELD_HEADER_ACCESS_WINDOW_END" : "Do not allow access after:", "FIELD_HEADER_ACCESS_WINDOW_START" : "Allow access after:", "FIELD_HEADER_TIMEZONE" : "User time zone:", diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java index 90167e4e2..1d365837f 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java @@ -30,6 +30,27 @@ import org.apache.guacamole.net.auth.permission.SystemPermissionSet; */ public interface User extends Identifiable { + /** + * All standard attribute names with semantics defined by the Guacamole web + * application. Extensions may additionally define their own attributes + * with completely arbitrary names and semantics, so long as those names do + * not conflict with the names listed here. All standard attribute names + * have a "guac-" prefix to avoid such conflicts. + */ + public static class Attribute { + + /** + * The user's full name. + */ + public static String FULL_NAME = "guac-full-name"; + + /** + * The email address of the user. + */ + public static String EMAIL_ADDRESS = "guac-email-address"; + + } + /** * Returns this user's password. Note that the password returned may be * hashed or completely arbitrary. diff --git a/guacamole/src/main/webapp/app/rest/types/User.js b/guacamole/src/main/webapp/app/rest/types/User.js index 4a808b164..b6df12b04 100644 --- a/guacamole/src/main/webapp/app/rest/types/User.js +++ b/guacamole/src/main/webapp/app/rest/types/User.js @@ -64,6 +64,31 @@ angular.module('rest').factory('User', [function defineUser() { }; + /** + * All standard attribute names with semantics defined by the Guacamole web + * application. Extensions may additionally define their own attributes + * with completely arbitrary names and semantics, so long as those names do + * not conflict with the names listed here. All standard attribute names + * have a "guac-" prefix to avoid such conflicts. + */ + User.Attributes = { + + /** + * The user's full name. + * + * @type String + */ + FULL_NAME : 'guac-full-name', + + /** + * The email address of the user. + * + * @type String + */ + EMAIL_ADDRESS : 'guac-email-address' + + }; + return User; }]); \ No newline at end of file diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json index 512524a89..79a7ea7fd 100644 --- a/guacamole/src/main/webapp/translations/en.json +++ b/guacamole/src/main/webapp/translations/en.json @@ -697,6 +697,13 @@ }, + "USER_ATTRIBUTES" : { + + "FIELD_HEADER_GUAC_EMAIL_ADDRESS" : "Email address:", + "FIELD_HEADER_GUAC_FULL_NAME" : "Full name:" + + }, + "USER_MENU" : { "ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",