Interface PermissionProvider
- All Known Subinterfaces:
AggregatedPermissionProvider
- All Known Implementing Classes:
EmptyPermissionProvider,OpenPermissionProvider
public interface PermissionProvider
Main entry point for permission evaluation in Oak. This provider covers
permission validation upon read and write access on the Oak API as well as
the various permission related methods defined by the JCR API, namely on
AccessControlManager and Session.-
Method Summary
Modifier and TypeMethodDescriptiongetPrivileges(@Nullable org.apache.jackrabbit.oak.api.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 org.apache.jackrabbit.oak.api.Tree tree, @NotNull TreePermission parentPermission) Return theTreePermissionfor the set ofPrincipals associated with this provider at the specifiedtree.booleanhasPrivileges(@Nullable org.apache.jackrabbit.oak.api.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 org.apache.jackrabbit.oak.api.Tree tree, @Nullable org.apache.jackrabbit.oak.api.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.voidrefresh()Refresh thisPermissionProvider.
-
Method Details
-
refresh
void refresh()Refresh thisPermissionProvider. The implementation is expected to subsequently return permission evaluation results that reflect the most recent revision of the repository. -
getPrivileges
@NotNull @NotNull Set<String> getPrivileges(@Nullable @Nullable org.apache.jackrabbit.oak.api.Tree tree) Returns the set of privilege names which are granted to the set ofPrincipals associated with this provider instance for the specifiedTree.- Parameters:
tree- Thetreefor which the privileges should be retrieved.- Returns:
- set of privilege names
-
hasPrivileges
boolean hasPrivileges(@Nullable @Nullable org.apache.jackrabbit.oak.api.Tree tree, @NotNull @NotNull String... privilegeNames) Returns 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.
- Parameters:
tree- The tree to test for privileges being granted.privilegeNames- The name of the privileges.- Returns:
trueif all privileges are granted;falseotherwise.
-
getRepositoryPermission
Return theRepositoryPermissionfor the set ofPrincipals associated with this provider instance.- Returns:
- The
RepositoryPermissionfor the set ofPrincipals this provider instance has been created for.
-
getTreePermission
@NotNull @NotNull TreePermission getTreePermission(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree tree, @NotNull @NotNull TreePermission parentPermission) Return theTreePermissionfor the set ofPrincipals associated with this provider at the specifiedtree.- Parameters:
tree- The tree for which theTreePermissionobject should be built.parentPermission- TheTreePermissionobject that has been obtained before for the parent tree.- Returns:
- The
TreePermissionobject for the specifiedtree.
-
isGranted
boolean isGranted(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree tree, @Nullable @Nullable org.apache.jackrabbit.oak.api.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. This method will only returntrueif all permissions are granted.- Parameters:
tree- TheTreeto test the permissions for.property- APropertyStateif the item to test is a property ornullif the item is aTree.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.
-
isGranted
Tests 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.- 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.
-