getAllProjectRoles method

Future<List<ProjectRole>> getAllProjectRoles()

Gets a list of all project roles, complete with project role details and default actors.

About project roles

Project roles are a flexible way to to associate users and groups with projects. In Jira Cloud, the list of project roles is shared globally with all projects, but each project can have a different set of actors associated with it (unlike groups, which have the same membership throughout all Jira applications).

Project roles are used in permission schemes, email notification schemes, issue security levels, comment visibility, and workflow conditions.

Members and actors

In the Jira REST API, a member of a project role is called an actor. An actor is a group or user associated with a project role.

Actors may be set as default members of the project role or set at the project level:

  • Default actors: Users and groups that are assigned to the project role for all newly created projects. The default actors can be removed at the project level later if desired.
  • Actors: Users and groups that are associated with a project role for a project, which may differ from the default actors. This enables you to assign a user to different roles in different projects.

Permissions required: Administer Jira global permission.

Implementation

Future<List<ProjectRole>> getAllProjectRoles() async {
  return (await _client.send(
    'get',
    'rest/api/3/role',
  ) as List<Object?>)
      .map(
          (i) => ProjectRole.fromJson(i as Map<String, Object?>? ?? const {}))
      .toList();
}