Class CmsPermissionSet

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    CmsPermissionSetCustom

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

    Currently supported permissions are:

    Since:
    6.0.0
    See Also:
    Serialized Form
    • Constructor Detail

      • 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 Detail

      • getPermissionKeys

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

        Returns:
        Enumeration of message keys
      • getPermissionValue

        public static int getPermissionValue​(java.lang.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​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • 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

        public java.lang.String 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 java.lang.Object
        See Also:
        Object.hashCode()
      • 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

        public boolean 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 java.lang.String toString()
        Returns the String representation of this permission set object.

        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()