GUAC-800: Display user attributes within user editor.

This commit is contained in:
Michael Jumper
2015-05-26 14:22:16 -07:00
parent c8c12663b3
commit e31025273a
3 changed files with 86 additions and 2 deletions

View File

@@ -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;

View File

@@ -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%;
}

View File

@@ -47,6 +47,11 @@ THE SOFTWARE.
</table>
</div>
<!-- User attributes section -->
<div class="attributes">
<guac-form namespace="'USER_ATTRIBUTES'" content="attributes" model="user.attributes"></guac-form>
</div>
<!-- System permissions section -->
<h2 class="header">{{'MANAGE_USER.SECTION_HEADER_PERMISSIONS' | translate}}</h2>
<div class="section">
@@ -63,8 +68,7 @@ THE SOFTWARE.
</tr>
</table>
</div>
<!-- Connection and connection group permission section -->
<h2 class="header">{{'MANAGE_USER.SECTION_HEADER_CONNECTIONS' | translate}}</h2>
<div class="section" ng-class="{loading: !rootGroup}">
<guac-group-list