Class Permissions


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

      • getNames

        public static Set<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.
      • isRepositoryPermission

        public static boolean isRepositoryPermission​(long permission)
      • isAggregate

        public static boolean isAggregate​(long permission)
      • aggregates

        public static Iterable<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 -
        otherPermissions -
        Returns:
        the differences of the 2 permissions or NO_PERMISSION.
      • getPermissions

        public static long getPermissions​(@NotNull
                                          @NotNull 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:
        IllegalArgumentException - If the string contains unknown actions or permission names.
      • getPermissions

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

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