From e31025273ab6e0fb5957675397fa49f62de5a982 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 26 May 2015 14:22:16 -0700 Subject: [PATCH] GUAC-800: Display user attributes within user editor. --- .../controllers/manageUserController.js | 15 +++++ .../webapp/app/manage/styles/attributes.css | 65 +++++++++++++++++++ .../app/manage/templates/manageUser.html | 8 ++- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 guacamole/src/main/webapp/app/manage/styles/attributes.css diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js index d45491dc9..8dd282d6b 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js @@ -39,6 +39,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto var guacNotification = $injector.get('guacNotification'); var userService = $injector.get('userService'); var permissionService = $injector.get('permissionService'); + var schemaService = $injector.get('schemaService'); /** * An action to be provided along with the object sent to showStatus which @@ -102,6 +103,14 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto */ $scope.permissions = null; + /** + * All available user attributes. This is only the set of attribute + * definitions, not attribute values. + * + * @type Field[] + */ + $scope.attributes = null; + /** * Returns whether critical data has completed being loaded. * @@ -115,11 +124,17 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto && $scope.permissionFlags !== null && $scope.rootGroup !== null && $scope.permissions !== null + && $scope.attributes !== null && $scope.canSaveUser !== null && $scope.canDeleteUser !== null; }; + // Pull user attribute schema + schemaService.getUserAttributes().success(function attributesReceived(attributes) { + $scope.attributes = attributes; + }); + // Pull user data userService.getUser(username).success(function userReceived(user) { $scope.user = user; diff --git a/guacamole/src/main/webapp/app/manage/styles/attributes.css b/guacamole/src/main/webapp/app/manage/styles/attributes.css new file mode 100644 index 000000000..9b3e826ca --- /dev/null +++ b/guacamole/src/main/webapp/app/manage/styles/attributes.css @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2015 Glyptodon LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* Do not stretch attributes to fit available area */ +.attributes input[type=text], +.attributes input[type=password], +.attributes input[type=number] { + width: auto; +} + +.attributes .form .fields { + display: table; + margin: 1em; +} + +.attributes .form .fields .labeled-field { + display: table-row; +} + +.attributes .form .fields .field-header, +.attributes .form .fields .form-field { + display: table-cell; + padding: 0.125em; + vertical-align: top; +} + +.attributes .form .fields .field-header { + padding-right: 1em; +} + +.attributes .form h3 { + + font-size: 1.25em; + font-weight: bold; + text-transform: uppercase; + padding: 0.75em 0.5em; + margin: 1em 0; + + border-bottom: 1px solid rgba(0, 0, 0, 0.125); + border-top: 1px solid rgba(0, 0, 0, 0.125); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.125); + background: rgba(0, 0, 0, 0.04); + + width: 100%; + +} diff --git a/guacamole/src/main/webapp/app/manage/templates/manageUser.html b/guacamole/src/main/webapp/app/manage/templates/manageUser.html index e3a143af3..4e0903f2d 100644 --- a/guacamole/src/main/webapp/app/manage/templates/manageUser.html +++ b/guacamole/src/main/webapp/app/manage/templates/manageUser.html @@ -47,6 +47,11 @@ THE SOFTWARE. + +
+ +
+

{{'MANAGE_USER.SECTION_HEADER_PERMISSIONS' | translate}}

@@ -63,8 +68,7 @@ THE SOFTWARE.
- - +

{{'MANAGE_USER.SECTION_HEADER_CONNECTIONS' | translate}}