Interface PrivilegeCollection
-
- All Known Implementing Classes:
PrivilegeCollection.Default
@ProviderType public interface PrivilegeCollectionWrapper around a set of
Privileges that allows to test if a given list of privilege names in included. This avoids repeated calls toAccessControlManager.hasPrivileges(String, Privilege[])or having to manually resolve the privilege aggregation when usingAccessControlManager.getPrivileges(String). While adefaultis available for backwards compatibility, it uses regular JCR API. Therefore it is recommended to provide custom implementations ofJackrabbitAccessControlManager.getPrivilegeCollection(String)andJackrabbitAccessControlManager.getPrivilegeCollection(String, Set)with efficient implementations of thePrivilegeCollection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPrivilegeCollection.DefaultDefault implementation of thePrivilegeCollectioninterface.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Privilege[]getPrivileges()Return the underlying privilege array.booleanincludes(@NotNull String... privilegeNames)Tests whether the given JCRprivilegeNamesare contained in the privileges for which this instance ofPrivilegeEvaluationhas been created such as e.g.
-
-
-
Method Detail
-
getPrivileges
Privilege[] getPrivileges() throws RepositoryException
Return the underlying privilege array.- Returns:
- the privilege array for which this instance has been created.
- Throws:
RepositoryException- If an error occurs.
-
includes
boolean includes(@NotNull @NotNull String... privilegeNames) throws RepositoryExceptionTests whether the given JCRprivilegeNamesare contained in the privileges for which this instance ofPrivilegeEvaluationhas been created such as e.g. throughJackrabbitAccessControlManager.getPrivilegeCollection(String)orJackrabbitAccessControlManager.getPrivilegeCollection(String, Set). The inclusion can either be direct or through privilege aggregation.- Parameters:
privilegeNames- The JCR names of privileges to be tested. They can be passed in expanded form (like e.g.Privilege.JCR_READ) or in qualified form (i.e. 'jcr:read' if 'jcr' was the prefixed defined for the 'http://www.jcp.org/jcr/1.0' namespace.- Returns:
trueif the underlyingprivilegesinclude all specified privilege names either directly or by means of aggregation;falseif one or multiple privileges are not included. Ifjcr:allprivilege is part of this collection or if no privilege names are specified this method will returntrue. If no privileges are grantedfalseis returned.- Throws:
AccessControlException- If any of the given privilege names is invalid i.e. no such privilege exists.RepositoryException- If another error occurs.- Since:
- Oak 1.42.0
-
-