Package org.opencms.security
Class CmsPermissionSet
java.lang.Object
org.opencms.security.CmsPermissionSet
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CmsPermissionSetCustom
An immutable permission set that contains both allowed and denied permissions as bitsets.
Currently supported permissions are:
(r) the right to read the contents of a resourcePERMISSION_READ
(w) the right to write the contents of a resourcePERMISSION_WRITE
(v) the right to see a resource in listings (workplace)PERMISSION_VIEW
(c) the right to set permissions of a resourcePERMISSION_CONTROL
(d) the right direct publish a resource even without publish project permissionsPERMISSION_DIRECT_PUBLISH
- Since:
- 6.0.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CmsPermissionSet
Permission set to check control access.static final CmsPermissionSet
Permission set to check direct publish permissions.static final CmsPermissionSet
Permission set to check read access.static final CmsPermissionSet
Permission set to check view access.static final CmsPermissionSet
Permission set to check write access.protected int
The set of allowed permissions.protected int
The set of denied permissions.static final int
The permission to control a resource.static final int
The permission to direct publish a resource.static final int
No permissions for a resource (used especially for denied permissions).static final int
All allowed permissions for a resource.static final int
The permission to read a resource.static final int
The permission to view a resource.static final int
The permission to write a resource. -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor to create an empty permission set.protected
CmsPermissionSet
(int allowedPermissions) Constructor to create a permission set with preset allowed permissions.CmsPermissionSet
(int allowedPermissions, int deniedPermissions) Constructor to create a permission set with preset allowed and denied permissions. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
Returns the currently allowed permissions of ths permission set.int
Returns the currently denied permissions of this permission set.Returns the message keys of each permission known in the system.int
Returns the permissions calculated from this permission set.Returns the string representation of the current permissions in this permission set.static int
getPermissionValue
(String key) Returns the value of a single permission.int
hashCode()
boolean
Returns true if control permissions (+c) are required by this permission set.boolean
Returns true if direct publish permissions (+d) are required by this permission set.boolean
Returns true if read permissions (+r) are required by this permission set.boolean
Returns true if view permissions (+v) are required by this permission set.boolean
Returns true if write permissions (+w) are required by this permission set.toString()
Returns the String representation of this permission set object.
-
Field Details
-
ACCESS_CONTROL
Permission set to check control access. -
ACCESS_DIRECT_PUBLISH
Permission set to check direct publish permissions. -
ACCESS_READ
Permission set to check read access. -
ACCESS_VIEW
Permission set to check view access. -
ACCESS_WRITE
Permission set to check write access. -
PERMISSION_CONTROL
The permission to control a resource.- See Also:
-
PERMISSION_DIRECT_PUBLISH
The permission to direct publish a resource.- See Also:
-
PERMISSION_EMPTY
No permissions for a resource (used especially for denied permissions).- See Also:
-
PERMISSION_FULL
All allowed permissions for a resource.- See Also:
-
PERMISSION_READ
The permission to read a resource.- See Also:
-
PERMISSION_VIEW
The permission to view a resource.- See Also:
-
PERMISSION_WRITE
The permission to write a resource.- See Also:
-
m_allowed
The set of allowed permissions. -
m_denied
The set of denied permissions.
-
-
Constructor Details
-
CmsPermissionSet
Constructor to create a permission set with preset allowed and denied permissions.- Parameters:
allowedPermissions
- the set of permissions to allowdeniedPermissions
- the set of permissions to deny
-
CmsPermissionSet
protected CmsPermissionSet()Constructor to create an empty permission set. -
CmsPermissionSet
Constructor to create a permission set with preset allowed permissions.- Parameters:
allowedPermissions
- bitset of allowed permissions
-
-
Method Details
-
getPermissionKeys
Returns the message keys of each permission known in the system.- Returns:
- Enumeration of message keys
-
getPermissionValue
Returns the value of a single permission.- Parameters:
key
- the key of the permission- Returns:
- the value of the given permission
-
equals
-
getAllowedPermissions
Returns the currently allowed permissions of ths permission set.- Returns:
- the allowed permissions as bitset
-
getDeniedPermissions
Returns the currently denied permissions of this permission set.- Returns:
- the denied permissions as bitset.
-
getPermissions
Returns the permissions calculated from this permission set.These are all permissions allowed but not denied.
- Returns:
- the resulting permission set
-
getPermissionString
Returns the string representation of the current permissions in this permission set.- Returns:
- string of the format {{+|-}{r|w|v|c|d}}*
-
hashCode
-
requiresControlPermission
Returns true if control permissions (+c) are required by this permission set.- Returns:
- true if control permissions (+c) are required by this permission set
-
requiresDirectPublishPermission
Returns true if direct publish permissions (+d) are required by this permission set.- Returns:
- true if direct publish permissions (+d) are required by this permission set
-
requiresReadPermission
Returns true if read permissions (+r) are required by this permission set.- Returns:
- true if read permissions (+r) are required by this permission set
-
requiresViewPermission
Returns true if view permissions (+v) are required by this permission set.- Returns:
- true if view permissions (+v) are required by this permission set
-
requiresWritePermission
Returns true if write permissions (+w) are required by this permission set.- Returns:
- true if write permissions (+w) are required by this permission set
-
toString
Returns the String representation of this permission set object.
-