public class UserManager
extends java.lang.Object
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();
RedmineManager.getUserManager()
Modifier and Type | Method and Description |
---|---|
void |
addUserToGroup(User user,
Group group)
Deprecated.
|
Group |
createGroup(Group base)
Deprecated.
|
User |
createUser(User user)
Deprecated.
|
void |
deleteGroup(Group base)
Deprecated.
|
void |
deleteUser(java.lang.Integer userId)
Deprecated.
|
User |
getCurrentUser() |
Group |
getGroupById(int id)
Returns the group based on its id.
|
Group |
getGroupByName(java.lang.String name)
Returns the group based on its name.
|
java.util.List<Group> |
getGroups()
Load list of groups on the server.
|
Role |
getRoleById(int id) |
java.util.List<Role> |
getRoles() |
User |
getUserById(java.lang.Integer userId)
This does NOT require Admin privileges by default Redmine installation (tested with Redmine 2.0.3).
|
java.util.List<User> |
getUsers()
Load list of users from the server.
|
ResultsWrapper<User> |
getUsers(java.util.Map<java.lang.String,java.lang.String> parameters)
This method does NOT handle paging for you.
|
void |
update(Group group)
Deprecated.
|
void |
update(User obj)
Deprecated.
|
public User getCurrentUser() throws RedmineException
RedmineException
@Deprecated public User createUser(User user) throws RedmineException
RedmineException
@Deprecated public void deleteUser(java.lang.Integer userId) throws RedmineException
userId
- user identifier (numeric ID)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 foundRedmineException
@Deprecated public void addUserToGroup(User user, Group group) throws RedmineException
RedmineException
public java.util.List<User> getUsers() throws RedmineException
This operation requires "Redmine Administrator" permission.
This method calls Redmine with "include = memberships,groups" parameter.
RedmineAuthenticationException
- invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.NotFoundException
RedmineException
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 Mapparams = new HashMap (); params.put("name", name); final List users = userManager.getUsers(params);
parameters
- http parameters: key/value pairs to append to the rest api requestRedmineAuthenticationException
- invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.RedmineException
public User getUserById(java.lang.Integer userId) throws RedmineException
RedmineException
public java.util.List<Group> getGroups() throws RedmineException
This operation requires "Redmine Administrator" permission.
RedmineAuthenticationException
- invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.NotFoundException
RedmineException
public Group getGroupById(int id) throws RedmineException
This operation requires "Redmine Administrators" permission.
id
- id of the groupRedmineException
public Group getGroupByName(java.lang.String name) throws RedmineException
This operation requires "Redmine Administrators" permission.
name
- the name of the groupRedmineException
@Deprecated public Group createGroup(Group base) throws RedmineException
This operation requires "Redmine Administrator" permission.
RedmineException
@Deprecated public void deleteGroup(Group base) throws RedmineException
This operation requires "Redmine Administrator" permission.
RedmineException
public java.util.List<Role> getRoles() throws RedmineException
RedmineException
public Role getRoleById(int id) throws RedmineException
RedmineException
@Deprecated public void update(User obj) throws RedmineException
RedmineException
@Deprecated public void update(Group group) throws RedmineException
RedmineException