Class CmsPermissionSet

java.lang.Object
org.opencms.security.CmsPermissionSet
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CmsPermissionSetCustom

public class CmsPermissionSet extends Object implements Serializable
An immutable permission set that contains both allowed and denied permissions as bitsets.

Currently supported permissions are:

Since:
6.0.0
See Also:
  • Field Details

  • Constructor Details

    • CmsPermissionSet

      public CmsPermissionSet(int allowedPermissions, int deniedPermissions)
      Constructor to create a permission set with preset allowed and denied permissions.

      Parameters:
      allowedPermissions - the set of permissions to allow
      deniedPermissions - the set of permissions to deny
    • CmsPermissionSet

      protected CmsPermissionSet()
      Constructor to create an empty permission set.

    • CmsPermissionSet

      protected CmsPermissionSet(int allowedPermissions)
      Constructor to create a permission set with preset allowed permissions.

      Parameters:
      allowedPermissions - bitset of allowed permissions
  • Method Details

    • getPermissionKeys

      public static Set<String> getPermissionKeys()
      Returns the message keys of each permission known in the system.

      Returns:
      Enumeration of message keys
    • getPermissionValue

      public static int getPermissionValue(String key)
      Returns the value of a single permission.

      Parameters:
      key - the key of the permission
      Returns:
      the value of the given permission
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • getAllowedPermissions

      public int getAllowedPermissions()
      Returns the currently allowed permissions of ths permission set.

      Returns:
      the allowed permissions as bitset
    • getDeniedPermissions

      public int getDeniedPermissions()
      Returns the currently denied permissions of this permission set.

      Returns:
      the denied permissions as bitset.
    • getPermissions

      public int 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

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • requiresControlPermission

      public boolean 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

      public boolean 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

      public boolean 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

      public boolean 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

      public String toString()
      Returns the String representation of this permission set object.

      Overrides:
      toString in class Object
      See Also: