Package org.ametys.core.user
Class UserManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.user.UserManager
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class UserManager
extends AbstractLogEnabled
implements Component, Serviceable, Initializable
Component for getting user list and verify the presence of a particular user on a context or for user directory(ies).
-
Field Summary
Modifier and TypeFieldDescriptionprotected PopulationContextHelper
The helper for the associations population/contextprotected UserPopulationDAO
The DAO for User Populationstatic final String
Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet a particular user of the given users population by his login.getUser
(UserPopulation userPopulation, String login) Get a particular user of the given user population by his login.getUser
(UserIdentity userIdentity) Get the user from its user identitygetUserByContext
(Set<String> contexts, String login, boolean checkRight) Get a user by his login on some given contextsgetUserByDirectory
(String userPopulationId, String userDirectoryId, String login) Get a particular user of the given user population and given user directory by his login.getUserByDirectory
(UserDirectory userDirectory, String login) Get a particular user of the given user directory by his login.getUserByDirectory
(UserPopulation userPopulation, String userDirectoryId, String login) Get a particular user of the given user population and given user directory by his login.getUserByEmail
(String userPopulationId, String email) Get a particular user of the given users population by his email.getUserByEmail
(Set<String> userPopulationIds, String email) Get a particular user of the given users population by his email.getUserByEmail
(UserPopulation userPopulation, String email) Get a particular user of the given user population by his email.getUserByUserDirectoryAndEmail
(UserDirectory userDirectory, String email) Get a particular user of the given user directory by his email.getUserDirectory
(String userPopulationId, String login) Get the user directory the given user belongs toGets all the users of aUserPopulation
getUsers
(String userPopulationId, int count, int offset, Map<String, Object> parameters, boolean sort) Gets all the users of aUserPopulation
getUsers
(List<UserPopulation> userPopulations, int count, int offset, Map<String, Object> parameters, boolean sort) Get a list of users given the parametersgetUsers
(UserPopulation userPopulation) Gets all the users of aUserPopulation
getUsers
(UserPopulation userPopulation, int count, int offset, Map<String, Object> parameters, boolean sort) Gets all the users of aUserPopulation
getUsersByContext
(Set<String> contexts, boolean checkRight) Get the list of users on some given contextsgetUsersByContext
(Set<String> contexts, int count, int offset, Map<String, Object> parameters, boolean checkRight, boolean sort) Get a list of users given the parametersgetUsersByDirectory
(String userPopulationId, String userDirectoryId, int count, int offset, Map<String, Object> parameters) Gets all the users of a givenUserPopulation
andUserDirectory
getUsersByDirectory
(UserPopulation userPopulation, String userDirectoryId, int count, int offset, Map<String, Object> parameters) Gets all the users of aUserPopulation
getUsersByPopulationIds
(List<String> userPopulationIds) Get the users for given users' populationsgetUsersByPopulations
(List<UserPopulation> userPopulations) Get the users for given users' populationsvoid
void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
_userPopulationDAO
The DAO for User Population -
_populationContextHelper
The helper for the associations population/context
-
-
Constructor Details
-
UserManager
public UserManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getUsersByContext
Get the list of users on some given contexts- Parameters:
contexts
- The contextscheckRight
- True to check that current user belongs to one of populations on theses contexts or he's an administrator user- Returns:
- the collection of users
-
getUsersByPopulationIds
Get the users for given users' populations- Parameters:
userPopulationIds
- the id of population of users- Returns:
- the collection of users
-
getUsersByPopulations
Get the users for given users' populations- Parameters:
userPopulations
- the population of users- Returns:
- the collection of users
-
getUsers
Gets all the users of aUserPopulation
- Parameters:
userPopulationId
- The ID of user population- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUsers
Gets all the users of aUserPopulation
- Parameters:
userPopulation
- The user population- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUsersByContext
public List<User> getUsersByContext(Set<String> contexts, int count, int offset, Map<String, Object> parameters, boolean checkRight, boolean sort) Get a list of users given the parameters- Parameters:
contexts
- The contextscount
- The limit of users to retrieveoffset
- The number of result to ignore before starting to collect users.parameters
- A map of additional parameters, see implementation.checkRight
- True to check that current user belongs to one of populations on theses contexts or he's an administrator usersort
- true to sort users- Returns:
- The list of retrieved
User
-
getUsers
public List<User> getUsers(List<UserPopulation> userPopulations, int count, int offset, Map<String, Object> parameters, boolean sort) Get a list of users given the parameters- Parameters:
userPopulations
- the population of userscount
- The limit of users to retrieveoffset
- The number of result to ignore before starting to collect users.parameters
- A map of additional parameters, see implementation.sort
- true to sort users- Returns:
- The list of retrieved
User
-
getUsers
public Collection<User> getUsers(String userPopulationId, int count, int offset, Map<String, Object> parameters, boolean sort) Gets all the users of aUserPopulation
- Parameters:
userPopulationId
- The ID of user populationcount
- The limit of users to retrieveoffset
- The number of result to ignore before starting to collect users.parameters
- A map of additional parameters, see implementation.sort
- true to sort users- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUsersByDirectory
public Collection<User> getUsersByDirectory(String userPopulationId, String userDirectoryId, int count, int offset, Map<String, Object> parameters) Gets all the users of a givenUserPopulation
andUserDirectory
- Parameters:
userPopulationId
- The ID of user populationuserDirectoryId
- The id of the user directorycount
- The limit of users to retrieveoffset
- The number of result to ignore before starting to collect users.parameters
- A map of additional parameters, see implementation.- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUsers
public Collection<User> getUsers(UserPopulation userPopulation, int count, int offset, Map<String, Object> parameters, boolean sort) Gets all the users of aUserPopulation
- Parameters:
userPopulation
- The users populationcount
- The limit of users to retrieveoffset
- The number of result to ignore before starting to collect users.parameters
- A map of additional parameters, see implementation.sort
- true to sort users- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUsersByDirectory
public Collection<User> getUsersByDirectory(UserPopulation userPopulation, String userDirectoryId, int count, int offset, Map<String, Object> parameters) Gets all the users of aUserPopulation
- Parameters:
userPopulation
- The users populationuserDirectoryId
- The id of the user directorycount
- The limit of users to retrieveoffset
- The number of result to ignore before starting to collect users.parameters
- A map of additional parameters, see implementation.- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUserByContext
Get a user by his login on some given contexts- Parameters:
contexts
- The contextslogin
- Login of the user to get. Cannot be null.checkRight
- True to check that current user is authorized to retrieve this user (true if he belongs to one of populations on theses contexts or he's an administrator user)- Returns:
- User's information as a
User
instance or null if the user login does not exist.
-
getUser
Get the user from its user identity- Parameters:
userIdentity
- The user identity- Returns:
- The User or null if the user login does not exist.
-
getUser
Get a particular user of the given users population by his login.- Parameters:
userPopulationId
- The ID of user populationlogin
- Login of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist.
-
getUserByEmail
public User getUserByEmail(Set<String> userPopulationIds, String email) throws NotUniqueUserException Get a particular user of the given users population by his email.- Parameters:
userPopulationIds
- The IDs of user populationemail
- Email of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist. - Throws:
NotUniqueUserException
- if many users match the given email
-
getUserByEmail
Get a particular user of the given users population by his email.- Parameters:
userPopulationId
- The ID of user populationemail
- Email of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist. - Throws:
NotUniqueUserException
- if many users match the given email
-
getUserByDirectory
Get a particular user of the given user population and given user directory by his login.- Parameters:
userPopulationId
- The ID of user populationuserDirectoryId
- The id of the user directorylogin
- Login of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist.
-
getUser
Get a particular user of the given user population by his login.- Parameters:
userPopulation
- The user populationlogin
- Login of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist.
-
getUserByEmail
public User getUserByEmail(UserPopulation userPopulation, String email) throws NotUniqueUserException Get a particular user of the given user population by his email.- Parameters:
userPopulation
- The user populationemail
- Email of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist. - Throws:
NotUniqueUserException
- if many users match the given email
-
getUserByUserDirectoryAndEmail
public User getUserByUserDirectoryAndEmail(UserDirectory userDirectory, String email) throws NotUniqueUserException Get a particular user of the given user directory by his email.- Parameters:
userDirectory
- The user directoryemail
- Email of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist. - Throws:
NotUniqueUserException
- if many users match the given email
-
getUserByDirectory
Get a particular user of the given user population and given user directory by his login.- Parameters:
userPopulation
- The user populationuserDirectoryId
- The id of the user directorylogin
- Login of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist.
-
getUserByDirectory
Get a particular user of the given user directory by his login.- Parameters:
userDirectory
- The user directorylogin
- Login of the user to get. Cannot be null.- Returns:
- User's information as a
User
instance or null if the user login does not exist.
-
getUserDirectory
Get the user directory the given user belongs to- Parameters:
userPopulationId
- The id of the user populationlogin
- Login of the user to get. Cannot be null.- Returns:
- The user directory the user belongs to.
-