mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUAC-932: Display current connection/group permissions in user edit interface.
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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'"/>
|
||||
|
Reference in New Issue
Block a user