Class AbstractRestrictionProvider
java.lang.Object
org.apache.jackrabbit.oak.spi.security.authorization.restriction.AbstractRestrictionProvider
- All Implemented Interfaces:
AccessControlConstants,AggregationAware,RestrictionProvider
public abstract class AbstractRestrictionProvider
extends Object
implements RestrictionProvider, AggregationAware, AccessControlConstants
-
Field Summary
Fields inherited from interface org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AccessControlConstants
AC_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.restriction.RestrictionProvider
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRestrictionProvider(@NotNull Map<String, ? extends RestrictionDefinition> definitions) -
Method Summary
Modifier and TypeMethodDescription@NotNull RestrictioncreateRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value value) Creates a new single valued restriction for the specified parameters.@NotNull RestrictioncreateRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value... values) Creates a new multi valued restriction for the specified parameters.protected @NotNull org.apache.jackrabbit.oak.api.TreegetRestrictionsTree(@NotNull org.apache.jackrabbit.oak.api.Tree aceTree) Returns the tree that contains the restriction of the specified ACE tree.@NotNull Set<RestrictionDefinition>getSupportedRestrictions(@Nullable String oakPath) Returns the restriction definitions supported by this provider implementation at the specified path.protected booleanisUnsupportedPath(@Nullable String oakPath) Returnstrueif the specified path isnull.@NotNull Set<Restriction>readRestrictions(@Nullable String oakPath, @NotNull org.apache.jackrabbit.oak.api.Tree aceTree) Read the valid restrictions stored in the specified ACE tree.voidsetComposite(@NotNull CompositeRestrictionProvider composite) voidvalidateRestrictions(@Nullable String oakPath, @NotNull org.apache.jackrabbit.oak.api.Tree aceTree) Validate the restrictions present with the specified ACE tree.voidwriteRestrictions(@Nullable String oakPath, @NotNull org.apache.jackrabbit.oak.api.Tree aceTree, @NotNull Set<Restriction> restrictions) Writes the given restrictions to the specified ACE tree.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider
getPattern, getPattern
-
Constructor Details
-
AbstractRestrictionProvider
public AbstractRestrictionProvider(@NotNull @NotNull Map<String, ? extends RestrictionDefinition> definitions)
-
-
Method Details
-
setComposite
- Specified by:
setCompositein interfaceAggregationAware
-
getSupportedRestrictions
@NotNull public @NotNull Set<RestrictionDefinition> getSupportedRestrictions(@Nullable @Nullable String oakPath) Description copied from interface:RestrictionProviderReturns the restriction definitions supported by this provider implementation at the specified path.- Specified by:
getSupportedRestrictionsin interfaceRestrictionProvider- Parameters:
oakPath- The path of the access controlled tree. Anullpath indicates that the supported restrictions for repository level policies should be returned.- Returns:
- The set of supported restrictions at the given path.
-
createRestriction
@NotNull public @NotNull Restriction createRestriction(@Nullable @Nullable String oakPath, @NotNull @NotNull String oakName, @NotNull @NotNull Value value) throws RepositoryException Description copied from interface:RestrictionProviderCreates a new single valued restriction for the specified parameters.- Specified by:
createRestrictionin interfaceRestrictionProvider- Parameters:
oakPath- The path of the access controlled tree ornullif the target policies applies to the repository level.oakName- The name of the restriction.value- The value of the restriction.- Returns:
- A new restriction instance.
- Throws:
AccessControlException- If no matching restriction definition exists for the specified parameters.RepositoryException- If another error occurs.
-
createRestriction
@NotNull public @NotNull Restriction createRestriction(@Nullable @Nullable String oakPath, @NotNull @NotNull String oakName, @NotNull @NotNull Value... values) throws RepositoryException Description copied from interface:RestrictionProviderCreates a new multi valued restriction for the specified parameters.- Specified by:
createRestrictionin interfaceRestrictionProvider- Parameters:
oakPath- The path of the access controlled tree ornullif the target policies applies to the repository level.oakName- The name of the restriction.values- The values of the restriction.- Returns:
- A new restriction instance.
- Throws:
AccessControlException- If no matching restriction definition exists for the specified parameters.RepositoryException- If another error occurs.
-
readRestrictions
@NotNull public @NotNull Set<Restriction> readRestrictions(@Nullable @Nullable String oakPath, @NotNull @NotNull org.apache.jackrabbit.oak.api.Tree aceTree) Description copied from interface:RestrictionProviderRead the valid restrictions stored in the specified ACE tree.- Specified by:
readRestrictionsin interfaceRestrictionProvider- Parameters:
oakPath- The path of the access controlled tree ornullif the target policies applies to the repository level.aceTree- The tree corresponding to an ACE that may contain restrictions.- Returns:
- The valid restrictions stored with the specified tree or an empty set.
-
writeRestrictions
public void writeRestrictions(@Nullable @Nullable String oakPath, @NotNull @NotNull org.apache.jackrabbit.oak.api.Tree aceTree, @NotNull @NotNull Set<Restriction> restrictions) throws RepositoryException Description copied from interface:RestrictionProviderWrites the given restrictions to the specified ACE tree. Note, that this method does not need to validate the specified restrictions (see alsoRestrictionProvider.validateRestrictions(String, org.apache.jackrabbit.oak.api.Tree)).- Specified by:
writeRestrictionsin interfaceRestrictionProvider- Parameters:
oakPath- The path of the access controlled tree ornullif the target policies applies to the repository level.aceTree- The tree corresponding to an ACE that will have the specified restrictions added.restrictions- The set of restrictions to be written to the specified tree.- Throws:
RepositoryException- If an error occurs while writing the restrictions.
-
validateRestrictions
public void validateRestrictions(@Nullable @Nullable String oakPath, @NotNull @NotNull org.apache.jackrabbit.oak.api.Tree aceTree) throws AccessControlException Description copied from interface:RestrictionProviderValidate the restrictions present with the specified ACE tree.- Specified by:
validateRestrictionsin interfaceRestrictionProvider- Parameters:
oakPath- The path of the access controlled tree ornullif the target policies applies to the repository level.aceTree- The tree corresponding to an ACE.- Throws:
AccessControlException- If any invalid restrictions are detected.
-
isUnsupportedPath
Returnstrueif the specified path isnull. Subclasses may change the default behavior.- Parameters:
oakPath- The path for which a restriction is being created.- Returns:
trueif this implementation can create restrictions for the specifiedoakPath;falseotherwise.
-
getRestrictionsTree
@NotNull protected @NotNull org.apache.jackrabbit.oak.api.Tree getRestrictionsTree(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree aceTree) Returns the tree that contains the restriction of the specified ACE tree.- Parameters:
aceTree- The ACE tree for which the restrictions are being read.- Returns:
- The tree storing the restriction information.
-