Class PermissionProviderImpl
java.lang.Object
org.apache.jackrabbit.oak.security.authorization.permission.PermissionProviderImpl
- All Implemented Interfaces:
- AccessControlConstants,- AggregatedPermissionProvider,- PermissionConstants,- PermissionProvider
- Direct Known Subclasses:
- MountPermissionProvider
public class PermissionProviderImpl
extends Object
implements PermissionProvider, AccessControlConstants, PermissionConstants, AggregatedPermissionProvider
- 
Field SummaryFields inherited from interface org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AccessControlConstantsAC_NODETYPE_NAMES, ACE_PROPERTY_NAMES, MIX_REP_ACCESS_CONTROLLABLE, MIX_REP_REPO_ACCESS_CONTROLLABLE, NT_REP_ACE, NT_REP_ACL, NT_REP_DENY_ACE, NT_REP_GRANT_ACE, NT_REP_POLICY, NT_REP_RESTRICTIONS, PARAM_RESTRICTION_PROVIDER, POLICY_NODE_NAMES, REP_CURRENT, REP_GLOB, REP_GLOBS, REP_ITEM_NAMES, REP_NODE_PATH, REP_NT_NAMES, REP_POLICY, REP_PREFIXES, REP_PRINCIPAL_NAME, REP_PRIVILEGES, REP_REPO_POLICY, REP_RESTRICTIONS, REP_SUBTREESFields inherited from interface org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionConstantsDEFAULT_READ_PATHS, NT_REP_PERMISSION_STORE, NT_REP_PERMISSIONS, PARAM_ADMINISTRATIVE_PRINCIPALS, PARAM_PERMISSIONS_JR2, PARAM_READ_PATHS, PERMISSION_NODE_NAMES, PERMISSION_NODETYPE_NAMES, PERMISSION_PROPERTY_NAMES, PERMISSIONS_STORE_PATH, REP_ACCESS_CONTROLLED_PATH, REP_IS_ALLOW, REP_NUM_PERMISSIONS, REP_PERMISSION_STORE, REP_PRIVILEGE_BITS, VALUE_PERMISSIONS_JR2
- 
Constructor SummaryConstructorsConstructorDescriptionPermissionProviderImpl(@NotNull Root root, @NotNull String workspaceName, @NotNull Set<Principal> principals, @NotNull RestrictionProvider restrictionProvider, @NotNull ConfigurationParameters options, @NotNull Context ctx, @NotNull ProviderCtx providerCtx) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected @NotNull org.apache.jackrabbit.oak.security.authorization.permission.PermissionStoregetPermissionStore(@NotNull Root root, @NotNull String workspaceName, @NotNull RestrictionProvider restrictionProvider) getPrivileges(@Nullable Tree tree) Returns the set of privilege names which are granted to the set ofPrincipals associated with this provider instance for the specifiedTree.@NotNull RepositoryPermissionReturn theRepositoryPermissionfor the set ofPrincipals associated with this provider instance.@NotNull TreePermissiongetTreePermission(@NotNull Tree tree, @NotNull TreeType type, @NotNull TreePermission parentPermission) Return theTreePermissionfor the set ofPrincipals associated with this provider at the specifiedtreewith the giventype.@NotNull TreePermissiongetTreePermission(@NotNull Tree tree, @NotNull TreePermission parentPermission) Return theTreePermissionfor the set ofPrincipals associated with this provider at the specifiedtree.booleanhasPrivileges(@Nullable Tree tree, @NotNull String... privilegeNames) Returns whether the principal set associated with thisPrivilegeManageris granted the privileges identified by the specified privilege names for the giventree.booleanTests if the the specified actions are granted at the given path for the set ofPrincipals associated with this provider instance.booleanisGranted(@NotNull Tree tree, @Nullable PropertyState property, long permissions) Test if the specified permissions are granted for the set ofPrincipals associated with this provider instance for the item identified by the given tree and optionally property.booleanisGranted(@NotNull TreeLocation location, long permissions) Test if the specified permissions are granted for the set ofPrincipals associated with this provider instance for the item identified by the givenlocationand optionally property.voidrefresh()Refresh thisPermissionProvider.longsupportedPermissions(@NotNull TreeLocation location, long permissions) Allows to determined the set or subset of permissions evaluated by the implementing permission provider for the specified location.longsupportedPermissions(@NotNull TreePermission treePermission, @Nullable PropertyState property, long permissions) Allows to determined the set or subset of permissions evaluated by the implementing permission provider for the specified tree permission (plus optionallyproperty).longsupportedPermissions(@Nullable Tree tree, @Nullable PropertyState property, long permissions) Allows to determined the set or subset of permissions evaluated by the implementing permission provider for the specified item (identified bytreeand optionallyproperty) or at the repository level in case the specifiedtreeisnull.@NotNull PrivilegeBitssupportedPrivileges(@Nullable Tree tree, @Nullable PrivilegeBits privilegeBits) Allows to determined the set or subset of privileges evaluated by the implementing permission provider for the specified tree or at the repository level in case the specifiedtreeisnull.
- 
Constructor Details- 
PermissionProviderImplpublic PermissionProviderImpl(@NotNull @NotNull Root root, @NotNull @NotNull String workspaceName, @NotNull @NotNull Set<Principal> principals, @NotNull @NotNull RestrictionProvider restrictionProvider, @NotNull @NotNull ConfigurationParameters options, @NotNull @NotNull Context ctx, @NotNull @NotNull ProviderCtx providerCtx) 
 
