mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUAC-932: Display current system permissions in user edit interface.
This commit is contained in:
@@ -72,6 +72,31 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
||||
$scope.rootGroup = rootGroup;
|
||||
});
|
||||
|
||||
/**
|
||||
* Available system permission types, as translation string / internal
|
||||
* value pairs.
|
||||
*
|
||||
* @type Object[]
|
||||
*/
|
||||
$scope.systemPermissionTypes = [
|
||||
{
|
||||
label: "manage.edit.user.administerSystem",
|
||||
value: PermissionSet.SystemPermissionType.ADMINISTER
|
||||
},
|
||||
{
|
||||
label: "manage.edit.user.createUser",
|
||||
value: PermissionSet.SystemPermissionType.CREATE_USER
|
||||
},
|
||||
{
|
||||
label: "manage.edit.user.createConnection",
|
||||
value: PermissionSet.SystemPermissionType.CREATE_CONNECTION
|
||||
},
|
||||
{
|
||||
label: "manage.edit.user.createConnectionGroup",
|
||||
value: PermissionSet.SystemPermissionType.CREATE_CONNECTION_GROUP
|
||||
}
|
||||
];
|
||||
|
||||
// Expose permission query and modification functions to group list template
|
||||
$scope.groupListContext = {
|
||||
|
||||
@@ -123,6 +148,29 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether the given system permission is granted for the
|
||||
* user being edited.
|
||||
*
|
||||
* @param {String} type
|
||||
* The type string of the system permission to check.
|
||||
*
|
||||
* @returns {Boolean}
|
||||
* true if the user has the given system permission, false if the
|
||||
* user lacks the given system permission, or the permissions have
|
||||
* not yet been loaded.
|
||||
*/
|
||||
$scope.hasSystemPermission = function hasSystemPermission(type) {
|
||||
|
||||
// Assume no permission if permissions not available yet
|
||||
if (!$scope.permissions)
|
||||
return false;
|
||||
|
||||
// Return whether given permission is present
|
||||
return PermissionSet.hasSystemPermission($scope.permissions, type);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancels all pending edits, returning to the management page.
|
||||
*/
|
||||
|
@@ -51,28 +51,9 @@ THE SOFTWARE.
|
||||
<h2>{{'manage.edit.user.permissions' | translate}}</h2>
|
||||
<div class="section">
|
||||
<table class="properties">
|
||||
<tr>
|
||||
<th>{{'manage.edit.user.administerSystem' | translate}}</th>
|
||||
|
||||
<td><input type="checkbox" ng-model="systemPermissions.ADMINISTER" ng-change="markSystemPermissionModified('ADMINISTER')" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>{{'manage.edit.user.createUser' | translate}}</th>
|
||||
|
||||
<td><input type="checkbox" ng-model="systemPermissions.CREATE_USER" ng-change="markSystemPermissionModified('CREATE_USER')" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>{{'manage.edit.user.createConnection' | translate}}</th>
|
||||
|
||||
<td><input type="checkbox" ng-model="systemPermissions.CREATE_CONNECTION" ng-change="markSystemPermissionModified('CREATE_CONNECTION')" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>{{'manage.edit.user.createConnectionGroup' | translate}}</th>
|
||||
|
||||
<td><input type="checkbox" ng-model="systemPermissions.CREATE_CONNECTION_GROUP" ng-change="markSystemPermissionModified('CREATE_CONNECTION_GROUP')" /></td>
|
||||
<tr ng-repeat="systemPermissionType in systemPermissionTypes">
|
||||
<th>{{systemPermissionType.label | translate}}</th>
|
||||
<td><input type="checkbox" ng-checked="hasSystemPermission(systemPermissionType.value)"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user