Package org.ametys.core.right
Class AllowedUsers
- java.lang.Object
-
- org.ametys.core.right.AllowedUsers
-
public class AllowedUsers extends Object
Wrapper class to represent a set of allowed users, which can eventually be anonymous or any connected user.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<GroupIdentity>_allowedGroupsprivate Set<UserIdentity>_allowedUsersprivate boolean_anonymousAllowedprivate boolean_anyConnectedUserAllowedprivate Set<GroupIdentity>_deniedGroupsprivate Set<UserIdentity>_deniedUsersprivate GroupManager_groupManagerprivate Set<String>_populationContextsprivate UserManager_userManager
-
Constructor Summary
Constructors Constructor Description AllowedUsers(boolean anonymousAllowed, boolean anyConnectedUserAllowed, Set<UserIdentity> allowedUsers, Set<UserIdentity> deniedUsers, Set<GroupIdentity> allowedGroups, Set<GroupIdentity> deniedGroups, UserManager userManager, GroupManager groupManager, Set<String> populationContexts)Creates an object representing allowed users.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<GroupIdentity>getAllowedGroups()Get the allowed groupsSet<UserIdentity>getAllowedUsers()Get the allowed usersSet<GroupIdentity>getDeniedGroups()Get the allowed groupsSet<UserIdentity>getDeniedUsers()Get the denied usersbooleanisAnonymousAllowed()Returns true if any anonymous user is allowedbooleanisAnyConnectedUserAllowed()Returns true if any connected user is allowedSet<UserIdentity>resolveAllowedUsers(boolean returnAll)Resolve the actual allowed users, taking into account the anyconnected, allowed and denied users and groups.
-
-
-
Field Detail
-
_anonymousAllowed
private boolean _anonymousAllowed
-
_anyConnectedUserAllowed
private boolean _anyConnectedUserAllowed
-
_allowedUsers
private Set<UserIdentity> _allowedUsers
-
_deniedUsers
private Set<UserIdentity> _deniedUsers
-
_allowedGroups
private Set<GroupIdentity> _allowedGroups
-
_deniedGroups
private Set<GroupIdentity> _deniedGroups
-
_userManager
private UserManager _userManager
-
_populationContexts
private Set<String> _populationContexts
-
_groupManager
private GroupManager _groupManager
-
-
Constructor Detail
-
AllowedUsers
AllowedUsers(boolean anonymousAllowed, boolean anyConnectedUserAllowed, Set<UserIdentity> allowedUsers, Set<UserIdentity> deniedUsers, Set<GroupIdentity> allowedGroups, Set<GroupIdentity> deniedGroups, UserManager userManager, GroupManager groupManager, Set<String> populationContexts)
Creates an object representing allowed users.- Parameters:
anonymousAllowed- true to indicate any anonymous user is allowedanyConnectedUserAllowed- if anonymous is false, true to indicate any connected user is allowedallowedUsers- the allowed users, not taking into account the denied users. Must be null if anonymous or anyConnectedUser is true, must not otherwise.deniedUsers- the denied users. Must be null if anonymous is true, must not otherwise.allowedGroups- the allowed groups, not taking into account the denied groups. Must be null if anonymous or anyConnectedUser is true, must not otherwise.deniedGroups- the denied groups. Must be null if anonymous is true, must not otherwise.userManager- The user managergroupManager- The group managerpopulationContexts- The population contexts for retrieving users from user manager. Can be null if anyConnectedUser is false
-
-
Method Detail
-
isAnonymousAllowed
public boolean isAnonymousAllowed()
Returns true if any anonymous user is allowed- Returns:
- true if any anonymous user is allowed
-
isAnyConnectedUserAllowed
public boolean isAnyConnectedUserAllowed()
Returns true if any connected user is allowed- Returns:
- true if any connected user is allowed
-
getAllowedUsers
public Set<UserIdentity> getAllowedUsers()
Get the allowed users- Returns:
- The allowed users
-
getDeniedUsers
public Set<UserIdentity> getDeniedUsers()
Get the denied users- Returns:
- The denied users
-
getAllowedGroups
public Set<GroupIdentity> getAllowedGroups()
Get the allowed groups- Returns:
- The allowed groups
-
getDeniedGroups
public Set<GroupIdentity> getDeniedGroups()
Get the allowed groups- Returns:
- The allowed groups
-
resolveAllowedUsers
public Set<UserIdentity> resolveAllowedUsers(boolean returnAll)
Resolve the actual allowed users, taking into account the anyconnected, allowed and denied users and groups. If anonymous is allowed, it will return an empty list.- Parameters:
returnAll- Set totrueto resolve all users if any connected user is allowed. Iffalse, returns an empty Set if any connected user is allowed.- Returns:
- the computed actual allowed users
-
-