Class UserManager


  • public class UserManager
    extends java.lang.Object
    Works with Users and Groups.

    Obtain it via RedmineManager:

     RedmineManager redmineManager = RedmineManagerFactory.createWithUserAuth(redmineURI, login, password);
     UserManager userManager = redmineManager.getUserManager();
     
    Note that some operations with users require Redmine Admin privileges.

    Sample usage:

         users = mgr.getUserManager().getUsers();
     
    See Also:
    RedmineManager.getUserManager()
    • Method Detail

      • deleteUser

        @Deprecated
        public void deleteUser​(java.lang.Integer userId)
                        throws RedmineException
        Deprecated.
        DEPRECATED. use user.delete() instead
        Parameters:
        userId - user identifier (numeric ID)
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        NotFoundException - if the user with the given id is not found
        RedmineException
      • getUsers

        public java.util.List<User> getUsers()
                                      throws RedmineException
        Load list of users from the server.

        This operation requires "Redmine Administrator" permission.

        This method calls Redmine with "include = memberships,groups" parameter.

        Returns:
        list of User objects
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        NotFoundException
        RedmineException
      • getUsers

        public ResultsWrapper<User> getUsers​(java.util.Map<java.lang.String,​java.lang.String> parameters)
                                      throws RedmineException

        This method does NOT handle paging for you. You need to provide "offset" and "limit" parameters if you want to control paging.

        Sample usage:

             final Map params = new HashMap();
             params.put("name", name);
             final List users = userManager.getUsers(params);
             
        Parameters:
        parameters - http parameters: key/value pairs to append to the rest api request
        Returns:
        resultsWrapper with raw response from Redmine REST API
        Throws:
        RedmineAuthenticationException - invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
        RedmineException
      • getUserById

        public User getUserById​(java.lang.Integer userId)
                         throws RedmineException
        This does NOT require Admin privileges by default Redmine installation (tested with Redmine 2.0.3).
        Throws:
        RedmineException
      • getGroupById

        public Group getGroupById​(int id)
                           throws RedmineException
        Returns the group based on its id.

        This operation requires "Redmine Administrators" permission.

        Parameters:
        id - id of the group
        Returns:
        the group
        Throws:
        RedmineException
      • getGroupByName

        public Group getGroupByName​(java.lang.String name)
                             throws RedmineException
        Returns the group based on its name.

        This operation requires "Redmine Administrators" permission.

        Parameters:
        name - the name of the group
        Returns:
        the group
        Throws:
        RedmineException
      • createGroup

        @Deprecated
        public Group createGroup​(Group base)
                          throws RedmineException
        Deprecated.
        DEPRECATED. use group.create() Creates a new group.

        This operation requires "Redmine Administrator" permission.

        Returns:
        created group.
        Throws:
        RedmineException
      • deleteGroup

        @Deprecated
        public void deleteGroup​(Group base)
                         throws RedmineException
        Deprecated.
        Deletes a group.

        This operation requires "Redmine Administrator" permission.

        Throws:
        RedmineException