public class ACLJCRAmetysObjectHelper extends Object implements Component, Serviceable
ModifiableACLAmetysObject
in JCR under its node.Modifier and Type | Class and Description |
---|---|
(package private) static class |
ACLJCRAmetysObjectHelper.ACLProfileExpression |
(package private) static class |
ACLJCRAmetysObjectHelper.AllowedProfileExpression |
(package private) static class |
ACLJCRAmetysObjectHelper.AnonymousAllowedProfileExpression |
(package private) static class |
ACLJCRAmetysObjectHelper.AnonymousDeniedProfileExpression |
(package private) static class |
ACLJCRAmetysObjectHelper.AnyConnectedAllowedProfileExpression |
(package private) static class |
ACLJCRAmetysObjectHelper.AnyConnectedDeniedProfileExpression |
(package private) static class |
ACLJCRAmetysObjectHelper.DeniedProfileExpression |
Modifier and Type | Field and Description |
---|---|
private static String |
__NODE_NAME_ACL_GROUPS |
private static String |
__NODE_NAME_ACL_USERS |
private static String |
__NODE_NAME_ROOT_ACL |
private static String |
__NODETYPE_ACL_GROUP |
private static String |
__NODETYPE_ACL_USER |
private static String |
__NODETYPE_ROOT_ACL |
private static String |
__NODETYPE_UNSTRUCTURED |
private static String |
__PROPERTY_NAME_ALLOWED_ANONYMOUS_PROFILES |
private static String |
__PROPERTY_NAME_ALLOWED_ANY_CONNECTED_PROFILES |
private static String |
__PROPERTY_NAME_ALLOWED_PROFILES |
private static String |
__PROPERTY_NAME_DENIED_ANONYMOUS_PROFILES |
private static String |
__PROPERTY_NAME_DENIED_ANY_CONNECTED_PROFILES |
private static String |
__PROPERTY_NAME_DENIED_PROFILES |
protected static Repository |
_repository
The repository
|
protected static AmetysObjectResolver |
_resolver
The AmetysObject resolver
|
Constructor and Description |
---|
ACLJCRAmetysObjectHelper() |
Modifier and Type | Method and Description |
---|---|
private static void |
_addProperty(Node node,
String propertyName,
String profileToAdd) |
private static void |
_checkLock(Node node) |
private static Set<String> |
_convertNodeToPath(Set<? extends Object> rootNodes) |
private static Node |
_getACLNode(Node node) |
protected static Set<String> |
_getAllowedProfiles(GroupIdentity group,
String rootPath)
Returns the allowed profiles for the group on any ACL Ametys object (and not denied on the same object)
|
protected static Set<String> |
_getAllowedProfiles(UserIdentity user,
String rootPath)
Returns the allowed profiles for the user on any ACL Ametys object (and not denied on the same object)
|
protected static Set<String> |
_getAnonymousAllowedProfiles(String rootPath)
Returns the allowed profiles for anonymous on any ACL Ametys object (and not denied on the same object)
|
protected static Set<String> |
_getAnyConnectedAllowedProfiles(String rootPath)
Returns the allowed profiles for any connected user on any ACL Ametys object (and not denied on the same object)
|
private static Node |
_getGroupsNode(Node node) |
private static Node |
_getOrCreateACLNode(Node node) |
private static Node |
_getOrCreateGroupNode(Node node,
GroupIdentity groupIdentity) |
private static Node |
_getOrCreateGroupsNode(Node node) |
private static Node |
_getOrCreateUserNode(Node node,
UserIdentity userIdentity) |
private static Node |
_getOrCreateUsersNode(Node node) |
private static Set<String> |
_getProperty(Node node,
String propertyName) |
private static Node |
_getUserNode(Node node,
UserIdentity user) |
private static Node |
_getUsersNode(Node node) |
private static NodeIterator |
_query(String jcrQuery) |
private static void |
_removeProperty(Node node,
String propertyName,
String profileToRemove) |
private static void |
_save(Node node) |
private static void |
_setProperty(Node node,
String propertyName,
Set<String> profiles) |
static void |
addAllowedGroups(Set<GroupIdentity> groups,
Node node,
String profileId)
|
static void |
addAllowedProfilesForAnonymous(Node node,
Set<String> profileIds)
|
static void |
addAllowedProfilesForAnyConnectedUser(Node node,
Set<String> profileIds)
|
static void |
addAllowedUsers(Set<UserIdentity> users,
Node node,
String profileId)
|
static void |
addDeniedGroups(Set<GroupIdentity> groups,
Node node,
String profileId)
|
static void |
addDeniedProfilesForAnonymous(Node node,
Set<String> profileIds)
|
static void |
addDeniedProfilesForAnyConnectedUser(Node node,
Set<String> profileIds)
|
static void |
addDeniedUsers(Set<UserIdentity> users,
Node node,
String profileId)
|
static NodeIterator |
getACLGroups(Expression predicat)
Returns all ACL objects for groups (ametys:acl-group nodes)
|
static NodeIterator |
getACLGroups(GroupIdentity group,
String rootPath)
Returns all ACL objects for a given group (ametys:acl-group nodes)
|
static NodeIterator |
getACLGroups(GroupIdentity group,
String rootPath,
Expression predicat)
Returns all ACL objects for a given group (ametys:acl-group nodes)
|
static NodeIterator |
getACLRoots(String rootPath)
Returns all ACL root objects (ametys:acl nodes)
|
static NodeIterator |
getACLRoots(String rootPath,
Expression predicat)
Returns all ACL root objects (ametys:acl nodes)
|
static NodeIterator |
getACLUsers()
Returns all ACL objects for users (ametys:acl-user nodes)
|
static NodeIterator |
getACLUsers(Expression predicat)
Returns all ACL objects for users (ametys:acl-user nodes)
|
static NodeIterator |
getACLUsers(UserIdentity user,
String rootPath)
Returns all ACL objects for a given user (ametys:acl-user nodes)
|
static NodeIterator |
getACLUsers(UserIdentity user,
String rootPath,
Expression predicat)
Returns all ACL objects for a given user (ametys:acl-user nodes)
|
static Set<GroupIdentity> |
getAllowedGroups(Node node,
String profileId)
Helper for
ACLAmetysObject.getAllowedGroups(String) |
static Set<String> |
getAllowedProfilesForAnonymous(Node node)
|
static Set<String> |
getAllowedProfilesForAnyConnectedUser(Node node)
|
static Map<GroupIdentity,Set<String>> |
getAllowedProfilesForGroups(Node node)
|
static Set<String> |
getAllowedProfilesForUser(Node node,
UserIdentity user)
|
static Map<UserIdentity,Set<String>> |
getAllowedProfilesForUsers(Node node)
Helper for
ACLAmetysObject.getAllowedProfilesForUsers() |
static Set<UserIdentity> |
getAllowedUsers(Node node,
String profileId)
Helper for
ACLAmetysObject.getAllowedUsers(String) |
static Set<GroupIdentity> |
getDeniedGroups(Node node,
String profileId)
Helper for
ACLAmetysObject.getDeniedGroups(String) |
static Set<String> |
getDeniedProfilesForAnonymous(Node node)
|
static Set<String> |
getDeniedProfilesForAnyConnectedUser(Node node)
|
static Map<GroupIdentity,Set<String>> |
getDeniedProfilesForGroups(Node node)
Helper for
ACLAmetysObject.getDeniedProfilesForGroups() |
static Set<String> |
getDeniedProfilesForUser(Node node,
UserIdentity user)
|
static Map<UserIdentity,Set<String>> |
getDeniedProfilesForUsers(Node node)
Helper for
ACLAmetysObject.getDeniedProfilesForUsers() |
static Set<UserIdentity> |
getDeniedUsers(Node node,
String profileId)
Helper for
ACLAmetysObject.getDeniedUsers(String) |
static boolean |
hasAnonymousAllowedProfile(Set<? extends Object> rootNodes,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as allowed for anonymous
|
static boolean |
hasAnonymousDeniedProfile(Set<? extends Object> rootNodes,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as denied for anonymous
|
static boolean |
hasAnyConnectedAllowedProfile(Set<? extends Object> rootNodes,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as allowed for any connected user
|
static boolean |
hasAnyConnectedDeniedProfile(Set<? extends Object> rootNodes,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as denied for any connected user
|
static boolean |
hasGroupAllowedProfile(Set<? extends Object> rootNodes,
GroupIdentity group,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as allowed for the group
|
static boolean |
hasGroupDeniedProfile(Set<? extends Object> rootNodes,
GroupIdentity group,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as denied for the group
|
static boolean |
hasUserAllowedProfile(Set<? extends Object> rootNodes,
UserIdentity user,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as allowed for the user
|
static boolean |
hasUserDeniedProfile(Set<? extends Object> rootNodes,
UserIdentity user,
Set<String> profileIds)
Returns true if any ACL Ametys object has one of the given profiles as denied for the user
|
static void |
removeAllowedGroups(Set<GroupIdentity> groups,
Node node)
|
static void |
removeAllowedGroups(Set<GroupIdentity> groups,
Node node,
String profileId)
|
static void |
removeAllowedProfilesForAnonymous(Node node,
Set<String> profileIds)
|
static void |
removeAllowedProfilesForAnyConnectedUser(Node node,
Set<String> profileIds)
|
static void |
removeAllowedUsers(Set<UserIdentity> users,
Node node)
|
static void |
removeAllowedUsers(Set<UserIdentity> users,
Node node,
String profileId)
|
static void |
removeDeniedGroups(Set<GroupIdentity> groups,
Node node)
|
static void |
removeDeniedGroups(Set<GroupIdentity> groups,
Node node,
String profileId)
|
static void |
removeDeniedProfilesForAnonymous(Node node,
Set<String> profileIds)
|
static void |
removeDeniedProfilesForAnyConnectedUser(Node node,
Set<String> profileIds)
|
static void |
removeDeniedUsers(Set<UserIdentity> users,
Node node)
|
static void |
removeDeniedUsers(Set<UserIdentity> users,
Node node,
String profileId)
|
static void |
removeGroup(GroupIdentity group)
|
static void |
removeProfile(String profileId)
|
static void |
removeUser(UserIdentity user)
|
void |
service(ServiceManager manager) |
protected static AmetysObjectResolver _resolver
protected static Repository _repository
private static final String __NODE_NAME_ROOT_ACL
private static final String __NODETYPE_ROOT_ACL
private static final String __NODE_NAME_ACL_USERS
private static final String __NODE_NAME_ACL_GROUPS
private static final String __NODETYPE_ACL_USER
private static final String __NODETYPE_ACL_GROUP
private static final String __NODETYPE_UNSTRUCTURED
private static final String __PROPERTY_NAME_ALLOWED_ANY_CONNECTED_PROFILES
private static final String __PROPERTY_NAME_DENIED_ANY_CONNECTED_PROFILES
private static final String __PROPERTY_NAME_ALLOWED_ANONYMOUS_PROFILES
private static final String __PROPERTY_NAME_DENIED_ANONYMOUS_PROFILES
private static final String __PROPERTY_NAME_ALLOWED_PROFILES
private static final String __PROPERTY_NAME_DENIED_PROFILES
public ACLJCRAmetysObjectHelper()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
private static Set<String> _convertNodeToPath(Set<? extends Object> rootNodes)
public static boolean hasUserDeniedProfile(Set<? extends Object> rootNodes, UserIdentity user, Set<String> profileIds)
user
- The userprofileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasUserAllowedProfile(Set<? extends Object> rootNodes, UserIdentity user, Set<String> profileIds)
user
- The userprofileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasGroupDeniedProfile(Set<? extends Object> rootNodes, GroupIdentity group, Set<String> profileIds)
group
- The groupprofileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasGroupAllowedProfile(Set<? extends Object> rootNodes, GroupIdentity group, Set<String> profileIds)
group
- The groupprofileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasAnyConnectedDeniedProfile(Set<? extends Object> rootNodes, Set<String> profileIds)
profileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasAnyConnectedAllowedProfile(Set<? extends Object> rootNodes, Set<String> profileIds)
profileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasAnonymousDeniedProfile(Set<? extends Object> rootNodes, Set<String> profileIds)
profileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static boolean hasAnonymousAllowedProfile(Set<? extends Object> rootNodes, Set<String> profileIds)
profileIds
- The ids of the profilesrootNodes
- The JCR root nodes where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.public static NodeIterator getACLRoots(String rootPath)
rootPath
- The root path to restrict the search. Can be null.public static NodeIterator getACLRoots(String rootPath, Expression predicat)
rootPath
- The root path to restrict the search. Can be null.predicat
- The predicat expression. Can be null.public static NodeIterator getACLUsers(UserIdentity user, String rootPath)
user
- The userrootPath
- The root path to restrict the search. Can be null.public static NodeIterator getACLUsers(UserIdentity user, String rootPath, Expression predicat)
user
- The userrootPath
- The root path to restrict the search. Can be null.predicat
- The predicat expression. Can be null.public static NodeIterator getACLUsers()
public static NodeIterator getACLUsers(Expression predicat)
predicat
- The predicat expression. Can be null.public static NodeIterator getACLGroups(Expression predicat)
predicat
- The predicat expression. Can be null.public static NodeIterator getACLGroups(GroupIdentity group, String rootPath)
group
- The grouprootPath
- The root path to restrict the search. Can be null.public static NodeIterator getACLGroups(GroupIdentity group, String rootPath, Expression predicat)
group
- The grouprootPath
- The root path to restrict the search. Can be null.predicat
- The predicat expression. Can be null.protected static Set<String> _getAllowedProfiles(UserIdentity user, String rootPath)
user
- The userrootPath
- The JCR root path where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.protected static Set<String> _getAllowedProfiles(GroupIdentity group, String rootPath)
group
- The grouprootPath
- The JCR root path where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.protected static Set<String> _getAnyConnectedAllowedProfiles(String rootPath)
rootPath
- The JCR root path where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.protected static Set<String> _getAnonymousAllowedProfiles(String rootPath)
rootPath
- The JCR root path where starts the query search (must be something like "//element(myNode, ametys:collection)"), it will be the beginning of the JCR query. Can be null to not restrict the search.private static NodeIterator _query(String jcrQuery)
public static Set<String> getAllowedProfilesForAnyConnectedUser(Node node)
node
- The JCR node for the Ametys objectpublic static void addAllowedProfilesForAnyConnectedUser(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to addpublic static void removeAllowedProfilesForAnyConnectedUser(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to removepublic static Set<String> getDeniedProfilesForAnyConnectedUser(Node node)
node
- The JCR node for the Ametys objectpublic static void addDeniedProfilesForAnyConnectedUser(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to addpublic static void removeDeniedProfilesForAnyConnectedUser(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to removepublic static Set<String> getAllowedProfilesForAnonymous(Node node)
node
- The JCR node for the Ametys objectpublic static void addAllowedProfilesForAnonymous(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to addpublic static void removeAllowedProfilesForAnonymous(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to removepublic static Set<String> getDeniedProfilesForAnonymous(Node node)
node
- The JCR node for the Ametys objectpublic static void addDeniedProfilesForAnonymous(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to addpublic static void removeDeniedProfilesForAnonymous(Node node, Set<String> profileIds)
node
- The JCR node for the Ametys objectprofileIds
- The profiles to removepublic static Set<String> getAllowedProfilesForUser(Node node, UserIdentity user)
node
- The JCR node for the Ametys objectuser
- The userpublic static Map<UserIdentity,Set<String>> getAllowedProfilesForUsers(Node node)
ACLAmetysObject.getAllowedProfilesForUsers()
node
- The JCR node for the Ametys objectpublic static Set<UserIdentity> getAllowedUsers(Node node, String profileId)
ACLAmetysObject.getAllowedUsers(String)
node
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void addAllowedUsers(Set<UserIdentity> users, Node node, String profileId)
users
- The users to addnode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeAllowedUsers(Set<UserIdentity> users, Node node, String profileId)
users
- The users to removenode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeAllowedUsers(Set<UserIdentity> users, Node node)
users
- The users to removenode
- The JCR node for the Ametys objectpublic static Map<GroupIdentity,Set<String>> getAllowedProfilesForGroups(Node node)
node
- The JCR node for the Ametys objectpublic static Set<GroupIdentity> getAllowedGroups(Node node, String profileId)
ACLAmetysObject.getAllowedGroups(String)
node
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void addAllowedGroups(Set<GroupIdentity> groups, Node node, String profileId)
groups
- The groups to addnode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeAllowedGroups(Set<GroupIdentity> groups, Node node, String profileId)
groups
- The groups to removenode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeAllowedGroups(Set<GroupIdentity> groups, Node node)
groups
- The groups to removenode
- The JCR node for the Ametys objectpublic static Set<String> getDeniedProfilesForUser(Node node, UserIdentity user)
node
- The JCR node for the Ametys objectuser
- The userpublic static Map<UserIdentity,Set<String>> getDeniedProfilesForUsers(Node node)
ACLAmetysObject.getDeniedProfilesForUsers()
node
- The JCR node for the Ametys objectpublic static Set<UserIdentity> getDeniedUsers(Node node, String profileId)
ACLAmetysObject.getDeniedUsers(String)
node
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void addDeniedUsers(Set<UserIdentity> users, Node node, String profileId)
users
- The users to addnode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeDeniedUsers(Set<UserIdentity> users, Node node, String profileId)
users
- The users to removenode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeDeniedUsers(Set<UserIdentity> users, Node node)
users
- The users to removenode
- The JCR node for the Ametys objectpublic static Map<GroupIdentity,Set<String>> getDeniedProfilesForGroups(Node node)
ACLAmetysObject.getDeniedProfilesForGroups()
node
- The JCR node for the Ametys objectpublic static Set<GroupIdentity> getDeniedGroups(Node node, String profileId)
ACLAmetysObject.getDeniedGroups(String)
node
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void addDeniedGroups(Set<GroupIdentity> groups, Node node, String profileId)
groups
- The groups to addnode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeDeniedGroups(Set<GroupIdentity> groups, Node node, String profileId)
groups
- The groups to removenode
- The JCR node for the Ametys objectprofileId
- The id of the profilepublic static void removeDeniedGroups(Set<GroupIdentity> groups, Node node)
groups
- The groups to removenode
- The JCR node for the Ametys objectpublic static void removeProfile(String profileId)
profileId
- The id of the profilepublic static void removeUser(UserIdentity user)
user
- The userpublic static void removeGroup(GroupIdentity group)
group
- The groupprivate static void _checkLock(Node node) throws AmetysRepositoryException
AmetysRepositoryException
private static Node _getOrCreateACLNode(Node node)
private static Node _getACLNode(Node node)
private static Node _getOrCreateUsersNode(Node node)
private static Node _getUserNode(Node node, UserIdentity user)
private static Node _getUsersNode(Node node)
private static Node _getOrCreateGroupsNode(Node node)
private static Node _getGroupsNode(Node node)
private static Node _getOrCreateUserNode(Node node, UserIdentity userIdentity)
private static Node _getOrCreateGroupNode(Node node, GroupIdentity groupIdentity)
private static Set<String> _getProperty(Node node, String propertyName)
private static void _setProperty(Node node, String propertyName, Set<String> profiles)
private static void _addProperty(Node node, String propertyName, String profileToAdd)
private static void _removeProperty(Node node, String propertyName, String profileToRemove)