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 <mjum...@apache.org> Authored: Wed Feb 22 01:26:11 2017 -0800 Committer: Michael Jumper <mjum...@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">