Class Permissions


  • public final class Permissions
    extends java.lang.Object
    Provides constants for permissions used in the OAK access evaluation as well as permission related utility methods.
    • Method Detail

      • getNames

        public static java.util.Set<java.lang.String> getNames​(long permissions)
        Returns names of the specified permissions.
        Parameters:
        permissions - The permissions for which the string representation should be collected.
        Returns:
        The names of the given permissions.
      • getString

        public static java.lang.String getString​(long permissions)
        Returns the names of the specified permissions separated by ','.
        Parameters:
        permissions - The permissions for which the string representation should be collected.
        Returns:
        The names of the given permissions separated by ',' such that i can be passed to Session.hasPermission(String, String) and Session.checkPermission(String, String).
      • isRepositoryPermission

        public static boolean isRepositoryPermission​(long permission)
      • isAggregate

        public static boolean isAggregate​(long permission)
      • aggregates

        public static java.lang.Iterable<java.lang.Long> aggregates​(long permissions)
      • includes

        public static boolean includes​(long permissions,
                                       long permissionsToTest)
      • respectParentPermissions

        public static boolean respectParentPermissions​(long permissions)
      • diff

        public static long diff​(long permissions,
                                long otherPermissions)
        Returns those bits from permissions that are not present in the otherPermissions, i.e. subtracts the other permissions from permissions.
        If the specified otherPermissions do not intersect with permissions, permissions are returned.
        If permissions is included in otherPermissions, NO_PERMISSION is returned.
        Parameters:
        permissions - The permissions from which to subtract otherPermissions.
        otherPermissions - The permissions to be subtracted.
        Returns:
        the differences of the 2 permissions or NO_PERMISSION.
      • getPermissions

        public static long getPermissions​(@NotNull
                                          @NotNull java.lang.String jcrActions,
                                          @NotNull
                                          @NotNull TreeLocation location,
                                          boolean isAccessControlContent)
        Returns the permissions that correspond the given jcr actions such as specified in Session.hasPermission(String, String). Note that in addition to the regular JCR actions (Session.ACTION_READ, Session.ACTION_ADD_NODE, Session.ACTION_REMOVE and Session.ACTION_SET_PROPERTY) the string may also contain the names of all permissions defined by this class.
        Parameters:
        jcrActions - A comma separated string of JCR actions and permission names.
        location - The tree location for which the permissions should be calculated.
        isAccessControlContent - Flag to mark the given location as access control content.
        Returns:
        The permissions.
        Throws:
        java.lang.IllegalArgumentException - If the string contains unknown actions or permission names.
      • getPermissions

        public static long getPermissions​(@Nullable
                                          @Nullable java.lang.String permissionNames)
        Returns the permissions that correspond the given permission names.
        Parameters:
        permissionNames - A comma separated string of permission names.
        Returns:
        The permissions.
        Throws:
        java.lang.IllegalArgumentException - If the string contains unknown actions or permission names.
      • getPermission

        public static long getPermission​(@Nullable
                                         @Nullable java.lang.String path,
                                         long defaultPermission)