mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Merge pull request #35 from glyptodon/user-perms
GUAC-962: Do not attempt to query users unless absolutely necessary.
This commit is contained in:
@@ -325,10 +325,18 @@ public class UserRESTService {
|
||||
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
|
||||
// Get the user
|
||||
User user = userContext.getUserDirectory().get(username);
|
||||
if (user == null)
|
||||
throw new GuacamoleResourceNotFoundException("No such user: \"" + username + "\"");
|
||||
User user;
|
||||
|
||||
// If username is own username, just use self - might not have query permissions
|
||||
if (userContext.self().getUsername().equals(username))
|
||||
user = userContext.self();
|
||||
|
||||
// If not self, query corresponding user from directory
|
||||
else {
|
||||
user = userContext.getUserDirectory().get(username);
|
||||
if (user == null)
|
||||
throw new GuacamoleResourceNotFoundException("No such user: \"" + username + "\"");
|
||||
}
|
||||
|
||||
return new APIPermissionSet(user.getPermissions());
|
||||
|
||||
|
Reference in New Issue
Block a user