Class ACPImpl
- java.lang.Object
-
- org.nuxeo.ecm.core.api.security.impl.ACPImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ACP
public class ACPImpl extends Object implements ACP
The ACP implementation uses a cache used when calling getAccess().- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
LEGACY_BEHAVIOR_PROPERTY
ConfigurationService property to enable legacy behavior.
-
Constructor Summary
Constructors Constructor Description ACPImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAccessRule(String aclName, ACE ace)
boolean
addACE(String aclName, ACE ace)
Add an ACE to the givenaclName
.void
addACL(int pos, ACL acl)
void
addACL(String afterMe, ACL acl)
void
addACL(ACL acl)
This method must append the ACL and not insert it since it is used to append the inherited ACL which is the less significant ACL.boolean
blockInheritance(String aclName, String username)
Block the inheritance on the givenaclName
.ACPImpl
clone()
Return a recursive copy of the ACP sharing no mutable substructure with the originalAccess
getAccess(String[] principals, String[] permissions)
Checks the access on the ACLs for each set of the given permissions and principals.Access
getAccess(String principal, String permission)
Check whether this ACP grant the given permission on the given user, denies it or doesn't specify a rule.static Access
getAccess(ACE ace, String[] principals, String[] permissions)
ACL
getACL(String name)
ACL[]
getACLs()
ACL
getMergedACLs(String name)
ACL
getOrCreateACL()
ACL
getOrCreateACL(String name)
String[]
listUsernamesForAnyPermission(Set<String> perms)
Returns the usernames granted to perform an operation based on a list of permissions.static ACL
newACL(String name)
boolean
removeACE(String aclName, ACE ace)
Remove an ACE on the givenaclName
.boolean
removeACEsByUsername(String username)
Remove all ACEs forusername
on the whole ACP.boolean
removeACEsByUsername(String aclName, String username)
Remove all ACEs forusername
on the givenaclName
.ACL
removeACL(String name)
boolean
replaceACE(String aclName, ACE oldACE, ACE newACE)
Replace theoldACE
withnewACE
on the givenaclName
, only if theoldACE
exists.void
replacePermission(String oldPerm, String newPerm)
Replaces a permission with another in this ACP.void
setRules(String aclName, UserEntry[] userEntries)
Replaces the modifiable user entries (associated with the currentDocument) related to the ACP.void
setRules(String aclName, UserEntry[] userEntries, boolean overwrite)
Replaces the modifiable user entries (associated with the currentDocument) related to the ACP.void
setRules(UserEntry[] userEntries)
Replaces the modifiable user entries (associated with the currentDocument) related to the current ACP.void
setRules(UserEntry[] userEntries, boolean overwrite)
Replaces the modifiable user entries (associated with the currentDocument) related to the current ACP.boolean
unblockInheritance(String aclName)
Unblock the inheritance on the givenaclName
.protected boolean
useLegacyBehavior()
-
-
-
Field Detail
-
LEGACY_BEHAVIOR_PROPERTY
public static final String LEGACY_BEHAVIOR_PROPERTY
ConfigurationService property to enable legacy behavior.- Since:
- 10.2
- See Also:
- Constant Field Values
-
-
Method Detail
-
addACL
public void addACL(ACL acl)
This method must append the ACL and not insert it since it is used to append the inherited ACL which is the less significant ACL.
-
getMergedACLs
public ACL getMergedACLs(String name)
- Specified by:
getMergedACLs
in interfaceACP
-
getAccess
public Access getAccess(String principal, String permission)
Description copied from interface:ACP
Check whether this ACP grant the given permission on the given user, denies it or doesn't specify a rule.This is checking only the ACLs on that ACP. Parents if any are not checked.
-
getAccess
public Access getAccess(String[] principals, String[] permissions)
Description copied from interface:ACP
Checks the access on the ACLs for each set of the given permissions and principals.This differs for an iterative check using getAccess(String principal, String permission) in the order of checks - so that in this case each ACE is fully checked against the given users and permissions before passing to the next ACE.
-
getOrCreateACL
public ACL getOrCreateACL(String name)
- Specified by:
getOrCreateACL
in interfaceACP
-
getOrCreateACL
public ACL getOrCreateACL()
- Specified by:
getOrCreateACL
in interfaceACP
-
setRules
public void setRules(String aclName, UserEntry[] userEntries)
Description copied from interface:ACP
Replaces the modifiable user entries (associated with the currentDocument) related to the ACP.Considers that all the passed entries are modifiable and attempts to set them as entries related to the current document.
-
setRules
public void setRules(String aclName, UserEntry[] userEntries, boolean overwrite)
Description copied from interface:ACP
Replaces the modifiable user entries (associated with the currentDocument) related to the ACP.Considers that all the passed entries are modifiable and attempts to set them as entries related to the current document.
-
setRules
public void setRules(UserEntry[] userEntries)
Description copied from interface:ACP
Replaces the modifiable user entries (associated with the currentDocument) related to the current ACP.Considers that all the passed entries are modifiable and attempts to set them as local entries related to the current document.
-
setRules
public void setRules(UserEntry[] userEntries, boolean overwrite)
Description copied from interface:ACP
Replaces the modifiable user entries (associated with the currentDocument) related to the current ACP.Considers that all the passed entries are modifiable and attempts to set them as local entries related to the current document.
The current behavior reset completely the current ACL.
-
listUsernamesForAnyPermission
public String[] listUsernamesForAnyPermission(Set<String> perms)
Description copied from interface:ACP
Returns the usernames granted to perform an operation based on a list of permissions.- Specified by:
listUsernamesForAnyPermission
in interfaceACP
- Parameters:
perms
- the list of permissions.- Returns:
- a list of usernames
-
clone
public ACPImpl clone()
Description copied from interface:ACP
Return a recursive copy of the ACP sharing no mutable substructure with the original
-
blockInheritance
public boolean blockInheritance(String aclName, String username)
Description copied from interface:ACP
Block the inheritance on the givenaclName
.- Specified by:
blockInheritance
in interfaceACP
username
- the user blocking the inheritance- Returns:
- true if the ACP was changed.
-
unblockInheritance
public boolean unblockInheritance(String aclName)
Description copied from interface:ACP
Unblock the inheritance on the givenaclName
.- Specified by:
unblockInheritance
in interfaceACP
- Returns:
- true if the ACP was changed.
-
addACE
public boolean addACE(String aclName, ACE ace)
Description copied from interface:ACP
Add an ACE to the givenaclName
.
-
replaceACE
public boolean replaceACE(String aclName, ACE oldACE, ACE newACE)
Description copied from interface:ACP
Replace theoldACE
withnewACE
on the givenaclName
, only if theoldACE
exists.The
newACE
keeps the same index asoldACE
.- Specified by:
replaceACE
in interfaceACP
- Returns:
- true if the ACP was changed.
-
removeACE
public boolean removeACE(String aclName, ACE ace)
Description copied from interface:ACP
Remove an ACE on the givenaclName
.
-
removeACEsByUsername
public boolean removeACEsByUsername(String aclName, String username)
Description copied from interface:ACP
Remove all ACEs forusername
on the givenaclName
.- Specified by:
removeACEsByUsername
in interfaceACP
- Returns:
- true if the ACP was changed.
-
removeACEsByUsername
public boolean removeACEsByUsername(String username)
Description copied from interface:ACP
Remove all ACEs forusername
on the whole ACP.- Specified by:
removeACEsByUsername
in interfaceACP
- Returns:
- true if the ACP was changed.
-
replacePermission
public void replacePermission(String oldPerm, String newPerm)
Description copied from interface:ACP
Replaces a permission with another in this ACP.- Specified by:
replacePermission
in interfaceACP
- Parameters:
oldPerm
- the old permissionnewPerm
- the new permission
-
useLegacyBehavior
protected boolean useLegacyBehavior()
-
-