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
Fields Modifier and Type Field Description protected PopulationContextHelper_populationContextHelperThe helper for the associations population/contextprotected UserPopulationDAO_userPopulationDAOThe DAO for User Populationstatic StringROLEAvalon Role
-
Constructor Summary
Constructors Constructor Description UserManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UsergetUser(String userPopulationId, String login)Get a particular user of the given users population by his login.UsergetUser(UserPopulation userPopulation, String login)Get a particular user of the given user population by his login.UsergetUser(UserIdentity userIdentity)Get the user from its user identityUsergetUserByContext(Set<String> contexts, String login, boolean checkRight)Get a user by his login on some given contextsUsergetUserByDirectory(String userPopulationId, String userDirectoryId, String login)Get a particular user of the given user population and given user directory by his login.UsergetUserByDirectory(UserPopulation userPopulation, String userDirectoryId, String login)Get a particular user of the given user population and given user directory by his login.UsergetUserByEmail(String userPopulationId, String email)Get a particular user of the given users population by his email.UsergetUserByEmail(Set<String> userPopulationIds, String email)Get a particular user of the given users population by his email.UsergetUserByEmail(UserPopulation userPopulation, String email)Get a particular user of the given user population by his email.UserDirectorygetUserDirectory(String userPopulationId, String login)Get the user directory the given user belongs toCollection<User>getUsers(String userPopulationId)Gets all the users of aUserPopulationCollection<User>getUsers(String userPopulationId, int count, int offset, Map<String,Object> parameters)Gets all the users of aUserPopulationList<User>getUsers(List<UserPopulation> userPopulations, int count, int offset, Map<String,Object> parameters)Get a list of users given the parametersCollection<User>getUsers(UserPopulation userPopulation)Gets all the users of aUserPopulationCollection<User>getUsers(UserPopulation userPopulation, int count, int offset, Map<String,Object> parameters)Gets all the users of aUserPopulationCollection<User>getUsersByContext(Set<String> contexts, boolean checkRight)Get the list of users on some given contextsList<User>getUsersByContext(Set<String> contexts, int count, int offset, Map<String,Object> parameters, boolean checkRight)Get a list of users given the parametersCollection<User>getUsersByDirectory(String userPopulationId, String userDirectoryId, int count, int offset, Map<String,Object> parameters)Gets all the users of a givenUserPopulationandUserDirectoryCollection<User>getUsersByDirectory(UserPopulation userPopulation, String userDirectoryId, int count, int offset, Map<String,Object> parameters)Gets all the users of aUserPopulationCollection<User>getUsersByPopulationIds(List<String> userPopulationIds)Get the users for given users' populationsCollection<User>getUsersByPopulations(List<UserPopulation> userPopulations)Get the users for given users' populationsvoidinitialize()voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_userPopulationDAO
protected UserPopulationDAO _userPopulationDAO
The DAO for User Population
-
_populationContextHelper
protected PopulationContextHelper _populationContextHelper
The helper for the associations population/context
-
-
Constructor Detail
-
UserManager
public UserManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
getUsersByContext
public Collection<User> getUsersByContext(Set<String> contexts, boolean checkRight)
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
public Collection<User> getUsersByPopulationIds(List<String> userPopulationIds)
Get the users for given users' populations- Parameters:
userPopulationIds- the id of population of users- Returns:
- the collection of users
-
getUsersByPopulations
public Collection<User> getUsersByPopulations(List<UserPopulation> userPopulations)
Get the users for given users' populations- Parameters:
userPopulations- the population of users- Returns:
- the collection of users
-
getUsers
public Collection<User> getUsers(String userPopulationId)
Gets all the users of aUserPopulation- Parameters:
userPopulationId- The ID of user population- Returns:
- list of users as Collection of
Users, empty if a problem occurs.
-
getUsers
public Collection<User> getUsers(UserPopulation userPopulation)
Gets all the users of aUserPopulation- Parameters:
userPopulation- The user population- Returns:
- list of users as Collection of
Users, empty if a problem occurs.
-
getUsersByContext
public List<User> getUsersByContext(Set<String> contexts, int count, int offset, Map<String,Object> parameters, boolean checkRight)
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 user- Returns:
- The list of retrieved
User
-
getUsers
public List<User> getUsers(List<UserPopulation> userPopulations, int count, int offset, Map<String,Object> parameters)
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.- Returns:
- The list of retrieved
User
-
getUsers
public Collection<User> getUsers(String userPopulationId, int count, int offset, Map<String,Object> parameters)
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.- Returns:
- list of users as Collection of
Users, 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 givenUserPopulationandUserDirectory- 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
Users, empty if a problem occurs.
-
getUsers
public Collection<User> getUsers(UserPopulation userPopulation, int count, int offset, Map<String,Object> parameters)
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.- Returns:
- list of users as Collection of
Users, 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
Users, empty if a problem occurs.
-
getUserByContext
public User getUserByContext(Set<String> contexts, String login, boolean checkRight)
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
Userinstance or null if the user login does not exist.
-
getUser
public User getUser(UserIdentity userIdentity)
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
public User getUser(String userPopulationId, String login)
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
Userinstance 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
Userinstance or null if the user login does not exist. - Throws:
NotUniqueUserException- if many users match the given email
-
getUserByEmail
public User getUserByEmail(String userPopulationId, String email) throws NotUniqueUserException
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
Userinstance or null if the user login does not exist. - Throws:
NotUniqueUserException- if many users match the given email
-
getUserByDirectory
public User getUserByDirectory(String userPopulationId, String userDirectoryId, String login)
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
Userinstance or null if the user login does not exist.
-
getUser
public User getUser(UserPopulation userPopulation, String login)
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
Userinstance 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
Userinstance or null if the user login does not exist. - Throws:
NotUniqueUserException- if many users match the given email
-
getUserByDirectory
public User getUserByDirectory(UserPopulation userPopulation, String userDirectoryId, String login)
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
Userinstance or null if the user login does not exist.
-
getUserDirectory
public UserDirectory getUserDirectory(String userPopulationId, String login)
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.
-
-