Class Permissions
java.lang.Object
org.apache.jackrabbit.oak.spi.security.authorization.permission.Permissions
Provides constants for permissions used in the OAK access evaluation as well
as permission related utility methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final long -
Method Summary
Modifier and TypeMethodDescriptionaggregates(long permissions) static longdiff(long permissions, long otherPermissions) Returns those bits frompermissionsthat are not present in theotherPermissions, i.e.getNames(long permissions) Returns names of the specified permissions.static longgetPermission(@Nullable String path, long defaultPermission) static longgetPermissions(@NotNull String jcrActions, @NotNull TreeLocation location, boolean isAccessControlContent) Returns the permissions that correspond the given jcr actions such as specified inSession.hasPermission(String, String).static longgetPermissions(@Nullable String permissionNames) Returns the permissions that correspond the given permission names.static StringgetString(long permissions) Returns the names of the specified permissions separated by ','.static booleanincludes(long permissions, long permissionsToTest) static booleanisAggregate(long permission) static booleanisRepositoryPermission(long permission) static booleanrespectParentPermissions(long permissions)
-
Field Details
-
NO_PERMISSION
public static final long NO_PERMISSION- See Also:
-
READ_NODE
public static final long READ_NODE- Since:
- OAK 1.0
- See Also:
-
READ_PROPERTY
public static final long READ_PROPERTY- Since:
- OAK 1.0
- See Also:
-
ADD_PROPERTY
public static final long ADD_PROPERTY- Since:
- OAK 1.0
- See Also:
-
MODIFY_PROPERTY
public static final long MODIFY_PROPERTY- Since:
- OAK 1.0
- See Also:
-
REMOVE_PROPERTY
public static final long REMOVE_PROPERTY- See Also:
-
ADD_NODE
public static final long ADD_NODE- See Also:
-
REMOVE_NODE
public static final long REMOVE_NODE- See Also:
-
READ_ACCESS_CONTROL
public static final long READ_ACCESS_CONTROL- See Also:
-
MODIFY_ACCESS_CONTROL
public static final long MODIFY_ACCESS_CONTROL- See Also:
-
NODE_TYPE_MANAGEMENT
public static final long NODE_TYPE_MANAGEMENT- See Also:
-
VERSION_MANAGEMENT
public static final long VERSION_MANAGEMENT- See Also:
-
LOCK_MANAGEMENT
public static final long LOCK_MANAGEMENT- See Also:
-
LIFECYCLE_MANAGEMENT
public static final long LIFECYCLE_MANAGEMENT- See Also:
-
RETENTION_MANAGEMENT
public static final long RETENTION_MANAGEMENT- See Also:
-
MODIFY_CHILD_NODE_COLLECTION
public static final long MODIFY_CHILD_NODE_COLLECTION- See Also:
-
NODE_TYPE_DEFINITION_MANAGEMENT
public static final long NODE_TYPE_DEFINITION_MANAGEMENT- See Also:
-
NAMESPACE_MANAGEMENT
public static final long NAMESPACE_MANAGEMENT- See Also:
-
WORKSPACE_MANAGEMENT
public static final long WORKSPACE_MANAGEMENT- See Also:
-
PRIVILEGE_MANAGEMENT
public static final long PRIVILEGE_MANAGEMENT- See Also:
-
USER_MANAGEMENT
public static final long USER_MANAGEMENT- Since:
- OAK 1.0
- See Also:
-
INDEX_DEFINITION_MANAGEMENT
public static final long INDEX_DEFINITION_MANAGEMENT- Since:
- OAK 1.0
- See Also:
-
READ
public static final long READ- See Also:
-
REMOVE
public static final long REMOVE- Since:
- OAK 1.0
- See Also:
-
SET_PROPERTY
public static final long SET_PROPERTY- See Also:
-
WRITE
public static final long WRITE- See Also:
-
ALL
public static final long ALL- See Also:
-
PERMISSION_NAMES
-
-
Method Details
-
getNames
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
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
-
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 frompermissionsthat are not present in theotherPermissions, i.e. subtracts the other permissions from permissions.
If the specifiedotherPermissionsdo not intersect withpermissions,permissionsare returned.
Ifpermissionsis included inotherPermissions,NO_PERMISSIONis returned.- Parameters:
permissions- The permissions from which to subtractotherPermissions.otherPermissions- The permissions to be subtracted.- 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 inSession.hasPermission(String, String). Note that in addition to the regular JCR actions (Session.ACTION_READ,Session.ACTION_ADD_NODE,Session.ACTION_REMOVEandSession.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
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
-