diff --git a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js index 0905011bb..9534dd444 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; + }); /** 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 a1ba79720..d7759acd5 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 diff --git a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html index 5640b3c85..9869cd6e8 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 @@ -
- +
+ +
{{ role }}
+
{{ organization }}