public final class PrivilegeManagerImpl extends Object implements PrivilegeManager
PrivilegeManager
...Constructor and Description |
---|
PrivilegeManagerImpl(PrivilegeRegistry registry,
NameResolver nameResolver) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this privilege manager
|
PrivilegeBits |
getBits(Name... privilegeNames) |
PrivilegeBits |
getBits(Privilege... privileges) |
Privilege |
getPrivilege(String privilegeName)
Returns the privilege with the specified
privilegeName . |
Set<Privilege> |
getPrivileges(PrivilegeBits bits)
Returns an array of registered
Privilege s. |
Privilege[] |
getRegisteredPrivileges()
Returns all registered privileges.
|
void |
privilegesRegistered(Set<Name> privilegeNames) |
Privilege |
registerPrivilege(String privilegeName,
boolean isAbstract,
String[] declaredAggregateNames)
Register a new custom privilege with the specified characteristics.
|
public PrivilegeManagerImpl(PrivilegeRegistry registry, NameResolver nameResolver)
public void dispose()
public Privilege[] getRegisteredPrivileges() throws RepositoryException
PrivilegeManager
getRegisteredPrivileges
in interface PrivilegeManager
RepositoryException
- If an error occurs.PrivilegeManager.getRegisteredPrivileges()
public Privilege getPrivilege(String privilegeName) throws AccessControlException, RepositoryException
PrivilegeManager
privilegeName
.getPrivilege
in interface PrivilegeManager
privilegeName
- Name of the principal.privilegeName
.AccessControlException
- If no privilege with the given name exists.RepositoryException
- If another error occurs.PrivilegeManager.getPrivilege(String)
public Privilege registerPrivilege(String privilegeName, boolean isAbstract, String[] declaredAggregateNames) throws AccessDeniedException, RepositoryException
The current implementation has the following limitations and constraints:
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 the Permission
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.
registerPrivilege
in interface PrivilegeManager
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.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.PrivilegeManager.registerPrivilege(String, boolean, String[])
public PrivilegeBits getBits(Privilege... privileges) throws AccessControlException
privileges
- An array of privileges.AccessControlException
- If the specified array is null, empty
or if it contains an unregistered privilege.public PrivilegeBits getBits(Name... privilegeNames) throws RepositoryException
privilegeNames
- An array of privilege names.AccessControlException
- If the specified array is null or if it
contains the name of an unregistered privilege.RepositoryException
public Set<Privilege> getPrivileges(PrivilegeBits bits)
Privilege
s. If the specified
bits
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 given
bits
. If bits
does not match to any registered
privilege an empty array will be returned.bits
- Privilege bits as obtained from getBits(Privilege...)
.Privilege
s that are presented by the given
bits
or an empty array if bits
cannot be
resolved to registered Privilege
s.getBits(Privilege...)
Copyright © 2004–2022 The Apache Software Foundation. All rights reserved.