Class Permissions
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.security.authorization.permission.Permissions
-
public final class Permissions extends java.lang.ObjectProvides 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 longADD_NODEstatic longADD_PROPERTYstatic longALLstatic longINDEX_DEFINITION_MANAGEMENTstatic longLIFECYCLE_MANAGEMENTstatic longLOCK_MANAGEMENTstatic longMODIFY_ACCESS_CONTROLstatic longMODIFY_CHILD_NODE_COLLECTIONstatic longMODIFY_PROPERTYstatic longNAMESPACE_MANAGEMENTstatic longNO_PERMISSIONstatic longNODE_TYPE_DEFINITION_MANAGEMENTstatic longNODE_TYPE_MANAGEMENTstatic java.util.Map<java.lang.Long,java.lang.String>PERMISSION_NAMESstatic longPRIVILEGE_MANAGEMENTstatic longREADstatic longREAD_ACCESS_CONTROLstatic longREAD_NODEstatic longREAD_PROPERTYstatic longREMOVEstatic longREMOVE_NODEstatic longREMOVE_PROPERTYstatic longRETENTION_MANAGEMENTstatic longSET_PROPERTYstatic longUSER_MANAGEMENTstatic longVERSION_MANAGEMENTstatic longWORKSPACE_MANAGEMENTstatic longWRITE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Iterable<java.lang.Long>aggregates(long permissions)static longdiff(long permissions, long otherPermissions)Returns those bits frompermissionsthat are not present in theotherPermissions, i.e.static java.util.Set<java.lang.String>getNames(long permissions)Returns names of the specified permissions.static longgetPermission(@Nullable java.lang.String path, long defaultPermission)static longgetPermissions(@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 longgetPermissions(@Nullable java.lang.String permissionNames)Returns the permissions that correspond the given permission names.static java.lang.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 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 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 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_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:
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)
-
-