public class SimpleObjectPermissionSet extends Object implements ObjectPermissionSet
EMPTY_SET
Constructor and Description |
---|
SimpleObjectPermissionSet()
Creates a new empty SimpleObjectPermissionSet.
|
SimpleObjectPermissionSet(Collection<String> identifiers)
Creates a new SimpleObjectPermissionSet which contains only READ
permissions for each of the given identifiers.
|
SimpleObjectPermissionSet(Collection<String> identifiers,
Collection<ObjectPermission.Type> types)
Creates a new SimpleObjectPermissionSet which contains permissions for
all possible unique combinations of the given identifiers and permission
types.
|
SimpleObjectPermissionSet(Set<ObjectPermission> permissions)
Creates a new SimpleObjectPermissionSet which contains the permissions
within the given Set.
|
Modifier and Type | Method and Description |
---|---|
void |
addPermission(ObjectPermission.Type permission,
String identifier)
Adds the specified permission for the object having the given
identifier.
|
void |
addPermissions(Set<ObjectPermission> permissions)
Adds the specified permissions, if not already granted.
|
Collection<String> |
getAccessibleObjects(Collection<ObjectPermission.Type> permissionTypes,
Collection<String> identifiers)
Tests whether this user has the specified permissions for the objects
having the given identifiers.
|
Set<ObjectPermission> |
getPermissions()
Returns a Set which contains all permissions granted within this
permission set.
|
boolean |
hasPermission(ObjectPermission.Type permission,
String identifier)
Tests whether the permission of the given type is granted for the
object having the given identifier.
|
void |
removePermission(ObjectPermission.Type permission,
String identifier)
Removes the specified permission for the object having the given
identifier.
|
void |
removePermissions(Set<ObjectPermission> permissions)
Removes each of the specified permissions, if granted.
|
protected void |
setPermissions(Set<ObjectPermission> permissions)
Sets the Set which backs this SimpleObjectPermissionSet.
|
public SimpleObjectPermissionSet()
ObjectPermissionSet.EMPTY_SET
instead.public SimpleObjectPermissionSet(Collection<String> identifiers, Collection<ObjectPermission.Type> types)
identifiers
- The identifiers which should be associated permissions having each
of the given permission types.types
- The types of permissions which should be granted for each of the
given identifiers.public SimpleObjectPermissionSet(Collection<String> identifiers)
identifiers
- The identifiers which should each be associated with READ
permission.public SimpleObjectPermissionSet(Set<ObjectPermission> permissions)
permissions
- The Set of permissions this SimpleObjectPermissionSet should
contain.protected void setPermissions(Set<ObjectPermission> permissions)
permissions
- The Set of permissions this SimpleObjectPermissionSet should
contain.public Set<ObjectPermission> getPermissions()
PermissionSet
getPermissions
in interface ObjectPermissionSet
getPermissions
in interface PermissionSet<ObjectPermission>
public boolean hasPermission(ObjectPermission.Type permission, String identifier) throws org.apache.guacamole.GuacamoleException
ObjectPermissionSet
hasPermission
in interface ObjectPermissionSet
permission
- The permission to check.identifier
- The identifier of the object affected by the permission being
checked.org.apache.guacamole.GuacamoleException
- If an error occurs while checking permissions, or if permissions
cannot be checked due to lack of permissions to do so.public void addPermission(ObjectPermission.Type permission, String identifier) throws org.apache.guacamole.GuacamoleException
ObjectPermissionSet
addPermission
in interface ObjectPermissionSet
permission
- The permission to add.identifier
- The identifier of the object affected by the permission being
added.org.apache.guacamole.GuacamoleException
- If an error occurs while adding the permission, or if permission to
add permissions is denied.public void removePermission(ObjectPermission.Type permission, String identifier) throws org.apache.guacamole.GuacamoleException
ObjectPermissionSet
removePermission
in interface ObjectPermissionSet
permission
- The permission to remove.identifier
- The identifier of the object affected by the permission being
added.org.apache.guacamole.GuacamoleException
- If an error occurs while removing the permission, or if permission
to remove permissions is denied.public Collection<String> getAccessibleObjects(Collection<ObjectPermission.Type> permissionTypes, Collection<String> identifiers) throws org.apache.guacamole.GuacamoleException
ObjectPermissionSet
getAccessibleObjects
in interface ObjectPermissionSet
permissionTypes
- The permissions to check. An identifier will be included in the
resulting collection if at least one of these permissions is granted
for the associated objectidentifiers
- The identifiers of the objects affected by the permissions being
checked.org.apache.guacamole.GuacamoleException
- If an error occurs while checking permissions, or if permissions
cannot be checked due to lack of permissions to do so.public void addPermissions(Set<ObjectPermission> permissions) throws org.apache.guacamole.GuacamoleException
PermissionSet
addPermissions
in interface ObjectPermissionSet
addPermissions
in interface PermissionSet<ObjectPermission>
permissions
- The permissions to add.org.apache.guacamole.GuacamoleException
- If an error occurs while adding the permissions, or if permission to
add permissions is denied.public void removePermissions(Set<ObjectPermission> permissions) throws org.apache.guacamole.GuacamoleException
PermissionSet
removePermissions
in interface ObjectPermissionSet
removePermissions
in interface PermissionSet<ObjectPermission>
permissions
- The permissions to remove.org.apache.guacamole.GuacamoleException
- If an error occurs while removing the permissions, or if permission
to remove permissions is denied.Copyright © 2018. All rights reserved.