Interface PrivilegeCollection
- All Known Implementing Classes:
PrivilegeCollection.Default
Wrapper around a set of Privilege
s that allows to test if a given list of privilege names in included. This
avoids repeated calls to AccessControlManager.hasPrivileges(String, Privilege[])
or having to manually resolve
the privilege aggregation when using AccessControlManager.getPrivileges(String)
.
default
is available for backwards compatibility, it uses regular
JCR API. Therefore it is recommended to provide custom implementations of
JackrabbitAccessControlManager.getPrivilegeCollection(String)
and
JackrabbitAccessControlManager.getPrivilegeCollection(String, Set)
with
efficient implementations of the PrivilegeCollection
.- Since:
- Oak 1.42.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Default implementation of thePrivilegeCollection
interface. -
Method Summary
Modifier and TypeMethodDescriptionReturn the underlying privilege array.boolean
Tests whether the given JCRprivilegeNames
are contained in the privileges for which this instance ofPrivilegeEvaluation
has been created such as e.g.
-
Method Details
-
getPrivileges
Return the underlying privilege array.- Returns:
- the privilege array for which this instance has been created.
- Throws:
RepositoryException
- If an error occurs.
-
includes
Tests whether the given JCRprivilegeNames
are contained in the privileges for which this instance ofPrivilegeEvaluation
has 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:
true
if the underlyingprivileges
include all specified privilege names either directly or by means of aggregation;false
if one or multiple privileges are not included. Ifjcr:all
privilege is part of this collection or if no privilege names are specified this method will returntrue
. If no privileges are grantedfalse
is 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
-