Package com.atlassian.jira.rest.v2.issue
Class UserResource
java.lang.Object
com.atlassian.jira.rest.v2.issue.UserResource
@Path("user")
@Consumes("application/json")
@Produces("application/json")
public class UserResource
extends Object
- Since:
- 4.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionUserResource(UserService userService, UserUtil userUtil, PasswordPolicyManager passwordPolicyManager, I18nHelper i18n, EmailFormatter emailFormatter, JiraAuthenticationContext authContext, TimeZoneManager timeZoneManager, AvatarPickerHelper avatarPickerHelper, AvatarManager avatarManager, AvatarService avatarService, TemporaryAvatarHelper temporaryAvatarHelper, UserPropertyManager userPropertyManager, PermissionManager permissionManager, GlobalPermissionManager globalPermissionManager, ProjectService projectService, IssueService issueService, ProjectManager projectManager, com.atlassian.event.api.EventPublisher eventPublisher, UserPickerResourceHelper userPickerHelper, JiraBaseUrls jiraBaseUrls, ColumnService columnService, XsrfInvocationChecker xsrfChecker, UserManager userManager, I18nHelper.BeanFactory beanFactory, ApplicationRoleManager applicationRoleManager, ApplicationRoleBeanConverter applicationRoleBeanConverter, UpdateUserApplicationHelper updateUserApplicationHelper, ResponseFactory responseFactory, ApplicationProperties applicationProperties, DuplicatedUsersHelper duplicatedUsersHelper, LoginService loginService, DateTimeFormatterFactory dateTimeFormatterFactory, StreamPages streamPages, StreamPageRequests streamPageRequests) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseaddUserToApplication(String username, String applicationKey) Add user to given application.jakarta.ws.rs.core.ResponsechangeUserPassword(String username, String key, PasswordBean passwordBean) Modify user password.jakarta.ws.rs.core.ResponsecreateAvatarFromTemporary(String username, AvatarCroppingBean croppingInstructions) Converts temporary avatar into a real avatarjakarta.ws.rs.core.ResponsecreateUser(UserWriteBean userBean) Create user.jakarta.ws.rs.core.ResponsedefaultColumns(String username) Returns the default columns for the given user.jakarta.ws.rs.core.ResponsedeleteAvatar(String username, Long id) Deletes avatarjakarta.ws.rs.core.ResponsefindAssignableUsers(String username, String projectKey, String issueKey, Integer maxResults, Integer actionDescriptorId, jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users that match the search string.jakarta.ws.rs.core.ResponsefindBulkAssignableUsers(String username, String projectKeysStr, Integer maxResults, jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users that match the search string and can be assigned issues for all the given projects.jakarta.ws.rs.core.ResponsefindUsers(String username, Integer startAt, Integer maxResults, Boolean includeActive, Boolean includeInactive, jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users that match the search string.jakarta.ws.rs.core.ResponseReturns a list of users matching query with highlighting.jakarta.ws.rs.core.ResponsefindUsersWithAllPermissions(String username, String permissions, String issueKey, String projectKey, Integer startAt, Integer maxResults) Deprecated.This endpoint can cause serious performance issues and will be removed in Jira 9.0.jakarta.ws.rs.core.ResponsefindUsersWithBrowsePermission(String username, String issueKey, String projectKey, Integer maxResults, jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of active users that match the search string.getAllAvatars(String username) Returns all avatars which are visible for the currently logged in user.jakarta.ws.rs.core.ResponsegetDuplicatedUsersCount(boolean flush) Returns the number of users whose accounts are duplicated.jakarta.ws.rs.core.ResponsegetDuplicatedUsersMapping(boolean flush) Returns duplicated users mapped to their directories with an indication if their accounts are active or not.jakarta.ws.rs.core.ResponseReturns a user.jakarta.ws.rs.core.ResponsegetUserList(Long cursor, Integer maxResults, jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users.jakarta.ws.rs.core.ResponseremoveUser(String username, String key) Removes user and its references (like project roles associations, watches, history).jakarta.ws.rs.core.ResponseremoveUserFromApplication(String username, String applicationKey) Remove user from given application.jakarta.ws.rs.core.ResponseresetColumns(String username) Reset the default columns for the given user to the system default.jakarta.ws.rs.core.ResponsesetColumns(ColumnsBean columns) Sets the default columns for the currently logged in user.jakarta.ws.rs.core.ResponsesetColumnsUrlEncoded(String username, List<String> fields) Sets the default columns for the given user.jakarta.ws.rs.core.ResponsestoreTemporaryAvatar(String username, String filename, Long size, jakarta.servlet.http.HttpServletRequest request) Creates temporary avatar.jakarta.ws.rs.core.ResponsestoreTemporaryAvatarUsingMultiPart(String username, com.atlassian.plugins.rest.api.multipart.FilePart filePart, jakarta.servlet.http.HttpServletRequest request) Creates temporary avatar using multipart.jakarta.ws.rs.core.ResponseupdateUser(String username, String key, UserWriteBean userBean) Modify user.jakarta.ws.rs.core.ResponseupdateUserAvatar(String username, AvatarBean avatarBean)
-
Field Details
-
DEPRECATION_WARNING_LOG_INTERVAL_MINUTES
public static final int DEPRECATION_WARNING_LOG_INTERVAL_MINUTES- See Also:
-
DEFAULT_USERS_RETURNED
public static final int DEFAULT_USERS_RETURNED- See Also:
-
MAX_USERS_RETURNED
public static final int MAX_USERS_RETURNED- See Also:
-
MAX_USERS_RETURNED_FOR_OPTIMISED_LOOKUP
public static final int MAX_USERS_RETURNED_FOR_OPTIMISED_LOOKUP
-
-
Constructor Details
-
UserResource
@Inject public UserResource(UserService userService, UserUtil userUtil, PasswordPolicyManager passwordPolicyManager, I18nHelper i18n, EmailFormatter emailFormatter, JiraAuthenticationContext authContext, TimeZoneManager timeZoneManager, AvatarPickerHelper avatarPickerHelper, AvatarManager avatarManager, AvatarService avatarService, TemporaryAvatarHelper temporaryAvatarHelper, UserPropertyManager userPropertyManager, PermissionManager permissionManager, GlobalPermissionManager globalPermissionManager, ProjectService projectService, IssueService issueService, ProjectManager projectManager, com.atlassian.event.api.EventPublisher eventPublisher, UserPickerResourceHelper userPickerHelper, JiraBaseUrls jiraBaseUrls, ColumnService columnService, XsrfInvocationChecker xsrfChecker, UserManager userManager, I18nHelper.BeanFactory beanFactory, ApplicationRoleManager applicationRoleManager, ApplicationRoleBeanConverter applicationRoleBeanConverter, UpdateUserApplicationHelper updateUserApplicationHelper, ResponseFactory responseFactory, ApplicationProperties applicationProperties, DuplicatedUsersHelper duplicatedUsersHelper, LoginService loginService, DateTimeFormatterFactory dateTimeFormatterFactory, StreamPages streamPages, StreamPageRequests streamPageRequests)
-
-
Method Details
-
getUser
@GET public jakarta.ws.rs.core.Response getUser(@QueryParam("username") String username, @QueryParam("key") String key, @QueryParam("includeDeleted") @DefaultValue("false") boolean includeDeleted) Returns a user. This resource cannot be accessed anonymously.- Parameters:
username- the usernamekey- user keyincludeDeleted- whether deleted users should be returned (flag available to users with global ADMIN rights)
-
getUserList
@GET @Path("list") public jakarta.ws.rs.core.Response getUserList(@QueryParam("cursor") Long cursor, @QueryParam("maxResults") @DefaultValue("2000") Integer maxResults, @Context jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users. This resource cannot be accessed anonymously. This Api is a streaming-like endpoint. For performance and security reasons, it is not indicating the total number of users available in the system.- Parameters:
cursor- The id of the user to start after. This is a cursor for pagination. This is an optional parameter. If not provided, the first user will be returned. The response will carry the next cursor to be used in the next request.maxResults- The maximum number of users to return per page (defaults to 2000). The maximum allowed value isStreamPageRequest.MAX_PAGE_LIMIT.
-
findUsers
@GET @Path("search") public jakarta.ws.rs.core.Response findUsers(@QueryParam("username") String username, @QueryParam("startAt") Integer startAt, @QueryParam("maxResults") Integer maxResults, @QueryParam("includeActive") Boolean includeActive, @QueryParam("includeInactive") Boolean includeInactive, @Context jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users that match the search string. This resource cannot be accessed anonymously.- Parameters:
username- A query string used to search username, name or e-mail addressstartAt- The index of the first user to return (0-based). Please note that the startAt parameter will be deprecated in a future release of Jira 10.3.xmaxResults- The maximum number of users to return (defaults to 50). The maximum allowed value is 100 (The combination of maxResults and startAt is limited to the first 100 results). If you specify a value that is higher than this number, your search results will be truncated if you send a request with startAt=98 and maxResults=20, it will only return 2 users.includeActive- If true, then active users are included in the results (default true)includeInactive- If true, then inactive users are included in the results (default false)uriInfo- context used for creating urls in user objects- Returns:
- A list of user objects that match the username provided
-
findUsersForPicker
@GET @Path("picker") public jakarta.ws.rs.core.Response findUsersForPicker(@QueryParam("query") String query, @QueryParam("maxResults") Integer maxResults, @QueryParam("showAvatar") Boolean showAvatar, @QueryParam("exclude") List<String> excludeUsers) Returns a list of users matching query with highlighting.- Parameters:
query- A string used to search username, Name or e-mail addressmaxResults- The maximum number of users to return (defaults to 50). The maximum allowed value is 100 (The combination of maxResults and startAt is limited to the first 100 results). If you specify a value that is higher than this number, your search results will be truncated if you send a request with startAt=98 and maxResults=20, it will only return 2 users.- Returns:
- An object containing list of matched user objects, with html representing highlighting.
-
findAssignableUsers
@GET @Path("assignable/search") public jakarta.ws.rs.core.Response findAssignableUsers(@QueryParam("username") String username, @QueryParam("project") String projectKey, @QueryParam("issueKey") String issueKey, @QueryParam("maxResults") @DefaultValue("50") Integer maxResults, @QueryParam("actionDescriptorId") Integer actionDescriptorId, @Context jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users that match the search string. This resource cannot be accessed anonymously. Please note that this resource should be called with an issue key when a list of assignable users is retrieved for editing. For create only a project key should be supplied. The list of assignable users may be incorrect if it's called with the project key for editing.- Parameters:
username- the usernameprojectKey- the key of the project we are finding assignable users forissueKey- the issue key for the issue being edited we need to find assignable users for.maxResults- The maximum number of users to return (defaults to 50). The maximum allowed value is 100 (The combination of maxResults and startAt is limited to the first 100 results). If you specify a value that is higher than this number, your search results will be truncated if you send a request with startAt=98 and maxResults=20, it will only return 2 users.uriInfo- Context used for constructing user objects- Returns:
- a Response with the users matching the query
-
getDuplicatedUsersCount
@Path("duplicated/count") @ExperimentalApi @GET public jakarta.ws.rs.core.Response getDuplicatedUsersCount(@QueryParam("flush") boolean flush) Returns the number of users whose accounts are duplicated. Duplicated means that the user has an account in more than one directory and either more than one account is active or the only active account does not belong to the directory with the highest priority. The data returned by this endpoint is cached for 10 minutes and the cache is flushed when any User Directory is added, removed, enabled, disabled, or synchronized. A System Administrator can also flush the cache manually. Related JAC ticket: https://jira.atlassian.com/browse/JRASERVER-68797- Parameters:
flush- if set to true forces cache flush, user must be sysadmin for this parameter to have an effect.- Since:
- 8.19
-
getDuplicatedUsersMapping
@Path("duplicated/list") @ExperimentalApi @GET public jakarta.ws.rs.core.Response getDuplicatedUsersMapping(@QueryParam("flush") boolean flush) Returns duplicated users mapped to their directories with an indication if their accounts are active or not. Duplicated means that the user has an account in more than one directory and either more than one account is active or the only active account does not belong to the directory with the highest priority. The data returned by this endpoint is cached for 10 minutes and the cache is flushed when any User Directory is added, removed, enabled, disabled, or synchronized. A System Administrator can also flush the cache manually. Related JAC ticket: https://jira.atlassian.com/browse/JRASERVER-68797- Parameters:
flush- if set to true forces cache flush, user must be sysadmin for this parameter to have an effect.- Since:
- 8.19
-
createUser
Create user. By default, created user will not be notified with email. If password field is not set then password will be randomly generated. -
updateUser
@PUT @ExperimentalApi public jakarta.ws.rs.core.Response updateUser(@QueryParam("username") String username, @QueryParam("key") String key, UserWriteBean userBean) Modify user. The "value" fields present will override the existing value. Fields skipped in request will not be changed.- Parameters:
username- the usernamekey- user key- Returns:
- a user
-
changeUserPassword
@PUT @ExperimentalApi @Path("password") public jakarta.ws.rs.core.Response changeUserPassword(@QueryParam("username") String username, @QueryParam("key") String key, PasswordBean passwordBean) Modify user password.- Parameters:
username- the usernamekey- user key
-
removeUser
@DELETE @ExperimentalApi public jakarta.ws.rs.core.Response removeUser(@QueryParam("username") String username, @QueryParam("key") String key) Removes user and its references (like project roles associations, watches, history).- Parameters:
username- the usernamekey- user key
-
findUsersWithBrowsePermission
@GET @Path("viewissue/search") public jakarta.ws.rs.core.Response findUsersWithBrowsePermission(@QueryParam("username") String username, @QueryParam("issueKey") String issueKey, @QueryParam("projectKey") String projectKey, @QueryParam("maxResults") Integer maxResults, @Context jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of active users that match the search string. This resource cannot be accessed anonymously and requires the Browse Users global permission. Given an issue key this resource will provide a list of users that match the search string and have the browse issue permission for the issue provided.- Parameters:
username- the username filter, no users returned if left blankissueKey- the issue key for the issue being edited we need to find viewable users for.projectKey- the optional project key to search for users with if no issueKey is supplied.maxResults- The maximum number of users to return (defaults to 50). The maximum allowed value is 100 (The combination of maxResults and startAt is limited to the first 100 results). If you specify a value that is higher than this number, your search results will be truncated if you send a request with startAt=98 and maxResults=20, it will only return 2 users.uriInfo- Context used for constructing user objects- Returns:
- a Response with the users matching the query
-
findUsersWithAllPermissions
@GET @Path("permission/search") @Deprecated public jakarta.ws.rs.core.Response findUsersWithAllPermissions(@QueryParam("username") String username, @QueryParam("permissions") String permissions, @QueryParam("issueKey") String issueKey, @QueryParam("projectKey") String projectKey, @QueryParam("startAt") Integer startAt, @QueryParam("maxResults") Integer maxResults) Deprecated.This endpoint can cause serious performance issues and will be removed in Jira 9.0.Returns a list of active users that match the search string and have all specified permissions for the project or issue.
This resource can be accessed by users with ADMINISTER_PROJECT permission for the project or global ADMIN or SYSADMIN rights.
This endpoint can cause serious performance issues and will be removed in Jira 9.0.- Parameters:
username- the username filter, list includes all users if unspecifiedpermissions- comma separated list of permissions for project or issue returned users must have, see Permissions JavaDoc for the list of all possible permissions.issueKey- the issue key for the issue for which returned users have specified permissions.projectKey- the optional project key to search for users with if no issueKey is supplied.startAt- The index of the first user to return (0-based). Please note that the startAt parameter will be deprecated in a future release of Jira 10.3.xmaxResults- The maximum number of users to return (defaults to 50). The maximum allowed value is 100 (The combination of maxResults and startAt is limited to the first 100 results). If you specify a value that is higher than this number, your search results will be truncated if you send a request with startAt=98 and maxResults=20, it will only return 2 users.- Returns:
- a Response with the users matching the query
-
findBulkAssignableUsers
@GET @Path("assignable/multiProjectSearch") public jakarta.ws.rs.core.Response findBulkAssignableUsers(@QueryParam("username") String username, @QueryParam("projectKeys") String projectKeysStr, @QueryParam("maxResults") @DefaultValue("50") Integer maxResults, @Context jakarta.ws.rs.core.UriInfo uriInfo) Returns a list of users that match the search string and can be assigned issues for all the given projects.- Parameters:
username- the usernameprojectKeysStr- the keys of the projects we are finding assignable users for, comma-separatedmaxResults- The maximum number of users to return (defaults to 50). The maximum allowed value is 100 (The combination of maxResults and startAt is limited to the first 100 results). If you specify a value that is higher than this number, your search results will be truncated if you send a request with startAt=98 and maxResults=20, it will only return 2 users.uriInfo- Context used for constructing user objects
-
getAllAvatars
@GET @Path("avatars") public Map<String,List<AvatarBean>> getAllAvatars(@QueryParam("username") String username) Returns all avatars which are visible for the currently logged in user.- Parameters:
username- username- Returns:
- all avatars for given user, which the logged in user has permission to see
- Since:
- v5.0
-
createAvatarFromTemporary
@POST @Path("avatar") public jakarta.ws.rs.core.Response createAvatarFromTemporary(@QueryParam("username") String username, AvatarCroppingBean croppingInstructions) Converts temporary avatar into a real avatar- Parameters:
username- usernamecroppingInstructions- cropping instructions- Returns:
- created avatar
- Since:
- v5.0
-
updateUserAvatar
@PUT @Path("avatar") public jakarta.ws.rs.core.Response updateUserAvatar(@QueryParam("username") String username, AvatarBean avatarBean) -
storeTemporaryAvatar
@POST @Consumes("*/*") @Path("avatar/temporary") public jakarta.ws.rs.core.Response storeTemporaryAvatar(@QueryParam("username") String username, @QueryParam("filename") String filename, @QueryParam("size") Long size, @Context jakarta.servlet.http.HttpServletRequest request) Creates temporary avatar. Creating a temporary avatar is part of a 3-step process in uploading a new avatar for a user: upload, crop, confirm.- Parameters:
username- usernamefilename- name of file being uploadedsize- size of filerequest- servlet request- Returns:
- temporary avatar cropping instructions
- Since:
- v5.0
-
storeTemporaryAvatarUsingMultiPart
@POST @Consumes("multipart/form-data") @Path("avatar/temporary") @Produces("text/html") public jakarta.ws.rs.core.Response storeTemporaryAvatarUsingMultiPart(@QueryParam("username") String username, com.atlassian.plugins.rest.api.multipart.FilePart filePart, @Context jakarta.servlet.http.HttpServletRequest request) Creates temporary avatar using multipart. The response is sent back as JSON stored in a textarea. This is because the client uses remote iframing to submit avatars using multipart. So we must send them a valid HTML page back from which the client parses the JSON from.- Parameters:
username- Usernamerequest- servlet request- Returns:
- temporary avatar cropping instructions
- Since:
- v5.0
-
deleteAvatar
@DELETE @Path("avatar/{id}") public jakarta.ws.rs.core.Response deleteAvatar(@QueryParam("username") String username, @PathParam("id") Long id) Deletes avatar- Parameters:
username- usernameid- database id for avatar- Returns:
- temporary avatar cropping instructions
- Since:
- v5.0
-
defaultColumns
@GET @Path("columns") public jakarta.ws.rs.core.Response defaultColumns(@QueryParam("username") String username) Returns the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.- Parameters:
username- username- Returns:
- column configuration
- Since:
- v6.1
-
setColumnsUrlEncoded
@PUT @Path("columns") @Consumes("application/x-www-form-urlencoded") public jakarta.ws.rs.core.Response setColumnsUrlEncoded(@FormParam("username") String username, @FormParam("columns") List<String> fields) Sets the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.- Parameters:
username- usernamefields- list of column ids- Returns:
- jakarta.ws.rs.core.Response containing basic message and http return code
- Since:
- v6.1
-
setColumns
@PUT @Path("columns") @Consumes("application/json") public jakarta.ws.rs.core.Response setColumns(ColumnsBean columns) Sets the default columns for the currently logged in user.- Parameters:
columns- list of column ids- Returns:
- jakarta.ws.rs.core.Response containing basic message and http return code
- Since:
- v6.1
-
resetColumns
@DELETE @Path("columns") @Consumes("*/*") public jakarta.ws.rs.core.Response resetColumns(@QueryParam("username") String username) Reset the default columns for the given user to the system default. Admin permission will be required to get columns for a user other than the currently logged in user.- Parameters:
username- username- Returns:
- jakarta.ws.rs.core.Response containing basic message and http return code
- Since:
- v6.1
-
addUserToApplication
@POST @ExperimentalApi @Path("application") public jakarta.ws.rs.core.Response addUserToApplication(@QueryParam("username") String username, @QueryParam("applicationKey") String applicationKey) Add user to given application. Admin permission will be required to perform this operation.- Parameters:
username- usernameapplicationKey- application key- Returns:
- jakarta.ws.rs.core.Response containing basic message http return code
- Since:
- v7.0
-
removeUserFromApplication
@DELETE @ExperimentalApi @Path("application") public jakarta.ws.rs.core.Response removeUserFromApplication(@QueryParam("username") String username, @QueryParam("applicationKey") String applicationKey) Remove user from given application. Admin permission will be required to perform this operation.- Parameters:
username- usernameapplicationKey- application key- Returns:
- jakarta.ws.rs.core.Response containing basic message http return code
- Since:
- v7.0
-