- 
- 
Method Details- 
refreshpublic void refresh()Description copied from interface:PermissionProviderRefresh thisPermissionProvider. The implementation is expected to subsequently return permission evaluation results that reflect the most recent revision of the repository.- Specified by:
- refreshin interface- PermissionProvider
 
- 
getPrivilegesDescription copied from interface:PermissionProviderReturns the set of privilege names which are granted to the set ofPrincipals associated with this provider instance for the specifiedTree.- Specified by:
- getPrivilegesin interface- PermissionProvider
- Parameters:
- tree- The- treefor which the privileges should be retrieved.
- Returns:
- set of privilege names
 
- 
hasPrivilegespublic boolean hasPrivileges(@Nullable @Nullable Tree tree, @NotNull @NotNull String... privilegeNames) Description copied from interface:PermissionProviderReturns whether the principal set associated with thisPrivilegeManageris granted the privileges identified by the specified privilege names for the giventree. In order to test for privileges being granted on a repository level rather than on a particular tree anulltree should be passed to this method.Testing a name identifying an aggregate privilege is equivalent to testing each non aggregate privilege name. - Specified by:
- hasPrivilegesin interface- PermissionProvider
- Parameters:
- tree- The tree to test for privileges being granted.
- privilegeNames- The name of the privileges.
- Returns:
- trueif all privileges are granted;- falseotherwise.
 
- 
getRepositoryPermissionDescription copied from interface:PermissionProviderReturn theRepositoryPermissionfor the set ofPrincipals associated with this provider instance.- Specified by:
- getRepositoryPermissionin interface- PermissionProvider
- Returns:
- The RepositoryPermissionfor the set ofPrincipals this provider instance has been created for.
 
- 
getTreePermission@NotNull public @NotNull TreePermission getTreePermission(@NotNull @NotNull Tree tree, @NotNull @NotNull TreePermission parentPermission) Description copied from interface:PermissionProviderReturn theTreePermissionfor the set ofPrincipals associated with this provider at the specifiedtree.- Specified by:
- getTreePermissionin interface- PermissionProvider
- Parameters:
- tree- The tree for which the- TreePermissionobject should be built.
- parentPermission- The- TreePermissionobject that has been obtained before for the parent tree.
- Returns:
- The TreePermissionobject for the specifiedtree.
 
- 
isGrantedpublic boolean isGranted(@NotNull @NotNull Tree tree, @Nullable @Nullable PropertyState property, long permissions) Description copied from interface:PermissionProviderTest if the specified permissions are granted for the set ofPrincipals associated with this provider instance for the item identified by the given tree and optionally property. This method will only returntrueif all permissions are granted.- Specified by:
- isGrantedin interface- PermissionProvider
- Parameters:
- tree- The- Treeto test the permissions for.
- property- A- PropertyStateif the item to test is a property or- nullif the item is a- Tree.
- permissions- The permissions to be tested.
- Returns:
- trueif the specified permissions are granted for the item identified by the given tree and optionally property state.
 
- 
isGrantedDescription copied from interface:PermissionProviderTests if the the specified actions are granted at the given path for the set ofPrincipals associated with this provider instance.The jcrActionsparameter is a comma separated list of action strings such as defined bySessionand passed toSession.hasPermission(String, String). When more than one action is specified in thejcrActionsparameter, this method will only returntrueif all of them are granted on the specified path.- Specified by:
- isGrantedin interface- PermissionProvider
- Parameters:
- oakPath- A valid oak path.
- jcrActions- The JCR actions that should be tested separated by ','
- Returns:
- trueif all actions are granted at the specified path;- falseotherwise.
 
