findUsersWithBrowsePermission method

Future<List<User>> findUsersWithBrowsePermission({
  1. String? query,
  2. String? username,
  3. String? accountId,
  4. String? issueKey,
  5. String? projectKey,
  6. int? startAt,
  7. int? maxResults,
})

Returns a list of users who fulfill these criteria:

  • their user attributes match a search string.
  • they have permission to browse issues.

Use this resource to find users who can browse:

  • an issue, by providing the issueKey.
  • any issue in a project, by providing the projectKey.

This operation takes the users in the range defined by startAt and maxResults, up to the thousandth user, and then returns only the users from that range that match the search string and have permission to browse issues. This means the operation usually returns fewer users than specified in maxResults. To get all the users who match the search string and have permission to browse issues, use Get all users and filter the records in your code.

Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the Profile visibility overview for more details.

This operation can be accessed anonymously.

Permissions required: Browse users and groups global permission. Anonymous calls and calls by users without the required permission return empty search results.

Implementation

Future<List<User>> findUsersWithBrowsePermission(
    {String? query,
    String? username,
    String? accountId,
    String? issueKey,
    String? projectKey,
    int? startAt,
    int? maxResults}) async {
  return (await _client.send(
    'get',
    'rest/api/3/user/viewissue/search',
    queryParameters: {
      if (query != null) 'query': query,
      if (username != null) 'username': username,
      if (accountId != null) 'accountId': accountId,
      if (issueKey != null) 'issueKey': issueKey,
      if (projectKey != null) 'projectKey': projectKey,
      if (startAt != null) 'startAt': '$startAt',
      if (maxResults != null) 'maxResults': '$maxResults',
    },
  ) as List<Object?>)
      .map((i) => User.fromJson(i as Map<String, Object?>? ?? const {}))
      .toList();
}