You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2017/05/28 18:03:07 UTC

[01/11] incubator-guacamole-client git commit: GUACAMOLE-292: Store user profile information within PostgreSQL/MySQL database.

Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master be3bc6cde -> 3beedd10a


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


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/a34d3fac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/a34d3fac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/a34d3fac

Branch: refs/heads/master
Commit: a34d3facc4c99354d4262101e9c516f36b25c675
Parents: 06fb054
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Mar 7 13:23:13 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../guacamole/auth/jdbc/user/ModeledUser.java   |  16 +--
 .../guacamole/auth/jdbc/user/UserModel.java     | 111 +++++++++++++++++++
 .../schema/001-create-schema.sql                |   6 +
 .../schema/upgrade/upgrade-pre-0.9.13.sql       |  10 ++
 .../guacamole/auth/jdbc/user/UserMapper.xml     |  62 ++++++++---
 .../schema/001-create-schema.sql                |   6 +
 .../schema/upgrade/upgrade-pre-0.9.13.sql       |  10 ++
 .../guacamole/auth/jdbc/user/UserMapper.xml     |  64 ++++++++---
 8 files changed, 242 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
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 418fe80..418ffad 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
@@ -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));
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserModel.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserModel.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserModel.java
index 4dfb275..2376cae 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserModel.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserModel.java
@@ -93,6 +93,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.
      */
     public UserModel() {
@@ -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;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql
index 37a8259..29bc47a 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql
@@ -102,6 +102,12 @@ CREATE TABLE `guacamole_user` (
   -- Timezone used for all date/time comparisons and interpretation
   `timezone` VARCHAR(64),
 
+  -- Profile information
+  `full_name`           VARCHAR(256),
+  `email_address`       VARCHAR(256),
+  `organization`        VARCHAR(256),
+  `organizational_role` VARCHAR(256),
+
   PRIMARY KEY (`user_id`),
   UNIQUE KEY `username` (`username`)
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.13.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.13.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.13.sql
index bb37c6c..95bbc1c 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.13.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.13.sql
@@ -28,3 +28,13 @@ ALTER TABLE guacamole_connection ADD COLUMN proxy_encryption_method ENUM(
     'NONE',
     'SSL'
 );
+
+--
+-- Add new user profile columns
+--
+
+ALTER TABLE guacamole_user ADD COLUMN full_name           VARCHAR(256);
+ALTER TABLE guacamole_user ADD COLUMN email_address       VARCHAR(256);
+ALTER TABLE guacamole_user ADD COLUMN organization        VARCHAR(256);
+ALTER TABLE guacamole_user ADD COLUMN organizational_role VARCHAR(256);
+

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
index 3530b0b..0ddb051 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
@@ -25,17 +25,21 @@
 
     <!-- Result mapper for user objects -->
     <resultMap id="UserResultMap" type="org.apache.guacamole.auth.jdbc.user.UserModel" >
-        <id     column="user_id"             property="objectID"          jdbcType="INTEGER"/>
-        <result column="username"            property="identifier"        jdbcType="VARCHAR"/>
-        <result column="password_hash"       property="passwordHash"      jdbcType="BINARY"/>
-        <result column="password_salt"       property="passwordSalt"      jdbcType="BINARY"/>
-        <result column="password_date"       property="passwordDate"      jdbcType="TIMESTAMP"/>
-        <result column="disabled"            property="disabled"          jdbcType="BOOLEAN"/>
-        <result column="access_window_start" property="accessWindowStart" jdbcType="TIME"/>
-        <result column="access_window_end"   property="accessWindowEnd"   jdbcType="TIME"/>
-        <result column="valid_from"          property="validFrom"         jdbcType="DATE"/>
-        <result column="valid_until"         property="validUntil"        jdbcType="DATE"/>
-        <result column="timezone"            property="timeZone"          jdbcType="VARCHAR"/>
+        <id     column="user_id"             property="objectID"           jdbcType="INTEGER"/>
+        <result column="username"            property="identifier"         jdbcType="VARCHAR"/>
+        <result column="password_hash"       property="passwordHash"       jdbcType="BINARY"/>
+        <result column="password_salt"       property="passwordSalt"       jdbcType="BINARY"/>
+        <result column="password_date"       property="passwordDate"       jdbcType="TIMESTAMP"/>
+        <result column="disabled"            property="disabled"           jdbcType="BOOLEAN"/>
+        <result column="access_window_start" property="accessWindowStart"  jdbcType="TIME"/>
+        <result column="access_window_end"   property="accessWindowEnd"    jdbcType="TIME"/>
+        <result column="valid_from"          property="validFrom"          jdbcType="DATE"/>
+        <result column="valid_until"         property="validUntil"         jdbcType="DATE"/>
+        <result column="timezone"            property="timeZone"           jdbcType="VARCHAR"/>
+        <result column="full_name"           property="fullName"           jdbcType="VARCHAR"/>
+        <result column="email_address"       property="emailAddress"       jdbcType="VARCHAR"/>
+        <result column="organization"        property="organization"       jdbcType="VARCHAR"/>
+        <result column="organizational_role" property="organizationalRole" jdbcType="VARCHAR"/>
     </resultMap>
 
     <!-- Select all usernames -->
@@ -69,7 +73,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         FROM guacamole_user
         WHERE username IN
             <foreach collection="identifiers" item="identifier"
@@ -94,7 +102,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         FROM guacamole_user
         JOIN guacamole_user_permission ON affected_user_id = guacamole_user.user_id
         WHERE username IN
@@ -122,7 +134,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         FROM guacamole_user
         WHERE
             username = #{username,jdbcType=VARCHAR}
@@ -150,7 +166,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         )
         VALUES (
             #{object.identifier,jdbcType=VARCHAR},
@@ -163,7 +183,11 @@
             #{object.accessWindowEnd,jdbcType=TIME},
             #{object.validFrom,jdbcType=DATE},
             #{object.validUntil,jdbcType=DATE},
-            #{object.timeZone,jdbcType=VARCHAR}
+            #{object.timeZone,jdbcType=VARCHAR},
+            #{object.fullName,jdbcType=VARCHAR},
+            #{object.emailAddress,jdbcType=VARCHAR},
+            #{object.organization,jdbcType=VARCHAR},
+            #{object.organizationalRole,jdbcType=VARCHAR}
         )
 
     </insert>
@@ -180,7 +204,11 @@
             access_window_end = #{object.accessWindowEnd,jdbcType=TIME},
             valid_from = #{object.validFrom,jdbcType=DATE},
             valid_until = #{object.validUntil,jdbcType=DATE},
-            timezone = #{object.timeZone,jdbcType=VARCHAR}
+            timezone = #{object.timeZone,jdbcType=VARCHAR},
+            full_name = #{object.fullName,jdbcType=VARCHAR},
+            email_address = #{object.emailAddress,jdbcType=VARCHAR},
+            organization = #{object.organization,jdbcType=VARCHAR},
+            organizational_role = #{object.organizationalRole,jdbcType=VARCHAR}
         WHERE user_id = #{object.objectID,jdbcType=VARCHAR}
     </update>
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql
index 199b4bd..f9b2351 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql
@@ -143,6 +143,12 @@ CREATE TABLE guacamole_user (
   -- Timezone used for all date/time comparisons and interpretation
   timezone varchar(64),
 
+  -- Profile information
+  full_name           varchar(256),
+  email_address       varchar(256),
+  organization        varchar(256),
+  organizational_role varchar(256),
+
   PRIMARY KEY (user_id),
 
   CONSTRAINT username

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.13.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.13.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.13.sql
index 015ec9a..0fac528 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.13.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.13.sql
@@ -33,3 +33,13 @@ CREATE TYPE guacamole_proxy_encryption_method AS ENUM(
 ALTER TABLE guacamole_connection ADD COLUMN proxy_port integer;
 ALTER TABLE guacamole_connection ADD COLUMN proxy_hostname varchar(512);
 ALTER TABLE guacamole_connection ADD COLUMN proxy_encryption_method guacamole_proxy_encryption_method;
+
+--
+-- Add new user profile columns
+--
+
+ALTER TABLE guacamole_user ADD COLUMN full_name           VARCHAR(256);
+ALTER TABLE guacamole_user ADD COLUMN email_address       VARCHAR(256);
+ALTER TABLE guacamole_user ADD COLUMN organization        VARCHAR(256);
+ALTER TABLE guacamole_user ADD COLUMN organizational_role VARCHAR(256);
+

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a34d3fac/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
index 39ec05a..569a8ac 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
@@ -25,18 +25,22 @@
 
     <!-- Result mapper for user objects -->
     <resultMap id="UserResultMap" type="org.apache.guacamole.auth.jdbc.user.UserModel" >
-        <id     column="user_id"             property="objectID"          jdbcType="INTEGER"/>
-        <result column="username"            property="identifier"        jdbcType="VARCHAR"/>
-        <result column="password_hash"       property="passwordHash"      jdbcType="BINARY"/>
-        <result column="password_salt"       property="passwordSalt"      jdbcType="BINARY"/>
-        <result column="password_date"       property="passwordDate"      jdbcType="TIMESTAMP"/>
-        <result column="disabled"            property="disabled"          jdbcType="BOOLEAN"/>
-        <result column="expired"             property="expired"           jdbcType="BOOLEAN"/>
-        <result column="access_window_start" property="accessWindowStart" jdbcType="TIME"/>
-        <result column="access_window_end"   property="accessWindowEnd"   jdbcType="TIME"/>
-        <result column="valid_from"          property="validFrom"         jdbcType="DATE"/>
-        <result column="valid_until"         property="validUntil"        jdbcType="DATE"/>
-        <result column="timezone"            property="timeZone"          jdbcType="VARCHAR"/>
+        <id     column="user_id"             property="objectID"           jdbcType="INTEGER"/>
+        <result column="username"            property="identifier"         jdbcType="VARCHAR"/>
+        <result column="password_hash"       property="passwordHash"       jdbcType="BINARY"/>
+        <result column="password_salt"       property="passwordSalt"       jdbcType="BINARY"/>
+        <result column="password_date"       property="passwordDate"       jdbcType="TIMESTAMP"/>
+        <result column="disabled"            property="disabled"           jdbcType="BOOLEAN"/>
+        <result column="expired"             property="expired"            jdbcType="BOOLEAN"/>
+        <result column="access_window_start" property="accessWindowStart"  jdbcType="TIME"/>
+        <result column="access_window_end"   property="accessWindowEnd"    jdbcType="TIME"/>
+        <result column="valid_from"          property="validFrom"          jdbcType="DATE"/>
+        <result column="valid_until"         property="validUntil"         jdbcType="DATE"/>
+        <result column="timezone"            property="timeZone"           jdbcType="VARCHAR"/>
+        <result column="full_name"           property="fullName"           jdbcType="VARCHAR"/>
+        <result column="email_address"       property="emailAddress"       jdbcType="VARCHAR"/>
+        <result column="organization"        property="organization"       jdbcType="VARCHAR"/>
+        <result column="organizational_role" property="organizationalRole" jdbcType="VARCHAR"/>
     </resultMap>
 
     <!-- Select all usernames -->
@@ -70,7 +74,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         FROM guacamole_user
         WHERE username IN
             <foreach collection="identifiers" item="identifier"
@@ -95,7 +103,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         FROM guacamole_user
         JOIN guacamole_user_permission ON affected_user_id = guacamole_user.user_id
         WHERE username IN
@@ -123,7 +135,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         FROM guacamole_user
         WHERE
             username = #{username,jdbcType=VARCHAR}
@@ -151,7 +167,11 @@
             access_window_end,
             valid_from,
             valid_until,
-            timezone
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
         )
         VALUES (
             #{object.identifier,jdbcType=VARCHAR},
@@ -164,7 +184,11 @@
             #{object.accessWindowEnd,jdbcType=TIME},
             #{object.validFrom,jdbcType=DATE},
             #{object.validUntil,jdbcType=DATE},
-            #{object.timeZone,jdbcType=VARCHAR}
+            #{object.timeZone,jdbcType=VARCHAR},
+            #{object.fullName,jdbcType=VARCHAR},
+            #{object.emailAddress,jdbcType=VARCHAR},
+            #{object.organization,jdbcType=VARCHAR},
+            #{object.organizationalRole,jdbcType=VARCHAR}
         )
 
     </insert>
@@ -181,7 +205,11 @@
             access_window_end = #{object.accessWindowEnd,jdbcType=TIME},
             valid_from = #{object.validFrom,jdbcType=DATE},
             valid_until = #{object.validUntil,jdbcType=DATE},
-            timezone = #{object.timeZone,jdbcType=VARCHAR}
+            timezone = #{object.timeZone,jdbcType=VARCHAR},
+            full_name = #{object.fullName,jdbcType=VARCHAR},
+            email_address = #{object.emailAddress,jdbcType=VARCHAR},
+            organization = #{object.organization,jdbcType=VARCHAR},
+            organizational_role = #{object.organizationalRole,jdbcType=VARCHAR}
         WHERE user_id = #{object.objectID,jdbcType=VARCHAR}
     </update>
 


[09/11] incubator-guacamole-client git commit: GUACAMOLE-292: Use email field type for email address.

Posted by jm...@apache.org.
GUACAMOLE-292: Use email field type for email address.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/6327fa3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/6327fa3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/6327fa3a

Branch: refs/heads/master
Commit: 6327fa3a17d9fd6e2647a5d61d7ec8a91d4ec7f3
Parents: 8830123
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Feb 22 01:06:11 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/6327fa3a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
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 b3852e7..1c65827 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
@@ -43,6 +43,7 @@ import org.apache.guacamole.auth.jdbc.permission.SharingProfilePermissionService
 import org.apache.guacamole.auth.jdbc.permission.UserPermissionService;
 import org.apache.guacamole.form.BooleanField;
 import org.apache.guacamole.form.DateField;
+import org.apache.guacamole.form.EmailField;
 import org.apache.guacamole.form.Field;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.form.TextField;
@@ -124,7 +125,7 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
      */
     public static final Form PROFILE = new Form("profile", Arrays.<Field>asList(
         new TextField(FULL_NAME_ATTRIBUTE_NAME),
-        new TextField(EMAIL_ADDRESS_ATTRIBUTE_NAME)
+        new EmailField(EMAIL_ADDRESS_ATTRIBUTE_NAME)
     ));
 
     /**


[11/11] incubator-guacamole-client git commit: GUACAMOLE-292: Merge user profile base support.

Posted by jm...@apache.org.
GUACAMOLE-292: Merge user profile base support.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/3beedd10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/3beedd10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/3beedd10

Branch: refs/heads/master
Commit: 3beedd10af8548a83c8f2e5374438e16d0fafe90
Parents: be3bc6c 203afd1
Author: James Muehlner <ja...@guac-dev.org>
Authored: Sun May 28 11:01:47 2017 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Sun May 28 11:01:47 2017 -0700

----------------------------------------------------------------------
 .../guacamole/auth/jdbc/user/ModeledUser.java   |  68 ++++++++++++
 .../guacamole/auth/jdbc/user/UserModel.java     | 111 +++++++++++++++++++
 .../src/main/resources/translations/en.json     |   3 +-
 .../schema/001-create-schema.sql                |   6 +
 .../schema/upgrade/upgrade-pre-0.9.13.sql       |  10 ++
 .../guacamole/auth/jdbc/user/UserMapper.xml     |  62 ++++++++---
 .../schema/001-create-schema.sql                |   6 +
 .../schema/upgrade/upgrade-pre-0.9.13.sql       |  10 ++
 .../guacamole/auth/jdbc/user/UserMapper.xml     |  64 ++++++++---
 .../org/apache/guacamole/form/EmailField.java   |  37 +++++++
 .../java/org/apache/guacamole/form/Field.java   |   6 +
 .../org/apache/guacamole/net/auth/User.java     |  32 ++++++
 .../webapp/app/form/services/formService.js     |  10 ++
 .../webapp/app/form/templates/emailField.html   |   8 ++
 .../src/main/webapp/app/index/styles/input.css  |   4 +-
 .../webapp/app/manage/styles/attributes.css     |   1 +
 .../app/manage/styles/connection-parameter.css  |   1 +
 .../app/navigation/directives/guacUserMenu.js   |  58 +++++++++-
 .../webapp/app/navigation/navigationModule.js   |   1 +
 .../webapp/app/navigation/styles/user-menu.css  |  15 +++
 .../app/navigation/templates/guacUserMenu.html  |   7 ++
 .../src/main/webapp/app/rest/types/Field.js     |   8 ++
 .../src/main/webapp/app/rest/types/User.js      |  40 +++++++
 guacamole/src/main/webapp/translations/en.json  |   9 ++
 24 files changed, 538 insertions(+), 39 deletions(-)
----------------------------------------------------------------------



[08/11] incubator-guacamole-client git commit: GUACAMOLE-292: Define and use standard attributes for user organization and role.

Posted by jm...@apache.org.
GUACAMOLE-292: Define and use standard attributes for user organization and role.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/ee6edb9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/ee6edb9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/ee6edb9c

Branch: refs/heads/master
Commit: ee6edb9c82eb73b5c38c7ab13bd3750c80fd2c7f
Parents: 9634731
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Feb 24 01:54:41 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../guacamole/auth/jdbc/user/ModeledUser.java      | 16 +++++++++++++++-
 .../java/org/apache/guacamole/net/auth/User.java   | 11 +++++++++++
 guacamole/src/main/webapp/app/rest/types/User.js   | 17 ++++++++++++++++-
 guacamole/src/main/webapp/translations/en.json     |  6 ++++--
 4 files changed, 46 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/ee6edb9c/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
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 c2c7f72..418fe80 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
@@ -114,7 +114,9 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
      */
     public static final Form PROFILE = new Form("profile", Arrays.<Field>asList(
         new TextField(User.Attribute.FULL_NAME),
-        new EmailField(User.Attribute.EMAIL_ADDRESS)
+        new EmailField(User.Attribute.EMAIL_ADDRESS),
+        new TextField(User.Attribute.ORGANIZATION),
+        new TextField(User.Attribute.ORGANIZATIONAL_ROLE)
     ));
 
     /**
@@ -400,6 +402,12 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
         // Set email address attribute
         attributes.put(User.Attribute.EMAIL_ADDRESS, "test@test.test"); // TODO
 
+        // Set organization attribute
+        attributes.put(User.Attribute.ORGANIZATION, "Example, Inc."); // TODO
+
+        // Set role attribute
+        attributes.put(User.Attribute.ORGANIZATIONAL_ROLE, "Senior Lead Architect"); // TODO
+
     }
 
     /**
@@ -523,6 +531,12 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
         // Translate email address attribute
         logger.info("EMAIL ADDRESS: \"{}\"", attributes.get(User.Attribute.EMAIL_ADDRESS)); // TODO
 
+        // Translate organization attribute
+        logger.info("ORGANIZATION: \"{}\"", attributes.get(User.Attribute.ORGANIZATION)); // TODO
+
+        // Translate role attribute
+        logger.info("ORGANIZATIONAL ROLE: \"{}\"", attributes.get(User.Attribute.ORGANIZATIONAL_ROLE)); // TODO
+
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/ee6edb9c/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
----------------------------------------------------------------------
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 1d36583..88756e4 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
@@ -49,6 +49,17 @@ public interface User extends Identifiable {
          */
         public static String EMAIL_ADDRESS = "guac-email-address";
 
+        /**
+         * The organization, company, group, etc. that the user belongs to.
+         */
+        public static String ORGANIZATION = "guac-organization";
+
+        /**
+         * The role that the user has at the organization, company, group, etc.
+         * they belong to.
+         */
+        public static String ORGANIZATIONAL_ROLE = "guac-organizational-role";
+
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/ee6edb9c/guacamole/src/main/webapp/app/rest/types/User.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/rest/types/User.js b/guacamole/src/main/webapp/app/rest/types/User.js
index b6df12b..9edd1f2 100644
--- a/guacamole/src/main/webapp/app/rest/types/User.js
+++ b/guacamole/src/main/webapp/app/rest/types/User.js
@@ -85,7 +85,22 @@ angular.module('rest').factory('User', [function defineUser() {
          *
          * @type String
          */
-        EMAIL_ADDRESS : 'guac-email-address'
+        EMAIL_ADDRESS : 'guac-email-address',
+
+        /**
+         * The organization, company, group, etc. that the user belongs to.
+         *
+         * @type String
+         */
+        ORGANIZATION : 'guac-organization',
+
+        /**
+         * The role that the user has at the organization, company, group, etc.
+         * they belong to.
+         *
+         * @type String
+         */
+        ORGANIZATIONAL_ROLE : 'guac-organizational-role'
 
     };
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/ee6edb9c/guacamole/src/main/webapp/translations/en.json
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json
index 79a7ea7..4995f54 100644
--- a/guacamole/src/main/webapp/translations/en.json
+++ b/guacamole/src/main/webapp/translations/en.json
@@ -699,8 +699,10 @@
 
     "USER_ATTRIBUTES" : {
 
-        "FIELD_HEADER_GUAC_EMAIL_ADDRESS" : "Email address:",
-        "FIELD_HEADER_GUAC_FULL_NAME"     : "Full name:"
+        "FIELD_HEADER_GUAC_EMAIL_ADDRESS"       : "Email address:",
+        "FIELD_HEADER_GUAC_FULL_NAME"           : "Full name:",
+        "FIELD_HEADER_GUAC_ORGANIZATION"        : "Organization:",
+        "FIELD_HEADER_GUAC_ORGANIZATIONAL_ROLE" : "Role:"
 
     },
 


[02/11] incubator-guacamole-client git commit: GUACAMOLE-292: Define and use standard attributes for user full name and email.

Posted by jm...@apache.org.
GUACAMOLE-292: Define and use standard attributes for user full name and email.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/9634731f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/9634731f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/9634731f

Branch: refs/heads/master
Commit: 9634731fe69c9ce1501880cd6bf38fd755eb9e72
Parents: e9549fb
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Feb 24 01:50:26 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../guacamole/auth/jdbc/user/ModeledUser.java   | 23 +++++-------------
 .../src/main/resources/translations/en.json     |  2 --
 .../org/apache/guacamole/net/auth/User.java     | 21 ++++++++++++++++
 .../src/main/webapp/app/rest/types/User.js      | 25 ++++++++++++++++++++
 guacamole/src/main/webapp/translations/en.json  |  7 ++++++
 5 files changed, 59 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9634731f/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
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 1c65827..c2c7f72 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
@@ -67,17 +67,6 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> 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<UserModel> implements Us
      * form.
      */
     public static final Form PROFILE = new Form("profile", Arrays.<Field>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<UserModel> implements Us
     private void putUnrestrictedAttributes(Map<String, String> 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<UserModel> implements Us
     private void setUnrestrictedAttributes(Map<String, String> 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
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9634731f/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
----------------------------------------------------------------------
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 c6ce14b..bf73c35 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:",

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9634731f/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
----------------------------------------------------------------------
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 90167e4..1d36583 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
@@ -31,6 +31,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.
      *

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9634731f/guacamole/src/main/webapp/app/rest/types/User.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/rest/types/User.js b/guacamole/src/main/webapp/app/rest/types/User.js
index 4a808b1..b6df12b 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

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9634731f/guacamole/src/main/webapp/translations/en.json
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json
index 512524a..79a7ea7 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",


[04/11] incubator-guacamole-client git commit: GUACAMOLE-292: Allow restriction of form contents to defined values only.

Posted by jm...@apache.org.
GUACAMOLE-292: Allow restriction of form contents to defined values only.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b2871e7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b2871e7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b2871e7d

Branch: refs/heads/master
Commit: b2871e7da0cba79e92b70582244c1b22ac09b4d6
Parents: be3bc6c
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Feb 22 01:23:14 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../src/main/webapp/app/form/directives/form.js | 29 ++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b2871e7d/guacamole/src/main/webapp/app/form/directives/form.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/form/directives/form.js b/guacamole/src/main/webapp/app/form/directives/form.js
index 518db7d..a6d44f3 100644
--- a/guacamole/src/main/webapp/app/form/directives/form.js
+++ b/guacamole/src/main/webapp/app/form/directives/form.js
@@ -64,7 +64,16 @@ angular.module('form').directive('guacForm', [function form() {
              *
              * @type Boolean
              */
-            modelOnly : '='
+            modelOnly : '=',
+
+            /**
+             * Whether the contents of the form should be restricted to those
+             * fields/forms which have associated values defined within the
+             * given model object. By default, all fields will be shown.
+             *
+             * @type Boolean
+             */
+            valuesOnly : '='
 
         },
         templateUrl: 'app/form/templates/form.html',
@@ -184,14 +193,18 @@ angular.module('form').directive('guacForm', [function form() {
              */
             $scope.isVisible = function isVisible(field) {
 
-                // All fields are visible if contents are not restricted to
-                // model properties only
-                if (!$scope.modelOnly)
-                    return true;
+                // Forms with valuesOnly set should display only fields with
+                // associated values in the model object
+                if ($scope.valuesOnly)
+                    return field && $scope.values[field.name];
+
+                // Forms with modelOnly set should display only fields with
+                // associated properties in the model object
+                if ($scope.modelOnly)
+                    return field && (field.name in $scope.values);
 
-                // Otherwise, fields are only visible if they are present
-                // within the model
-                return field && (field.name in $scope.values);
+                // Otherwise, all fields are visible
+                return true;
 
             };
 


[06/11] incubator-guacamole-client git commit: GUACAMOLE-292: Add support for email fields.

Posted by jm...@apache.org.
GUACAMOLE-292: Add support for email fields.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/8830123c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/8830123c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/8830123c

Branch: refs/heads/master
Commit: 8830123c9b38fb838dff1701b005c311adaf77e4
Parents: afd051e
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Feb 22 01:04:27 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../org/apache/guacamole/form/EmailField.java   | 37 ++++++++++++++++++++
 .../java/org/apache/guacamole/form/Field.java   |  6 ++++
 .../webapp/app/form/services/formService.js     | 10 ++++++
 .../webapp/app/form/templates/emailField.html   |  8 +++++
 .../src/main/webapp/app/index/styles/input.css  |  4 +--
 .../webapp/app/manage/styles/attributes.css     |  1 +
 .../app/manage/styles/connection-parameter.css  |  1 +
 .../src/main/webapp/app/rest/types/Field.js     |  8 +++++
 8 files changed, 73 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java b/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java
new file mode 100644
index 0000000..e56a757
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/form/EmailField.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.form;
+
+/**
+ * Represents a text field which may contain an email address.
+ */
+public class EmailField extends Field {
+
+    /**
+     * Creates a new EmailField with the given name.
+     *
+     * @param name
+     *     The unique name to associate with this field.
+     */
+    public EmailField(String name) {
+        super(name, Field.Type.EMAIL);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java b/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
index dba1065..19f1ead 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
@@ -48,6 +48,12 @@ public class Field {
         public static String TEXT = "TEXT";
 
         /**
+         * An email address field. This field type generally behaves
+         * identically to arbitrary text fields, but has semantic differences.
+         */
+        public static String EMAIL = "EMAIL";
+
+        /**
          * A username field. This field type generally behaves identically to
          * arbitrary text fields, but has semantic differences.
          */

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/form/services/formService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/form/services/formService.js b/guacamole/src/main/webapp/app/form/services/formService.js
index 0d12259..c117bbf 100644
--- a/guacamole/src/main/webapp/app/form/services/formService.js
+++ b/guacamole/src/main/webapp/app/form/services/formService.js
@@ -48,6 +48,16 @@ angular.module('form').provider('formService', function formServiceProvider() {
         },
 
         /**
+         * Email address field type.
+         *
+         * @see {@link Field.Type.EMAIL}
+         * @type FieldType
+         */
+        'EMAIL' : {
+            templateUrl : 'app/form/templates/emailField.html'
+        },
+
+        /**
          * Numeric field type.
          *
          * @see {@link Field.Type.NUMERIC}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/form/templates/emailField.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/form/templates/emailField.html b/guacamole/src/main/webapp/app/form/templates/emailField.html
new file mode 100644
index 0000000..db6d3be
--- /dev/null
+++ b/guacamole/src/main/webapp/app/form/templates/emailField.html
@@ -0,0 +1,8 @@
+<div class="email-field">
+    <input type="email"
+           ng-model="model"
+           ng-hide="readOnly"
+           autocorrect="off"
+           autocapitalize="off"/>
+    <a href="mailto:{{model}}" ng-show="readOnly">{{model}}</a>
+</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/index/styles/input.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/styles/input.css b/guacamole/src/main/webapp/app/index/styles/input.css
index 1eb8d9b..4141c76 100644
--- a/guacamole/src/main/webapp/app/index/styles/input.css
+++ b/guacamole/src/main/webapp/app/index/styles/input.css
@@ -17,11 +17,11 @@
  * under the License.
  */
 
-input[type=checkbox], input[type=number], input[type=text], input[type=radio], label, textarea {
+input[type=checkbox], input[type=number], input[type=text], input[type=email], input[type=radio], label, textarea {
     -webkit-tap-highlight-color: rgba(128,192,128,0.5);
 }
 
-div.location, input[type=text], input[type=number], input[type=password], textarea {
+div.location, input[type=text], input[type=email], input[type=number], input[type=password], textarea {
     border: 1px solid #777;
     -moz-border-radius: 0.2em;
     -webkit-border-radius: 0.2em;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/manage/styles/attributes.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/styles/attributes.css b/guacamole/src/main/webapp/app/manage/styles/attributes.css
index 136ec5d..2b5bc92 100644
--- a/guacamole/src/main/webapp/app/manage/styles/attributes.css
+++ b/guacamole/src/main/webapp/app/manage/styles/attributes.css
@@ -19,6 +19,7 @@
 
 /* Do not stretch attributes to fit available area */
 .attributes input[type=text],
+.attributes input[type=email],
 .attributes input[type=password],
 .attributes input[type=number] {
     width: auto;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css b/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css
index a005703..8fe19d6 100644
--- a/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css
+++ b/guacamole/src/main/webapp/app/manage/styles/connection-parameter.css
@@ -19,6 +19,7 @@
 
 /* Do not stretch connection parameters to fit available area */
 .connection-parameters input[type=text],
+.connection-parameters input[type=email],
 .connection-parameters input[type=password],
 .connection-parameters input[type=number] {
     width: auto;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8830123c/guacamole/src/main/webapp/app/rest/types/Field.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/rest/types/Field.js b/guacamole/src/main/webapp/app/rest/types/Field.js
index 5204268..84dfe13 100644
--- a/guacamole/src/main/webapp/app/rest/types/Field.js
+++ b/guacamole/src/main/webapp/app/rest/types/Field.js
@@ -76,6 +76,14 @@ angular.module('rest').factory('Field', [function defineField() {
         TEXT : 'TEXT',
 
         /**
+         * The type string associated with parameters that may contain an email
+         * address.
+         *
+         * @type String
+         */
+        EMAIL : 'EMAIL',
+
+        /**
          * The type string associated with parameters that may contain an
          * arbitrary string, where that string represents the username of the
          * user authenticating with the remote desktop service.


[03/11] incubator-guacamole-client git commit: GUACAMOLE-292: Display user attributes within user menu.

Posted by jm...@apache.org.
GUACAMOLE-292: Display user attributes within user menu.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/e9549fbb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/e9549fbb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/e9549fbb

Branch: refs/heads/master
Commit: e9549fbb3bc21f756445dbda137cfb91a3ff5e44
Parents: 6327fa3
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Feb 22 01:26:11 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../webapp/app/navigation/directives/guacUserMenu.js  | 14 ++++++++++++++
 .../main/webapp/app/navigation/navigationModule.js    |  1 +
 .../main/webapp/app/navigation/styles/user-menu.css   | 12 ++++++++++++
 .../webapp/app/navigation/templates/guacUserMenu.html |  7 +++++++
 4 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/e9549fbb/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
index f94d006..0905011 100644
--- a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
+++ b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
@@ -47,6 +47,8 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
             var $location             = $injector.get('$location');
             var $route                = $injector.get('$route');
             var authenticationService = $injector.get('authenticationService');
+            var schemaService         = $injector.get('schemaService');
+            var userService           = $injector.get('userService');
             var userPageService       = $injector.get('userPageService');
 
             /**
@@ -56,6 +58,18 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
              */
             $scope.username = authenticationService.getCurrentUsername();
             
+            // Pull user attribute schema
+            schemaService.getUserAttributes(authenticationService.getDataSource())
+                    .success(function attributesReceived(attributes) {
+                $scope.attributes = attributes;
+            });
+
+            // Pull user data
+            userService.getUser(authenticationService.getDataSource(), $scope.username)
+                    .success(function userRetrieved(user) {
+                $scope.user = user;
+            });
+
             /**
              * The available main pages for the current user.
              * 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/e9549fbb/guacamole/src/main/webapp/app/navigation/navigationModule.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/navigationModule.js b/guacamole/src/main/webapp/app/navigation/navigationModule.js
index 332dcb8..24c63e3 100644
--- a/guacamole/src/main/webapp/app/navigation/navigationModule.js
+++ b/guacamole/src/main/webapp/app/navigation/navigationModule.js
@@ -22,6 +22,7 @@
  */
 angular.module('navigation', [
     'auth',
+    'form',
     'notification',
     'rest'
 ]);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/e9549fbb/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css b/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
index b7fce98..a1ba797 100644
--- a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
+++ b/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
@@ -82,3 +82,15 @@
 .user-menu .menu-dropdown .menu-contents li a.logout {
     background-image: url('images/action-icons/guac-logout-dark.png');
 }
+
+.user-menu .menu-dropdown .menu-contents .profile {
+    margin: 1em;
+    padding-bottom: 1em;
+    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
+    width: 2in;
+}
+
+.user-menu .menu-dropdown .menu-contents .profile span.field-header,
+.user-menu .menu-dropdown .menu-contents .profile h3 {
+    display: none;
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/e9549fbb/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
index 4ffd937..5640b3c 100644
--- a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
+++ b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
@@ -1,6 +1,13 @@
 <div class="user-menu" ng-show="!isAnonymous()">
     <guac-menu menu-title="username">
            
+        <!-- User profile view -->
+        <div class="profile">
+            <guac-form namespace="'USER_ATTRIBUTES'" content="attributes"
+                       model="user.attributes" values-only="true"
+                       read-only="true"></guac-form>
+        </div>
+
         <!-- Local actions -->
         <ul class="action-list">
             <li ng-repeat="action in localActions">


[10/11] incubator-guacamole-client git commit: GUACAMOLE-292: Remove now-unnecessary valuesOnly attribute of guacForm (reverts 4d7841a).

Posted by jm...@apache.org.
GUACAMOLE-292: Remove now-unnecessary valuesOnly attribute of guacForm (reverts 4d7841a).


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/203afd10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/203afd10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/203afd10

Branch: refs/heads/master
Commit: 203afd109911e2a4778b9cbf7b1fb792b5e16b4b
Parents: a34d3fa
Author: Michael Jumper <mj...@apache.org>
Authored: Fri May 26 20:25:12 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:14 2017 -0700

----------------------------------------------------------------------
 .../src/main/webapp/app/form/directives/form.js | 29 ++++++--------------
 1 file changed, 8 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/203afd10/guacamole/src/main/webapp/app/form/directives/form.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/form/directives/form.js b/guacamole/src/main/webapp/app/form/directives/form.js
index a6d44f3..518db7d 100644
--- a/guacamole/src/main/webapp/app/form/directives/form.js
+++ b/guacamole/src/main/webapp/app/form/directives/form.js
@@ -64,16 +64,7 @@ angular.module('form').directive('guacForm', [function form() {
              *
              * @type Boolean
              */
-            modelOnly : '=',
-
-            /**
-             * Whether the contents of the form should be restricted to those
-             * fields/forms which have associated values defined within the
-             * given model object. By default, all fields will be shown.
-             *
-             * @type Boolean
-             */
-            valuesOnly : '='
+            modelOnly : '='
 
         },
         templateUrl: 'app/form/templates/form.html',
@@ -193,18 +184,14 @@ angular.module('form').directive('guacForm', [function form() {
              */
             $scope.isVisible = function isVisible(field) {
 
-                // Forms with valuesOnly set should display only fields with
-                // associated values in the model object
-                if ($scope.valuesOnly)
-                    return field && $scope.values[field.name];
-
-                // Forms with modelOnly set should display only fields with
-                // associated properties in the model object
-                if ($scope.modelOnly)
-                    return field && (field.name in $scope.values);
+                // All fields are visible if contents are not restricted to
+                // model properties only
+                if (!$scope.modelOnly)
+                    return true;
 
-                // Otherwise, all fields are visible
-                return true;
+                // Otherwise, fields are only visible if they are present
+                // within the model
+                return field && (field.name in $scope.values);
 
             };
 


[07/11] incubator-guacamole-client git commit: GUACAMOLE-292: Explicitly pull standard attributes when rendering user menu; do not rely on schema.

Posted by jm...@apache.org.
GUACAMOLE-292: Explicitly pull standard attributes when rendering user menu; do not rely on schema.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/06fb054a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/06fb054a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/06fb054a

Branch: refs/heads/master
Commit: 06fb054ae24c991d7a664e01e53f577a79701938
Parents: ee6edb9
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Mar 6 16:19:08 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../app/navigation/directives/guacUserMenu.js   | 56 +++++++++++++++++---
 .../webapp/app/navigation/styles/user-menu.css  |  9 ++--
 .../app/navigation/templates/guacUserMenu.html  |  8 +--
 3 files changed, 59 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/06fb054a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
index 0905011..9534dd4 100644
--- a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
+++ b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
@@ -43,11 +43,13 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
         controller: ['$scope', '$injector',
             function guacUserMenuController($scope, $injector) {
 
+            // Required types
+            var User = $injector.get('User');
+
             // Get required services
             var $location             = $injector.get('$location');
             var $route                = $injector.get('$route');
             var authenticationService = $injector.get('authenticationService');
-            var schemaService         = $injector.get('schemaService');
             var userService           = $injector.get('userService');
             var userPageService       = $injector.get('userPageService');
 
@@ -57,17 +59,57 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
              * @type String
              */
             $scope.username = authenticationService.getCurrentUsername();
-            
-            // Pull user attribute schema
-            schemaService.getUserAttributes(authenticationService.getDataSource())
-                    .success(function attributesReceived(attributes) {
-                $scope.attributes = attributes;
-            });
+
+            /**
+             * The user's full name. If not yet available, or if not defined,
+             * this will be null.
+             *
+             * @type String
+             */
+            $scope.fullName = null;
+
+            /**
+             * A URL pointing to relevant user information such as the user's
+             * email address. If not yet available, or if no such URL can be
+             * determined, this will be null.
+             *
+             * @type String
+             */
+            $scope.userURL = null;
+
+            /**
+             * The organization, company, group, etc. that the user belongs to.
+             * If not yet available, or if not defined, this will be null.
+             *
+             * @type String
+             */
+            $scope.organization = null;
+
+            /**
+             * The role that the user has at the organization, company, group,
+             * etc. they belong to. If not yet available, or if not defined,
+             * this will be null.
+             *
+             * @type String
+             */
+            $scope.role = null;
 
             // Pull user data
             userService.getUser(authenticationService.getDataSource(), $scope.username)
                     .success(function userRetrieved(user) {
+
+                // Store retrieved user object
                 $scope.user = user;
+
+                // Pull basic profile information
+                $scope.fullName = user.attributes[User.Attributes.FULL_NAME];
+                $scope.organization = user.attributes[User.Attributes.ORGANIZATION];
+                $scope.role = user.attributes[User.Attributes.ORGANIZATIONAL_ROLE];
+
+                // Link to email address if available
+                var email = user.attributes[User.Attributes.EMAIL_ADDRESS];
+                $scope.userURL = email ? 'mailto:' + email : null;
+
             });
 
             /**

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/06fb054a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css b/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
index a1ba797..d7759ac 100644
--- a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
+++ b/guacamole/src/main/webapp/app/navigation/styles/user-menu.css
@@ -90,7 +90,10 @@
     width: 2in;
 }
 
-.user-menu .menu-dropdown .menu-contents .profile span.field-header,
-.user-menu .menu-dropdown .menu-contents .profile h3 {
-    display: none;
+.user-menu .menu-dropdown .menu-contents .profile .full-name {
+    font-weight: bold;
 }
+.user-menu .menu-dropdown .menu-contents .profile .organization,
+.user-menu .menu-dropdown .menu-contents .profile .organizational-role {
+    font-size: 0.8em;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/06fb054a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
index 5640b3c..9869cd6 100644
--- a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
+++ b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
@@ -2,10 +2,10 @@
     <guac-menu menu-title="username">
            
         <!-- User profile view -->
-        <div class="profile">
-            <guac-form namespace="'USER_ATTRIBUTES'" content="attributes"
-                       model="user.attributes" values-only="true"
-                       read-only="true"></guac-form>
+        <div class="profile" ng-show="fullName">
+            <div class="full-name"><a ng-href="{{userURL}}">{{ fullName }}</a></div>
+            <div class="organizational-role" ng-show="role">{{ role }}</div>
+            <div class="organization" ng-show="organization">{{ organization }}</div>
         </div>
 
         <!-- Local actions -->


[05/11] incubator-guacamole-client git commit: GUACAMOLE-292: Add stub attributes for full name and email.

Posted by jm...@apache.org.
GUACAMOLE-292: Add stub attributes for full name and email.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/afd051e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/afd051e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/afd051e5

Branch: refs/heads/master
Commit: afd051e59f947c2d14e29940ddb12ab9e42ee278
Parents: b2871e7
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Feb 22 00:16:14 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat May 27 11:28:13 2017 -0700

----------------------------------------------------------------------
 .../guacamole/auth/jdbc/user/ModeledUser.java   | 64 ++++++++++++++++++++
 .../src/main/resources/translations/en.json     |  5 +-
 2 files changed, 68 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/afd051e5/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
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 0528495..b3852e7 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
@@ -45,6 +45,7 @@ import org.apache.guacamole.form.BooleanField;
 import org.apache.guacamole.form.DateField;
 import org.apache.guacamole.form.Field;
 import org.apache.guacamole.form.Form;
+import org.apache.guacamole.form.TextField;
 import org.apache.guacamole.form.TimeField;
 import org.apache.guacamole.form.TimeZoneField;
 import org.apache.guacamole.net.auth.User;
@@ -65,6 +66,17 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> 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.
      */
@@ -107,6 +119,15 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
     public static final String TIMEZONE_ATTRIBUTE_NAME = "timezone";
 
     /**
+     * All attributes related to user profile information, within a logical
+     * form.
+     */
+    public static final Form PROFILE = new Form("profile", Arrays.<Field>asList(
+        new TextField(FULL_NAME_ATTRIBUTE_NAME),
+        new TextField(EMAIL_ADDRESS_ATTRIBUTE_NAME)
+    ));
+
+    /**
      * All attributes related to restricting user accounts, within a logical
      * form.
      */
@@ -125,6 +146,7 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
      * logical forms.
      */
     public static final Collection<Form> ATTRIBUTES = Collections.unmodifiableCollection(Arrays.asList(
+        PROFILE,
         ACCOUNT_RESTRICTIONS
     ));
 
@@ -372,6 +394,25 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
     }
 
     /**
+     * Stores all unrestricted (unprivileged) attributes within the given Map,
+     * pulling the values of those attributes from the underlying user model.
+     * If no value is yet defined for an attribute, that attribute will be set
+     * to null.
+     *
+     * @param attributes
+     *     The Map to store all unrestricted attributes within.
+     */
+    private void putUnrestrictedAttributes(Map<String, String> attributes) {
+
+        // Set full name attribute
+        attributes.put(FULL_NAME_ATTRIBUTE_NAME, "Testy McTesterson"); // TODO
+
+        // Set email address attribute
+        attributes.put(EMAIL_ADDRESS_ATTRIBUTE_NAME, "test@test.test"); // TODO
+
+    }
+
+    /**
      * Parses the given string into a corresponding date. The string must
      * follow the standard format used by date attributes, as defined by
      * DateField.FORMAT and as would be produced by DateField.format().
@@ -477,11 +518,31 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
 
     }
 
+    /**
+     * Stores all unrestricted (unprivileged) attributes within the underlying
+     * user model, pulling the values of those attributes from the given Map.
+     *
+     * @param attributes
+     *     The Map to pull all unrestricted attributes from.
+     */
+    private void setUnrestrictedAttributes(Map<String, String> attributes) {
+
+        // Translate full name attribute
+        logger.info("FULL NAME: \"{}\"", attributes.get(FULL_NAME_ATTRIBUTE_NAME)); // TODO
+
+        // Translate email address attribute
+        logger.info("EMAIL ADDRESS: \"{}\"", attributes.get(EMAIL_ADDRESS_ATTRIBUTE_NAME)); // TODO
+
+    }
+
     @Override
     public Map<String, String> getAttributes() {
 
         Map<String, String> attributes = new HashMap<String, String>();
 
+        // Always include unrestricted attributes
+        putUnrestrictedAttributes(attributes);
+
         // Include restricted attributes only if they should be exposed
         if (exposeRestrictedAttributes)
             putRestrictedAttributes(attributes);
@@ -492,6 +553,9 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
     @Override
     public void setAttributes(Map<String, String> attributes) {
 
+        // Always assign unrestricted attributes
+        setUnrestrictedAttributes(attributes);
+
         // Assign restricted attributes only if they are exposed
         if (exposeRestrictedAttributes)
             setRestrictedAttributes(attributes);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/afd051e5/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
----------------------------------------------------------------------
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 f182aac..c6ce14b 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,13 +79,16 @@
 
         "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:",
         "FIELD_HEADER_VALID_FROM"          : "Enable account after:",
         "FIELD_HEADER_VALID_UNTIL"         : "Disable account after:",
 
-        "SECTION_HEADER_RESTRICTIONS" : "Account Restrictions"
+        "SECTION_HEADER_RESTRICTIONS" : "Account Restrictions",
+        "SECTION_HEADER_PROFILE"      : "Profile"
 
     }