Class ImmutableACL
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AbstractAccessControlList
-
- org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.ImmutableACL
-
- All Implemented Interfaces:
AccessControlList,AccessControlPolicy,JackrabbitAccessControlList,JackrabbitAccessControlPolicy
public class ImmutableACL extends AbstractAccessControlList
An implementation of theJackrabbitAccessControlListinterface that only allows for reading. The write methods throw anAccessControlException.
-
-
Constructor Summary
Constructors Constructor Description ImmutableACL(@NotNull AbstractAccessControlList accessControlList)Construct a newImmutableACLfrom the givenAbstractAccessControlList.ImmutableACL(@Nullable java.lang.String oakPath, @NotNull java.util.List<? extends JackrabbitAccessControlEntry> entries, @NotNull RestrictionProvider restrictionProvider, @NotNull NamePathMapper namePathMapper)Construct a newImmutableACL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEntry(@NotNull java.security.Principal principal, @NotNull Privilege[] privileges, boolean isAllow, @Nullable java.util.Map<java.lang.String,Value> restrictions)Adds an access control entry to this policy consisting of the specifiedprincipal, the specifiedprivileges, theisAllowflag and an optional map containing additional restrictions.booleanaddEntry(@NotNull java.security.Principal principal, @NotNull Privilege[] privileges, boolean isAllow, @Nullable java.util.Map<java.lang.String,Value> restrictions, @Nullable java.util.Map<java.lang.String,Value[]> mvRestrictions)Adds an access control entry to this policy consisting of the specifiedprincipal, the specifiedprivileges, theisAllowflag and an optional map containing additional restrictions.booleanequals(java.lang.Object obj)@NotNull java.util.List<JackrabbitAccessControlEntry>getEntries()@NotNull RestrictionProvidergetRestrictionProvider()inthashCode()voidorderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry)If theAccessControlListimplementation supports reordering of entries the specifiedsrcEntryis inserted at the position of the specifieddestEntry.voidremoveAccessControlEntry(AccessControlEntry ace)Removes the specifiedAccessControlEntryfrom this policy.-
Methods inherited from class org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AbstractAccessControlList
addAccessControlEntry, addEntry, getAccessControlEntries, getNamePathMapper, getOakPath, getPath, getRestrictionNames, getRestrictionType, isEmpty, isMultiValueRestriction, size
-
-
-
-
Constructor Detail
-
ImmutableACL
public ImmutableACL(@Nullable @Nullable java.lang.String oakPath, @NotNull @NotNull java.util.List<? extends JackrabbitAccessControlEntry> entries, @NotNull @NotNull RestrictionProvider restrictionProvider, @NotNull @NotNull NamePathMapper namePathMapper)Construct a newImmutableACL- Parameters:
oakPath- The Oak path of this policy ornull.entries- The access control entries contained in this policy.restrictionProvider- The restriction provider.namePathMapper- TheNamePathMapperused for conversion.
-
ImmutableACL
public ImmutableACL(@NotNull @NotNull AbstractAccessControlList accessControlList)Construct a newImmutableACLfrom the givenAbstractAccessControlList.- Parameters:
accessControlList- The base list
-
-
Method Detail
-
removeAccessControlEntry
public void removeAccessControlEntry(AccessControlEntry ace) throws AccessControlException
Description copied from interface:AccessControlListRemoves the specifiedAccessControlEntryfrom this policy.Only exactly those entries obtained through
getAccessControlEntriescan be removed. This method does not take effect until this policy has been re-set to a node by callingAccessControlManager.setPolicy(String, AccessControlPolicy)andsaveis performed.- Parameters:
ace- the access control entry to be removed.- Throws:
AccessControlException- if the specified entry is not present on the specified node.
-
addEntry
public boolean addEntry(@NotNull @NotNull java.security.Principal principal, @NotNull @NotNull Privilege[] privileges, boolean isAllow, @Nullable @Nullable java.util.Map<java.lang.String,Value> restrictions) throws AccessControlExceptionDescription copied from interface:JackrabbitAccessControlListAdds an access control entry to this policy consisting of the specifiedprincipal, the specifiedprivileges, theisAllowflag and an optional map containing additional restrictions.This method returns
trueif this policy was modified,falseotherwise.An
AccessControlExceptionis thrown if any of the specified parameters is invalid or if some other access control related exception occurs.- Specified by:
addEntryin interfaceJackrabbitAccessControlList- Overrides:
addEntryin classAbstractAccessControlList- Parameters:
principal- the principal to add the entry forprivileges- the privileges to addisAllow- iftrueif this is a positive (allow) entryrestrictions- A map of additional restrictions used to narrow the effect of the entry to be created. The map must map JCR names to a singleValueobject.- Returns:
- true if this policy has changed by incorporating the given entry; false otherwise.
- Throws:
AccessControlException- If any of the given parameter is invalid or cannot be handled by the implementation.- See Also:
AccessControlList.addAccessControlEntry(Principal, Privilege[])
-
addEntry
public boolean addEntry(@NotNull @NotNull java.security.Principal principal, @NotNull @NotNull Privilege[] privileges, boolean isAllow, @Nullable @Nullable java.util.Map<java.lang.String,Value> restrictions, @Nullable @Nullable java.util.Map<java.lang.String,Value[]> mvRestrictions) throws AccessControlExceptionDescription copied from interface:JackrabbitAccessControlListAdds an access control entry to this policy consisting of the specifiedprincipal, the specifiedprivileges, theisAllowflag and an optional map containing additional restrictions.This method returns
trueif this policy was modified,falseotherwise.An
AccessControlExceptionis thrown if any of the specified parameters is invalid or if some other access control related exception occurs.- Parameters:
principal- the principal to add the entry forprivileges- the privileges to addisAllow- iftrueif this is a positive (allow) entryrestrictions- A map of additional restrictions used to narrow the effect of the entry to be created. The map must map JCR names to a singleValueobject.mvRestrictions- A map of additional multivalued restrictions used to narrow the effect of the entry to be created. The map must map JCR names to aValuearray.- Returns:
- true if this policy has changed by incorporating the given entry; false otherwise.
- Throws:
AccessControlException- If any of the given parameter is invalid or cannot be handled by the implementation.- See Also:
AccessControlList.addAccessControlEntry(Principal, Privilege[])
-
orderBefore
public void orderBefore(@NotNull @NotNull AccessControlEntry srcEntry, @Nullable @Nullable AccessControlEntry destEntry) throws AccessControlExceptionDescription copied from interface:JackrabbitAccessControlListIf theAccessControlListimplementation supports reordering of entries the specifiedsrcEntryis inserted at the position of the specifieddestEntry.If
destEntryisnullthe entry is moved to the end of the list.If
srcEntryanddestEntryare the same no changes are made.- Parameters:
srcEntry- The access control entry to be moved within the list.destEntry- The entry before which thesrcEntrywill be moved.- Throws:
AccessControlException- If any of the given entries is invalid or cannot be handled by the implementation.
-
getEntries
@NotNull public @NotNull java.util.List<JackrabbitAccessControlEntry> getEntries()
- Specified by:
getEntriesin classAbstractAccessControlList
-
getRestrictionProvider
@NotNull public @NotNull RestrictionProvider getRestrictionProvider()
- Specified by:
getRestrictionProviderin classAbstractAccessControlList
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-