mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17: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,
|
protected Collection<ObjectPermissionModel> getImplicitPermissions(ModeledAuthenticatedUser user,
|
||||||
ModelType model) {
|
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.
|
// Get the user model and check for an entity ID.
|
||||||
UserModel userModel = user.getUser().getModel();
|
UserModel userModel = user.getUser().getModel();
|
||||||
Integer entityId = userModel.getEntityID();
|
|
||||||
if (entityId == null)
|
|
||||||
return Collections.emptyList();
|
|
||||||
|
|
||||||
// Build list of implicit permissions
|
// Build list of implicit permissions
|
||||||
Collection<ObjectPermissionModel> implicitPermissions =
|
Collection<ObjectPermissionModel> implicitPermissions =
|
||||||
@@ -442,7 +444,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
|||||||
|
|
||||||
// Create model which grants this permission to the current user
|
// Create model which grants this permission to the current user
|
||||||
ObjectPermissionModel permissionModel = new ObjectPermissionModel();
|
ObjectPermissionModel permissionModel = new ObjectPermissionModel();
|
||||||
permissionModel.setEntityID(entityId);
|
permissionModel.setEntityID(userModel.getEntityID());
|
||||||
permissionModel.setType(permission);
|
permissionModel.setType(permission);
|
||||||
permissionModel.setObjectIdentifier(model.getIdentifier());
|
permissionModel.setObjectIdentifier(model.getIdentifier());
|
||||||
|
|
||||||
|
@@ -763,5 +763,16 @@ public class ModeledUser extends ModeledPermissions<UserModel> implements User {
|
|||||||
public Permissions getEffectivePermissions() throws GuacamoleException {
|
public Permissions getEffectivePermissions() throws GuacamoleException {
|
||||||
return super.getEffective();
|
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