GUAC-932: Display current connection/group permissions in user edit interface.

This commit is contained in:
Michael Jumper
2014-12-22 22:37:44 -08:00
parent b8e335e3c7
commit d4153470e7
4 changed files with 53 additions and 3 deletions

View File

@@ -72,6 +72,57 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
$scope.rootGroup = rootGroup;
});
// Expose permission query and modification functions to group list template
$scope.groupListContext = {
/**
* Determines whether read permission for the connection having the
* given identifier is granted for the user being edited.
*
* @param {String} identifier
* The identifier of the connection to check.
*
* @returns {Boolean}
* true if the user has read permission for the given connection,
* false if the user lacks read permission, or the permissions have
* not yet been loaded.
*/
canReadConnection : function canReadConnection(identifier) {
// Assume no permission if permissions not available yet
if (!$scope.permissions)
return false;
// Return whether READ permission is present
return PermissionSet.hasConnectionPermission($scope.permissions, PermissionSet.ObjectPermissionType.READ, identifier);
},
/**
* Determines whether read permission for the connection group having
* the given identifier is granted for the user being edited.
*
* @param {String} identifier
* The identifier of the connection group to check.
*
* @returns {Boolean}
* true if the user has read permission for the given connection
* group, false if the user lacks read permission, or the
* permissions have not yet been loaded.
*/
canReadConnectionGroup : function canReadConnectionGroup(identifier) {
// Assume no permission if permissions not available yet
if (!$scope.permissions)
return false;
// Return whether READ permission is present
return PermissionSet.hasConnectionGroupPermission($scope.permissions, PermissionSet.ObjectPermissionType.READ, identifier);
}
};
/**
* Cancels all pending edits, returning to the management page.
*/

View File

@@ -21,6 +21,6 @@
THE SOFTWARE.
-->
<input type="checkbox" ng-model="connectionPermissions[item.identifier]" ng-change="markConnectionPermissionModified(item.identifier)"/>
<input type="checkbox" ng-checked="context.canReadConnectionGroup(item.identifier)"/>
<span class="name">{{item.name}}</span>
</div>

View File

@@ -27,7 +27,7 @@
</div>
<!-- Checkbox -->
<input type="checkbox" ng-model="connectionPermissions[item.identifier]" ng-change="markConnectionPermissionModified(item.identifier)"/>
<input type="checkbox" ng-checked="context.canReadConnection(item.identifier)"/>
<!-- Connection name -->
<span class="name">{{item.name}}</span>

View File

@@ -64,7 +64,6 @@ THE SOFTWARE.
<!-- List of connections and groups this user has access to -->
<div class="connection-list" ng-class="{loading: !rootGroup}">
<guac-group-list
context="groupListContext"
connection-group="rootGroup"
connection-template="'app/manage/templates/connection.html'"
connection-group-template="'app/manage/templates/connectionGroup.html'"/>