Class UserManager

All Implemented Interfaces:
LogEnabled, Initializable, Component, Serviceable

Component for getting user list and verify the presence of a particular user on a context or for user directory(ies).
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • initialize

      public void initialize() throws Exception
      Specified by:
      initialize in interface Initializable
      Throws:
      Exception
    • getUsersByContext

      public Collection<User> getUsersByContext(Set<String> contexts, boolean checkRight)
      Get the list of users on some given contexts
      Parameters:
      contexts - The contexts
      checkRight - 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

      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 a UserPopulation
      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 a UserPopulation
      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, boolean sort)
      Get a list of users given the parameters
      Parameters:
      contexts - The contexts
      count - The limit of users to retrieve
      offset - 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
      sort - 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 users
      count - The limit of users to retrieve
      offset - 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 a UserPopulation
      Parameters:
      userPopulationId - The ID of user population
      count - The limit of users to retrieve
      offset - 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 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 given UserPopulation and UserDirectory
      Parameters:
      userPopulationId - The ID of user population
      userDirectoryId - The id of the user directory
      count - The limit of users to retrieve
      offset - 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, boolean sort)
      Gets all the users of a UserPopulation
      Parameters:
      userPopulation - The users population
      count - The limit of users to retrieve
      offset - 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 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 a UserPopulation
      Parameters:
      userPopulation - The users population
      userDirectoryId - The id of the user directory
      count - The limit of users to retrieve
      offset - 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 contexts
      login - 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

      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 population
      login - 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 population
      email - 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

      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 population
      email - 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

      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 population
      userDirectoryId - The id of the user directory
      login - 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

      public User getUser(UserPopulation userPopulation, String login)
      Get a particular user of the given user population by his login.
      Parameters:
      userPopulation - The user population
      login - 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 population
      email - 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

      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 population
      userDirectoryId - The id of the user directory
      login - 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

      public UserDirectory getUserDirectory(String userPopulationId, String login)
      Get the user directory the given user belongs to
      Parameters:
      userPopulationId - The id of the user population
      login - Login of the user to get. Cannot be null.
      Returns:
      The user directory the user belongs to.