Disable roles the current user cannot assign

This commit is contained in:
Johannes Zellner
2020-03-06 12:33:36 -08:00
parent d5930fd859
commit 2a8d6f37c4
2 changed files with 8 additions and 11 deletions

View File

@@ -690,15 +690,12 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
Client.onReady(function () { if ($scope.user.isAtLeastAdmin) loadExternalLdapConfig(); });
Client.onReady(refreshAllUsers);
Client.onReady(function () {
// Update available roles depending on features
if ($scope.config.features.userMaxCount === null) {
$scope.roles = [
{ id: 'user', name: 'User', disabled: false },
{ id: 'usermanager', name: 'User Manager', disabled: false },
{ id: 'admin', name: 'Administrator', disabled: false },
{ id: 'owner', name: 'Owner', disabled: false }
];
}
$scope.roles = [
{ id: 'user', name: 'User', disabled: false },
{ id: 'usermanager', name: 'User Manager', disabled: false },
{ id: 'admin', name: 'Administrator', disabled: !$scope.user.isAtLeastAdmin },
{ id: 'owner', name: 'Owner', disabled: !$scope.user.isAtLeastOwner }
];
});
// setup all the dialog focus handling