mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-800: Add checkbox for granting/revoking permission to a user to change their own password.
This commit is contained in:
@@ -261,6 +261,76 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the permissionsAdded and permissionsRemoved permission sets to
|
||||
* reflect the addition of the given user permission.
|
||||
*
|
||||
* @param {String} type
|
||||
* The user permission to add, as defined by
|
||||
* PermissionSet.ObjectPermissionType.
|
||||
*
|
||||
* @param {String} identifier
|
||||
* The identifier of the user affected by the permission being added.
|
||||
*/
|
||||
var addUserPermission = function addUserPermission(type, identifier) {
|
||||
|
||||
// If permission was previously removed, simply un-remove it
|
||||
if (PermissionSet.hasUserPermission(permissionsRemoved, type, identifier))
|
||||
PermissionSet.removeUserPermission(permissionsRemoved, type, identifier);
|
||||
|
||||
// Otherwise, explicitly add the permission
|
||||
else
|
||||
PermissionSet.addUserPermission(permissionsAdded, type, identifier);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the permissionsAdded and permissionsRemoved permission sets to
|
||||
* reflect the removal of the given user permission.
|
||||
*
|
||||
* @param {String} type
|
||||
* The user permission to remove, as defined by
|
||||
* PermissionSet.ObjectPermissionType.
|
||||
*
|
||||
* @param {String} identifier
|
||||
* The identifier of the user affected by the permission being removed.
|
||||
*/
|
||||
var removeUserPermission = function removeUserPermission(type, identifier) {
|
||||
|
||||
// If permission was previously added, simply un-add it
|
||||
if (PermissionSet.hasUserPermission(permissionsAdded, type, identifier))
|
||||
PermissionSet.removeUserPermission(permissionsAdded, type, identifier);
|
||||
|
||||
// Otherwise, explicitly remove the permission
|
||||
else
|
||||
PermissionSet.addUserPermission(permissionsRemoved, type, identifier);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Notifies of a change to the selected user permissions for the user
|
||||
* being edited.
|
||||
*
|
||||
* @param {String} type
|
||||
* The user permission that was changed, as defined by
|
||||
* PermissionSet.ObjectPermissionType.
|
||||
*
|
||||
* @param {String} identifier
|
||||
* The identifier of the user affected by the changed permission.
|
||||
*/
|
||||
$scope.userPermissionChanged = function userPermissionChanged(type, identifier) {
|
||||
|
||||
// Determine current permission setting
|
||||
var value = $scope.permissionFlags.userPermissions[type][identifier];
|
||||
|
||||
// Add/remove permission depending on flag state
|
||||
if (value)
|
||||
addUserPermission(type, identifier);
|
||||
else
|
||||
removeUserPermission(type, identifier);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the permissionsAdded and permissionsRemoved permission sets to
|
||||
* reflect the addition of the given connection permission.
|
||||
|
@@ -56,6 +56,11 @@ THE SOFTWARE.
|
||||
<td><input type="checkbox" ng-model="permissionFlags.systemPermissions[systemPermissionType.value]"
|
||||
ng-change="systemPermissionChanged(systemPermissionType.value)"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{'MANAGE_USER.FIELD_HEADER_CHANGE_OWN_PASSWORD' | translate}}</th>
|
||||
<td><input type="checkbox" ng-model="permissionFlags.userPermissions.UPDATE[user.username]"
|
||||
ng-change="userPermissionChanged('UPDATE', user.username)"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@@ -220,6 +220,7 @@
|
||||
"ERROR_PASSWORD_MISMATCH" : "@:APP.ERROR_PASSWORD_MISMATCH",
|
||||
|
||||
"FIELD_HEADER_ADMINISTER_SYSTEM" : "Administer system:",
|
||||
"FIELD_HEADER_CHANGE_OWN_PASSWORD" : "Change own password:",
|
||||
"FIELD_HEADER_CREATE_NEW_USERS" : "Create new users:",
|
||||
"FIELD_HEADER_CREATE_NEW_CONNECTIONS" : "Create new connections:",
|
||||
"FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS" : "Create new connection groups:",
|
||||
|
Reference in New Issue
Block a user