mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
GUAC-586: List readable users if applicable to management.
This commit is contained in:
@@ -169,7 +169,7 @@ public class UserRESTService {
|
|||||||
|
|
||||||
// Filter users, if requested
|
// Filter users, if requested
|
||||||
Collection<String> userIdentifiers = userDirectory.getIdentifiers();
|
Collection<String> userIdentifiers = userDirectory.getIdentifiers();
|
||||||
if (!isAdmin && permissions != null) {
|
if (!isAdmin && permissions != null && !permissions.isEmpty()) {
|
||||||
ObjectPermissionSet userPermissions = self.getUserPermissions();
|
ObjectPermissionSet userPermissions = self.getUserPermissions();
|
||||||
userIdentifiers = userPermissions.getAccessibleObjects(permissions, userIdentifiers);
|
userIdentifiers = userPermissions.getAccessibleObjects(permissions, userIdentifiers);
|
||||||
}
|
}
|
||||||
|
@@ -204,34 +204,42 @@ angular.module('settings').directive('guacSettingsUsers', [function guacSettings
|
|||||||
if (!canManageUsers())
|
if (!canManageUsers())
|
||||||
$location.path('/');
|
$location.path('/');
|
||||||
|
|
||||||
});
|
var userPromise;
|
||||||
|
|
||||||
// Retrieve all users for whom we have UPDATE or DELETE permission
|
// If users can be created, list all readable users
|
||||||
dataSourceService.apply(userService.getUsers, dataSources, [
|
if ($scope.canCreateUsers())
|
||||||
PermissionSet.ObjectPermissionType.UPDATE,
|
userPromise = dataSourceService.apply(userService.getUsers, dataSources);
|
||||||
PermissionSet.ObjectPermissionType.DELETE
|
|
||||||
])
|
|
||||||
.then(function usersReceived(userArrays) {
|
|
||||||
|
|
||||||
var addedUsers = {};
|
// Otherwise, list only updateable/deletable users
|
||||||
$scope.manageableUsers = [];
|
else
|
||||||
|
userPromise = dataSourceService.apply(userService.getUsers, dataSources, [
|
||||||
|
PermissionSet.ObjectPermissionType.UPDATE,
|
||||||
|
PermissionSet.ObjectPermissionType.DELETE
|
||||||
|
]);
|
||||||
|
|
||||||
// For each user in each data source
|
userPromise.then(function usersReceived(userArrays) {
|
||||||
angular.forEach(dataSources, function addUserList(dataSource) {
|
|
||||||
angular.forEach(userArrays[dataSource], function addUser(user) {
|
|
||||||
|
|
||||||
// Do not add the same user twice
|
var addedUsers = {};
|
||||||
if (addedUsers[user.username])
|
$scope.manageableUsers = [];
|
||||||
return;
|
|
||||||
|
|
||||||
// Add user to overall list
|
// For each user in each data source
|
||||||
addedUsers[user.username] = user;
|
angular.forEach(dataSources, function addUserList(dataSource) {
|
||||||
$scope.manageableUsers.push(new ManageableUser ({
|
angular.forEach(userArrays[dataSource], function addUser(user) {
|
||||||
'dataSource' : dataSource,
|
|
||||||
'user' : user
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
// Do not add the same user twice
|
||||||
|
if (addedUsers[user.username])
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Add user to overall list
|
||||||
|
addedUsers[user.username] = user;
|
||||||
|
$scope.manageableUsers.push(new ManageableUser ({
|
||||||
|
'dataSource' : dataSource,
|
||||||
|
'user' : user
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user