Class PrivilegeManagerImpl
- java.lang.Object
-
- org.apache.jackrabbit.core.security.authorization.PrivilegeManagerImpl
-
- All Implemented Interfaces:
PrivilegeManager
public final class PrivilegeManagerImpl extends Object implements PrivilegeManager
PrivilegeManager
...
-
-
Constructor Summary
Constructors Constructor Description PrivilegeManagerImpl(PrivilegeRegistry registry, NameResolver nameResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes this privilege managerPrivilegeBits
getBits(Privilege... privileges)
PrivilegeBits
getBits(Name... privilegeNames)
Privilege
getPrivilege(String privilegeName)
Set<Privilege>
getPrivileges(PrivilegeBits bits)
Returns an array of registeredPrivilege
s.Privilege[]
getRegisteredPrivileges()
void
privilegesRegistered(Set<Name> privilegeNames)
Privilege
registerPrivilege(String privilegeName, boolean isAbstract, String[] declaredAggregateNames)
Register a new custom privilege with the specified characteristics.
-
-
-
Constructor Detail
-
PrivilegeManagerImpl
public PrivilegeManagerImpl(PrivilegeRegistry registry, NameResolver nameResolver)
-
-
Method Detail
-
dispose
public void dispose()
Disposes this privilege manager
-
getRegisteredPrivileges
public Privilege[] getRegisteredPrivileges() throws RepositoryException
- Specified by:
getRegisteredPrivileges
in interfacePrivilegeManager
- Throws:
RepositoryException
- See Also:
PrivilegeManager.getRegisteredPrivileges()
-
getPrivilege
public Privilege getPrivilege(String privilegeName) throws AccessControlException, RepositoryException
- Specified by:
getPrivilege
in interfacePrivilegeManager
- Throws:
AccessControlException
RepositoryException
- See Also:
PrivilegeManager.getPrivilege(String)
-
registerPrivilege
public Privilege registerPrivilege(String privilegeName, boolean isAbstract, String[] declaredAggregateNames) throws AccessDeniedException, RepositoryException
Register a new custom privilege with the specified characteristics.The current implementation has the following limitations and constraints:
- the name may not be in use by another privilege
- the namespace URI must be a valid, registered namespace excluding those namespaces marked as being reserved
- an aggregate custom privilege is valid if all declared aggregate names can be resolved to registered privileges and if there exists no registered privilege with the same aggregated privileges.
Please note
Custom privilege(s) will not be enforced for any kind of repository operations. Those are exclusively covered by the built-in privileges. This also implies that thePermission
s are not affected by custom privileges.Applications making use of the custom privilege(s) are in charge of asserting whether the privileges are granted/denied according to their application specific needs.
- Specified by:
registerPrivilege
in interfacePrivilegeManager
- Parameters:
privilegeName
- The name of the new custom privilege.isAbstract
- Boolean flag indicating if the privilege is abstract.declaredAggregateNames
- An array of privilege names referring to registered privileges being aggregated by this new custom privilege. In case of a non aggregate privilege an empty array should be passed.- Returns:
- the new privilege.
- Throws:
AccessDeniedException
- If the session this manager has been created lacks rep:privilegeManagement privilege.RepositoryException
- If the privilege could not be registered due to constraint violations or if persisting the custom privilege fails.- See Also:
PrivilegeManager.registerPrivilege(String, boolean, String[])
-
getBits
public PrivilegeBits getBits(Privilege... privileges) throws AccessControlException
- Parameters:
privileges
- An array of privileges.- Returns:
- The bits of the privileges contained in the specified array.
- Throws:
AccessControlException
- If the specified array is null, empty or if it contains an unregistered privilege.
-
getBits
public PrivilegeBits getBits(Name... privilegeNames) throws RepositoryException
- Parameters:
privilegeNames
- An array of privilege names.- Returns:
- The bits of the privileges contained in the specified array.
- Throws:
AccessControlException
- If the specified array is null or if it contains the name of an unregistered privilege.RepositoryException
-
getPrivileges
public Set<Privilege> getPrivileges(PrivilegeBits bits)
Returns an array of registeredPrivilege
s. If the specifiedbits
represent a single registered privilege the returned array contains a single element. Otherwise the returned array contains the individual registered privileges that are combined in the givenbits
. Ifbits
does not match to any registered privilege an empty array will be returned.- Parameters:
bits
- Privilege bits as obtained fromgetBits(Privilege...)
.- Returns:
- Array of
Privilege
s that are presented by the givenbits
or an empty array ifbits
cannot be resolved to registeredPrivilege
s. - See Also:
getBits(Privilege...)
-
-