mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-708: Implement isSkeleton method for ModeledUser.
This commit is contained in:
@@ -427,11 +427,13 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
||||
protected Collection<ObjectPermissionModel> getImplicitPermissions(ModeledAuthenticatedUser user,
|
||||
ModelType model) {
|
||||
|
||||
// Check to see if the user granting permissions is a skeleton user,
|
||||
// thus lacking database backing.
|
||||
if (user.getUser().isSkeleton())
|
||||
return Collections.emptyList();
|
||||
|
||||
// Get the user model and check for an entity ID.
|
||||
UserModel userModel = user.getUser().getModel();
|
||||
Integer entityId = userModel.getEntityID();
|
||||
if (entityId == null)
|
||||
return Collections.emptyList();
|
||||
|
||||
// Build list of implicit permissions
|
||||
Collection<ObjectPermissionModel> implicitPermissions =
|
||||
@@ -442,7 +444,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
||||
|
||||
// Create model which grants this permission to the current user
|
||||
ObjectPermissionModel permissionModel = new ObjectPermissionModel();
|
||||
permissionModel.setEntityID(entityId);
|
||||
permissionModel.setEntityID(userModel.getEntityID());
|
||||
permissionModel.setType(permission);
|
||||
permissionModel.setObjectIdentifier(model.getIdentifier());
|
||||
|
||||
|
@@ -763,5 +763,16 @@ public class ModeledUser extends ModeledPermissions<UserModel> implements User {
|
||||
public Permissions getEffectivePermissions() throws GuacamoleException {
|
||||
return super.getEffective();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this user is a skeleton user, lacking a database entity
|
||||
* entry.
|
||||
*
|
||||
* @return
|
||||
* True if this user is a skeleton user, otherwise false.
|
||||
*/
|
||||
public boolean isSkeleton() {
|
||||
return (getModel().getEntityID() == null);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user