Class Permissions
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.security.authorization.permission.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.
-
-
Field Summary
Fields Modifier and Type Field Description static long
ADD_NODE
static long
ADD_PROPERTY
static long
ALL
static long
INDEX_DEFINITION_MANAGEMENT
static long
LIFECYCLE_MANAGEMENT
static long
LOCK_MANAGEMENT
static long
MODIFY_ACCESS_CONTROL
static long
MODIFY_CHILD_NODE_COLLECTION
static long
MODIFY_PROPERTY
static long
NAMESPACE_MANAGEMENT
static long
NO_PERMISSION
static long
NODE_TYPE_DEFINITION_MANAGEMENT
static long
NODE_TYPE_MANAGEMENT
static java.util.Map<java.lang.Long,java.lang.String>
PERMISSION_NAMES
static long
PRIVILEGE_MANAGEMENT
static long
READ
static long
READ_ACCESS_CONTROL
static long
READ_NODE
static long
READ_PROPERTY
static long
REMOVE
static long
REMOVE_NODE
static long
REMOVE_PROPERTY
static long
RETENTION_MANAGEMENT
static long
SET_PROPERTY
static long
USER_MANAGEMENT
static long
VERSION_MANAGEMENT
static long
WORKSPACE_MANAGEMENT
static long
WRITE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Iterable<java.lang.Long>
aggregates(long permissions)
static long
diff(long permissions, long otherPermissions)
Returns those bits frompermissions
that are not present in theotherPermissions
, i.e.static java.util.Set<java.lang.String>
getNames(long permissions)
Returns names of the specified permissions.static long
getPermission(@Nullable java.lang.String path, long defaultPermission)
static long
getPermissions(@NotNull java.lang.String jcrActions, @NotNull TreeLocation location, boolean isAccessControlContent)
Returns the permissions that correspond the given jcr actions such as specified inSession.hasPermission(String, String)
.static long
getPermissions(@Nullable java.lang.String permissionNames)
Returns the permissions that correspond the given permission names.static java.lang.String
getString(long permissions)
Returns the names of the specified permissions separated by ','.static boolean
includes(long permissions, long permissionsToTest)
static boolean
isAggregate(long permission)
static boolean
isRepositoryPermission(long permission)
static boolean
respectParentPermissions(long permissions)
-
-
-
Field Detail
-
NO_PERMISSION
public static final long NO_PERMISSION
- See Also:
- Constant Field Values
-
READ_NODE
public static final long READ_NODE
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
READ_PROPERTY
public static final long READ_PROPERTY
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
ADD_PROPERTY
public static final long ADD_PROPERTY
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
MODIFY_PROPERTY
public static final long MODIFY_PROPERTY
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
REMOVE_PROPERTY
public static final long REMOVE_PROPERTY
- See Also:
- Constant Field Values
-
ADD_NODE
public static final long ADD_NODE
- See Also:
- Constant Field Values
-
REMOVE_NODE
public static final long REMOVE_NODE
- See Also:
- Constant Field Values
-
READ_ACCESS_CONTROL
public static final long READ_ACCESS_CONTROL
- See Also:
- Constant Field Values
-
MODIFY_ACCESS_CONTROL
public static final long MODIFY_ACCESS_CONTROL
- See Also:
- Constant Field Values
-
NODE_TYPE_MANAGEMENT
public static final long NODE_TYPE_MANAGEMENT
- See Also:
- Constant Field Values
-
VERSION_MANAGEMENT
public static final long VERSION_MANAGEMENT
- See Also:
- Constant Field Values
-
LOCK_MANAGEMENT
public static final long LOCK_MANAGEMENT
- See Also:
- Constant Field Values
-
LIFECYCLE_MANAGEMENT
public static final long LIFECYCLE_MANAGEMENT
- See Also:
- Constant Field Values
-
RETENTION_MANAGEMENT
public static final long RETENTION_MANAGEMENT
- See Also:
- Constant Field Values
-
MODIFY_CHILD_NODE_COLLECTION
public static final long MODIFY_CHILD_NODE_COLLECTION
- See Also:
- Constant Field Values
-
NODE_TYPE_DEFINITION_MANAGEMENT
public static final long NODE_TYPE_DEFINITION_MANAGEMENT
- See Also:
- Constant Field Values
-
NAMESPACE_MANAGEMENT
public static final long NAMESPACE_MANAGEMENT
- See Also:
- Constant Field Values
-
WORKSPACE_MANAGEMENT
public static final long WORKSPACE_MANAGEMENT
- See Also:
- Constant Field Values
-
PRIVILEGE_MANAGEMENT
public static final long PRIVILEGE_MANAGEMENT
- See Also:
- Constant Field Values
-
USER_MANAGEMENT
public static final long USER_MANAGEMENT
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
INDEX_DEFINITION_MANAGEMENT
public static final long INDEX_DEFINITION_MANAGEMENT
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
READ
public static final long READ
- See Also:
- Constant Field Values
-
REMOVE
public static final long REMOVE
- Since:
- OAK 1.0
- See Also:
- Constant Field Values
-
SET_PROPERTY
public static final long SET_PROPERTY
- See Also:
- Constant Field Values
-
WRITE
public static final long WRITE
- See Also:
- Constant Field Values
-
ALL
public static final long ALL
- See Also:
- Constant Field Values
-
PERMISSION_NAMES
public static final java.util.Map<java.lang.Long,java.lang.String> PERMISSION_NAMES
-
-
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)
andSession.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 frompermissions
that are not present in theotherPermissions
, i.e. subtracts the other permissions from permissions.
If the specifiedotherPermissions
do not intersect withpermissions
,permissions
are returned.
Ifpermissions
is included inotherPermissions
,NO_PERMISSION
is returned.- Parameters:
permissions
-otherPermissions
-- 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 inSession.hasPermission(String, String)
. Note that in addition to the regular JCR actions (Session.ACTION_READ
,Session.ACTION_ADD_NODE
,Session.ACTION_REMOVE
andSession.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)
-
-