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

  • 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 username
      key - user key
      includeDeleted - 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 is StreamPageRequest.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 address
      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.x
      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.
      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 address
      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.
      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 username
      projectKey - the key of the project we are finding assignable users for
      issueKey - 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

      @POST @ExperimentalApi public jakarta.ws.rs.core.Response createUser(UserWriteBean userBean)
      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 username
      key - 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 username
      key - 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 username
      key - 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 blank
      issueKey - 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 unspecified
      permissions - 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.x
      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.
      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 username
      projectKeysStr - the keys of the projects we are finding assignable users for, comma-separated
      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
    • 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 - username
      croppingInstructions - 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 - username
      filename - name of file being uploaded
      size - size of file
      request - 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 - Username
      request - 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 - username
      id - 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 - username
      fields - 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 - username
      applicationKey - 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 - username
      applicationKey - application key
      Returns:
      jakarta.ws.rs.core.Response containing basic message http return code
      Since:
      v7.0