getMyPermissions method

Future<Permissions> getMyPermissions({
  1. String? projectKey,
  2. String? projectId,
  3. String? issueKey,
  4. String? issueId,
  5. String? permissions,
  6. String? projectUuid,
  7. String? projectConfigurationUuid,
  8. String? commentId,
})

Returns a list of permissions indicating which permissions the user has. Details of the user's permissions can be obtained in a global, project, issue or comment context.

The user is reported as having a project permission:

  • in the global context, if the user has the project permission in any project.
  • for a project, where the project permission is determined using issue data, if the user meets the permission's criteria for any issue in the project. Otherwise, if the user has the project permission in the project.
  • for an issue, where a project permission is determined using issue data, if the user has the permission in the issue. Otherwise, if the user has the project permission in the project containing the issue.
  • for a comment, where the user has both the permission to browse the comment and the project permission for the comment's parent issue. Only the BROWSE_PROJECTS permission is supported. If a commentId is provided whose permissions does not equal BROWSE_PROJECTS, a 400 error will be returned.

This means that users may be shown as having an issue permission (such as EDIT_ISSUES) in the global context or a project context but may not have the permission for any or all issues. For example, if Reporters have the EDIT_ISSUES permission a user would be shown as having this permission in the global context or the context of a project, because any user can be a reporter. However, if they are not the user who reported the issue queried they would not have EDIT_ISSUES permission for that issue.

Global permissions are unaffected by context.

This operation can be accessed anonymously.

Permissions required: None.

Implementation

Future<Permissions> getMyPermissions(
    {String? projectKey,
    String? projectId,
    String? issueKey,
    String? issueId,
    String? permissions,
    String? projectUuid,
    String? projectConfigurationUuid,
    String? commentId}) async {
  return Permissions.fromJson(await _client.send(
    'get',
    'rest/api/3/mypermissions',
    queryParameters: {
      if (projectKey != null) 'projectKey': projectKey,
      if (projectId != null) 'projectId': projectId,
      if (issueKey != null) 'issueKey': issueKey,
      if (issueId != null) 'issueId': issueId,
      if (permissions != null) 'permissions': permissions,
      if (projectUuid != null) 'projectUuid': projectUuid,
      if (projectConfigurationUuid != null)
        'projectConfigurationUuid': projectConfigurationUuid,
      if (commentId != null) 'commentId': commentId,
    },
  ));
}