- 
supportedPrivileges@NotNull public @NotNull PrivilegeBits supportedPrivileges(@Nullable @Nullable Tree tree, @Nullable @Nullable PrivilegeBits privilegeBits) Description copied from interface:AggregatedPermissionProviderAllows to determined the set or subset of privileges evaluated by the implementing permission provider for the specified tree or at the repository level in case the specifiedtreeisnull. If the givenprivilegeBitsisnullan implementation returns the complete set that is covered by the provider; otherwise the supported subset of the specifiedprivilegeBitsis returned. ReturningPrivilegeBits.EMPTYindicates that this implementation is not in charge of evaluating the specified privileges and thus will be ignored while computing the composite result ofPermissionProvider.getPrivileges(org.apache.jackrabbit.oak.api.Tree)orPermissionProvider.hasPrivileges(org.apache.jackrabbit.oak.api.Tree, String...).- Specified by:
- supportedPrivilegesin interface- AggregatedPermissionProvider
- Parameters:
- tree- The tree for which the privileges will be evaluated or- nullfor repository level privileges.
- privilegeBits- The privilege(s) to be tested or- null
- Returns:
- The set of privileges or the subset of the given privilegeBitsthat are supported and evaluated by the implementation at the giventreerepresented asPrivilegeBits.
 
- 
supportedPermissionspublic long supportedPermissions(@Nullable @Nullable Tree tree, @Nullable @Nullable PropertyState property, long permissions) Description copied from interface:AggregatedPermissionProviderAllows to determined the set or subset of permissions evaluated by the implementing permission provider for the specified item (identified bytreeand optionallyproperty) or at the repository level in case the specifiedtreeisnull. ReturningPermissions.NO_PERMISSIONindicates that this implementation is not in charge of evaluating the specified permissions for the specified item and thus will be ignored while computing the composite result ofPermissionProvider.isGranted(Tree, PropertyState, long).- Specified by:
- supportedPermissionsin interface- AggregatedPermissionProvider
- Parameters:
- tree- The tree for which the permissions will be evaluated or- nullfor repository level privileges.
- property- The target property or- null.
- permissions- The permissions to be tested
- Returns:
- The subset of the given permissionsthat are supported and evaluated by the implementation for the given item.
 
- 
supportedPermissionsDescription copied from interface:AggregatedPermissionProviderAllows to determined the set or subset of permissions evaluated by the implementing permission provider for the specified location. ReturningPermissions.NO_PERMISSIONindicates that this implementation is not in charge of evaluating the specified permissions for the specified location and thus will be ignored while computing the composite result ofPermissionProvider.isGranted(String, String)andAggregatedPermissionProvider.isGranted(TreeLocation, long).- Specified by:
- supportedPermissionsin interface- AggregatedPermissionProvider
- Parameters:
- location- The tree location for which the permissions will be evaluated.
- permissions- The permissions to be tested
- Returns:
- The subset of the given permissionsthat are supported and evaluated by the implementation for the given location.
 
- 
supportedPermissionspublic long supportedPermissions(@NotNull @NotNull TreePermission treePermission, @Nullable @Nullable PropertyState property, long permissions) Description copied from interface:AggregatedPermissionProviderAllows to determined the set or subset of permissions evaluated by the implementing permission provider for the specified tree permission (plus optionallyproperty). ReturningPermissions.NO_PERMISSIONindicates that this implementation is not in charge of evaluating the specified permissions for the specified tree permission and thus will be ignored while computing the composite result ofTreePermission.isGranted(long, PropertyState)andTreePermission.isGranted(long).- Specified by:
- supportedPermissionsin interface- AggregatedPermissionProvider
- Parameters:
- treePermission- The target tree permission.
- property- The target property or- null.
- permissions- The permissions to be tested
- Returns:
- The subset of the given permissionsthat are supported and evaluated by the implementation for the given tree permissions.
 
- 
isGrantedDescription copied from interface:AggregatedPermissionProviderTest if the specified permissions are granted for the set ofPrincipals associated with this provider instance for the item identified by the givenlocationand optionally property. This method will only returntrueif all permissions are granted.- Specified by:
- isGrantedin interface- AggregatedPermissionProvider
- Parameters:
- location- The- TreeLocationto test the permissions for.
- permissions- The permissions to be tested.
- Returns:
- trueif the specified permissions are granted for the existing or non-existing item identified by the given location.
 
- 
getTreePermission@NotNull public @NotNull TreePermission getTreePermission(@NotNull @NotNull Tree tree, @NotNull @NotNull TreeType type, @NotNull @NotNull TreePermission parentPermission) Description copied from interface:AggregatedPermissionProviderReturn theTreePermissionfor the set ofPrincipals associated with this provider at the specifiedtreewith the giventype.- Specified by:
- getTreePermissionin interface- AggregatedPermissionProvider
- Parameters:
- tree- The tree for which the- TreePermissionobject should be built.
- type- The type of this tree.
- parentPermission- The- TreePermissionobject that has been obtained before for the parent tree.
- Returns:
- The TreePermissionobject for the specifiedtree.
 
- 
getPermissionStore@NotNull protected @NotNull org.apache.jackrabbit.oak.security.authorization.permission.PermissionStore getPermissionStore(@NotNull @NotNull Root root, @NotNull @NotNull String workspaceName, @NotNull @NotNull RestrictionProvider restrictionProvider) 
 
-