findUsersWithAllPermissions method

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

Returns a list of users who fulfill these criteria:

  • their user attributes match a search string.
  • they have a set of permissions for a project or issue.

If no search string is provided, a list of all users with the permissions is returned.

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 for the project or issue. 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 for the project or issue, 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:

Implementation

Future<List<User>> findUsersWithAllPermissions(
    {String? query,
    String? username,
    String? accountId,
    required String permissions,
    String? issueKey,
    String? projectKey,
    int? startAt,
    int? maxResults}) async {
  return (await _client.send(
    'get',
    'rest/api/3/user/permission/search',
    queryParameters: {
      if (query != null) 'query': query,
      if (username != null) 'username': username,
      if (accountId != null) 'accountId': accountId,
      'permissions': permissions,
      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();
}