mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +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;
|
$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.
|
* Cancels all pending edits, returning to the management page.
|
||||||
*/
|
*/
|
||||||
|
@@ -21,6 +21,6 @@
|
|||||||
THE SOFTWARE.
|
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>
|
<span class="name">{{item.name}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Checkbox -->
|
<!-- 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 -->
|
<!-- Connection name -->
|
||||||
<span class="name">{{item.name}}</span>
|
<span class="name">{{item.name}}</span>
|
||||||
|
@@ -64,7 +64,6 @@ THE SOFTWARE.
|
|||||||
<!-- List of connections and groups this user has access to -->
|
<!-- List of connections and groups this user has access to -->
|
||||||
<div class="connection-list" ng-class="{loading: !rootGroup}">
|
<div class="connection-list" ng-class="{loading: !rootGroup}">
|
||||||
<guac-group-list
|
<guac-group-list
|
||||||
context="groupListContext"
|
|
||||||
connection-group="rootGroup"
|
connection-group="rootGroup"
|
||||||
connection-template="'app/manage/templates/connection.html'"
|
connection-template="'app/manage/templates/connection.html'"
|
||||||
connection-group-template="'app/manage/templates/connectionGroup.html'"/>
|
connection-group-template="'app/manage/templates/connectionGroup.html'"/>
|
||||||
|
Reference in New Issue
Block a user