Package org.ametys.core.right
Class ProfileAssignmentStorageExtensionPoint
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint<T>
org.ametys.runtime.plugin.component.AbstractThreadSafeComponentPrioritizableExtensionPoint<ProfileAssignmentStorage>
org.ametys.core.right.ProfileAssignmentStorageExtensionPoint
- All Implemented Interfaces:
LogEnabled
,ExtensionPoint<ProfileAssignmentStorage>
,Disposable
,Initializable
,Component
,Contextualizable
,Serviceable
,ThreadSafe
public class ProfileAssignmentStorageExtensionPoint
extends AbstractThreadSafeComponentPrioritizableExtensionPoint<ProfileAssignmentStorage>
ExtensionPoint
handling ProfileAssignmentStorage
s.-
Field Summary
Fields inherited from class org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint
_cocoonManager, _context, _manager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
allowProfileToAnonymous
(String profileId, Object context) Adds allowed profile an anonymous user has on the given objectvoid
allowProfileToAnyConnectedUser
(String profileId, Object context) Adds allowed profile any connected user has on the given objectvoid
allowProfileToGroup
(GroupIdentity group, String profileId, Object context) Allows a group to a profile on a given objectvoid
allowProfileToUser
(UserIdentity user, String profileId, Object context) Allows a user to a profile on a given objectvoid
denyProfileToAnonymous
(String profileId, Object context) Adds denied profile an anonymous user has on the given objectvoid
denyProfileToAnyConnectedUser
(String profileId, Object context) Adds denied profile any connected user has on the given objectvoid
denyProfileToGroup
(GroupIdentity group, String profileId, Object context) Denies a group to a profile on a given objectvoid
denyProfileToUser
(UserIdentity user, String profileId, Object context) Denies a user to a profile on a given objectvoid
disallowInheritance
(Object context, boolean disallow) Allow or disallow the inheritance of permissions on a given contextgetPermissionForAnonymous
(Set<String> profileIds, Object object) Gets the permissions for Anonymous for the given profilesgetPermissionForAnyConnectedUser
(Set<String> profileIds, Object object) Gets the permissions for Anonymous for the given profilesgetPermissions
(UserIdentity user, Set<GroupIdentity> userGroups, Set<String> profileIds, Object object) Gets the permissions a user has, given some groups and profiles, on an object.getPermissionsByGroup
(Set<String> profileIds, Object object) Gets the permission by group only on an object, according to the given profiles.getPermissionsByProfile
(UserIdentity user, Set<GroupIdentity> userGroups, Object object) Gets the permissions a user has on an object, for every profile in the application.getPermissionsByUser
(Set<String> profileIds, Object object) Gets the permission by user only on an object, according to the given profiles.Gets the allowed profiles any connected user has on the given objectgetProfilesForGroups
(Object context, Set<GroupIdentity> groups) Gets the groups that have allowed profiles assigned on the given objectgetProfilesForUsers
(Object context, UserIdentity user) Gets the users that have allowed profiles assigned on the given objecthasAnonymousAnyPermission
(Set<? extends Object> rootContexts, Set<String> profileIds) Returns some profiles that are matching if anybody has a permission on at least one object, given some profileshasAnyConnectedUserAnyPermission
(Set<? extends Object> rootContexts, Set<String> profileIds) Returns some profiles that are matching if any connected user has a permission on at least one object, given some profileshasUserAnyPermission
(Set<? extends Object> rootContexts, UserIdentity user, Set<GroupIdentity> userGroups, Set<String> profileIds) Returns some profiles that are matching if the user has a permission on at least one object, given some groups and profilesboolean
isInheritanceDisallowed
(Object context) Determines if the inheritance of permissions is disallowed on a given contextvoid
removeAllowedProfileFromAnonymous
(String profileId, Object context) Removes allowed profile an anonymous user has on the given objectvoid
removeAllowedProfileFromAnyConnectedUser
(String profileId, Object context) Removes allowed profile any connected user has on the given objectvoid
removeAllowedProfileFromGroup
(GroupIdentity group, String profileId, Object context) Removes the association between a group and an allowed profile on a given objectvoid
removeAllowedProfileFromUser
(UserIdentity user, String profileId, Object context) Removes the association between a user and an allowed profile on a given objectvoid
removeDeniedProfileFromAnonymous
(String profileId, Object context) Removes denied profile an anonymous user has on the given objectvoid
removeDeniedProfileFromAnyConnectedUser
(String profileId, Object context) Removes denied profile any connected user has on the given objectvoid
removeDeniedProfileFromGroup
(GroupIdentity group, String profileId, Object context) Removes the association between a group and a denied profile on a given objectvoid
removeDeniedProfileFromUser
(UserIdentity user, String profileId, Object context) Removes the association between a user and a denied profile on a given objectMethods inherited from class org.ametys.runtime.plugin.component.AbstractThreadSafeComponentPrioritizableExtensionPoint
getComparator, getExtensionsIds, initializeExtensions, sortPriorityAscending
Methods inherited from class org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint
addComponent, addExtension, contextualize, dispose, getExtension, hasExtension, initialize, service
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role
-
-
Constructor Details
-
ProfileAssignmentStorageExtensionPoint
-
-
Method Details
-
getPermissions
public Map<String,AccessController.AccessResult> getPermissions(UserIdentity user, Set<GroupIdentity> userGroups, Set<String> profileIds, Object object) Gets the permissions a user has, given some groups and profiles, on an object.- Parameters:
user
- The useruserGroups
- The groupsprofileIds
- The ids of the profilesobject
- The object- Returns:
- the permissions a user has, given some groups and profiles on an object.
-
hasUserAnyPermission
public Set<String> hasUserAnyPermission(Set<? extends Object> rootContexts, UserIdentity user, Set<GroupIdentity> userGroups, Set<String> profileIds) Returns some profiles that are matching if the user has a permission on at least one object, given some groups and profiles- Parameters:
rootContexts
- The root contexts object where to seekuser
- The useruserGroups
- The groupsprofileIds
- The ids of the profiles- Returns:
- If the Set is empty, it means any connected user has no matching profile.
If the Set is non empty, it contains at least one of the given profile BUT it may not contains all the matching profiles for anyconnected user AND it can contains some other profiles that were not in the given profiles
-
hasAnonymousAnyPermission
public Set<String> hasAnonymousAnyPermission(Set<? extends Object> rootContexts, Set<String> profileIds) Returns some profiles that are matching if anybody has a permission on at least one object, given some profiles- Parameters:
rootContexts
- The root contexts object where to seekprofileIds
- The ids of the profiles- Returns:
- If the Set is empty, it means anonymous has no matching profile.
If the Set is non empty, it contains at least one of the given profile BUT it may not contains all the matching profiles for anonymous AND it can contains some other profiles that were not in the given profiles
-
hasAnyConnectedUserAnyPermission
public Set<String> hasAnyConnectedUserAnyPermission(Set<? extends Object> rootContexts, Set<String> profileIds) Returns some profiles that are matching if any connected user has a permission on at least one object, given some profiles- Parameters:
rootContexts
- The root contexts object where to seekprofileIds
- The ids of the profiles- Returns:
- If the Set is empty, it means the user has no matching profile.
If the Set is non empty, it contains at least one of the given profile BUT it may not contains all the matching profiles for the user AND it can contains some other profiles that were not in the given profiles
-
getPermissionsByProfile
public Map<String,AccessController.AccessResult> getPermissionsByProfile(UserIdentity user, Set<GroupIdentity> userGroups, Object object) Gets the permissions a user has on an object, for every profile in the application.- Parameters:
user
- The useruserGroups
- The groupsobject
- The object- Returns:
- the permissions a user has on an object, for every profile in the application.
-
getPermissionForAnonymous
public AccessController.AccessResult getPermissionForAnonymous(Set<String> profileIds, Object object) Gets the permissions for Anonymous for the given profiles- Parameters:
profileIds
- The profiles to get permissions onobject
- The object- Returns:
- the access result for each profile
-
getPermissionForAnyConnectedUser
public AccessController.AccessResult getPermissionForAnyConnectedUser(Set<String> profileIds, Object object) Gets the permissions for Anonymous for the given profiles- Parameters:
profileIds
- The profiles to get permissions onobject
- The object- Returns:
- the access result for each profile
-
getPermissionsByUser
public Map<UserIdentity,AccessController.AccessResult> getPermissionsByUser(Set<String> profileIds, Object object) Gets the permission by user only on an object, according to the given profiles. It does not take account of the groups of the user, etc.- Parameters:
profileIds
- The ids of the profilesobject
- The object- Returns:
- the permission by user only on an object, according to the given profiles
-
getPermissionsByGroup
public Map<GroupIdentity,AccessController.AccessResult> getPermissionsByGroup(Set<String> profileIds, Object object) Gets the permission by group only on an object, according to the given profiles.- Parameters:
profileIds
- The ids of the profilesobject
- The object- Returns:
- the permission by group only on an object, according to the given profiles
-
getProfilesForAnonymousAndAnyConnectedUser
public Map<ProfileAssignmentStorage.AnonymousOrAnyConnectedKeys,Set<String>> getProfilesForAnonymousAndAnyConnectedUser(Object context) Gets the allowed profiles any connected user has on the given object- Parameters:
context
- The object- Returns:
- a map containing allowed/denied profiles that anonymous and any connected user has on the given object
-
getProfilesForUsers
public Map<UserIdentity,Map<ProfileAssignmentStorage.UserOrGroup, getProfilesForUsersSet<String>>> (Object context, UserIdentity user) Gets the users that have allowed profiles assigned on the given object- Parameters:
context
- The object to testuser
- The user to get profiles for. Can be null to get profiles for all users that have rights- Returns:
- The map of allowed users with their assigned allowed/denied profiles
-
getProfilesForGroups
public Map<GroupIdentity,Map<ProfileAssignmentStorage.UserOrGroup, getProfilesForGroupsSet<String>>> (Object context, Set<GroupIdentity> groups) Gets the groups that have allowed profiles assigned on the given object- Parameters:
context
- The object to testgroups
- The group to get profiles for. Can be null to get profiles for all groups that have rights- Returns:
- The map of allowed/denied groups with their assigned profiles
-
allowProfileToAnyConnectedUser
Adds allowed profile any connected user has on the given object- Parameters:
context
- The object contextprofileId
- The profile to add
-
denyProfileToAnyConnectedUser
Adds denied profile any connected user has on the given object- Parameters:
profileId
- The profile to addcontext
- The object context
-
removeAllowedProfileFromAnyConnectedUser
Removes allowed profile any connected user has on the given object- Parameters:
profileId
- The profile to removecontext
- The object context
-
removeDeniedProfileFromAnyConnectedUser
Removes denied profile any connected user has on the given object- Parameters:
context
- The object contextprofileId
- The profile to remove
-
allowProfileToAnonymous
Adds allowed profile an anonymous user has on the given object- Parameters:
profileId
- The profile to addcontext
- The object context
-
denyProfileToAnonymous
Adds denied profile an anonymous user has on the given object- Parameters:
profileId
- The profile to addcontext
- The object context
-
removeAllowedProfileFromAnonymous
Removes allowed profile an anonymous user has on the given object- Parameters:
profileId
- The profile to removecontext
- The object context
-
removeDeniedProfileFromAnonymous
Removes denied profile an anonymous user has on the given object- Parameters:
context
- The object contextprofileId
- The profile to remove
-
allowProfileToUser
Allows a user to a profile on a given object- Parameters:
user
- The user to addprofileId
- The id of the profilecontext
- The object context
-
denyProfileToUser
Denies a user to a profile on a given object- Parameters:
user
- The user to addprofileId
- The id of the profilecontext
- The object context
-
removeAllowedProfileFromUser
Removes the association between a user and an allowed profile on a given object- Parameters:
user
- The user to removecontext
- The object contextprofileId
- The id of the profile
-
removeDeniedProfileFromUser
Removes the association between a user and a denied profile on a given object- Parameters:
user
- The user to removeprofileId
- The id of the profilecontext
- The object context
-
allowProfileToGroup
Allows a group to a profile on a given object- Parameters:
group
- The group to addprofileId
- The id of the profilecontext
- The object context
-
denyProfileToGroup
Denies a group to a profile on a given object- Parameters:
group
- The group to addprofileId
- The id of the profilecontext
- The object context
-
removeAllowedProfileFromGroup
Removes the association between a group and an allowed profile on a given object- Parameters:
group
- The group to removeprofileId
- The id of the profilecontext
- The object context
-
removeDeniedProfileFromGroup
Removes the association between a group and a denied profile on a given object- Parameters:
group
- The group to removeprofileId
- The id of the profilecontext
- The object context
-
isInheritanceDisallowed
Determines if the inheritance of permissions is disallowed on a given context- Parameters:
context
- The object context- Returns:
- true if the inheritance is disallowed
-
disallowInheritance
Allow or disallow the inheritance of permissions on a given context- Parameters:
context
- The object contextdisallow
- true to disallow the inheritance
-