Get all People entries for user

Looking to grab all Jira user-level “People” associations for a single user. Should return assigned roles for all projects, ignoring groups they may be a member of (only need atlassian-user-role-actor types). I also need the full project name, not just the key. This will be running in a ScriptRunner Confluence macro.

Here is what I have/am thinking of:

  • Depending on macro parameters input by user, convert email to Atlassian Id using /rest/api/3/user/search.
  • Use /rest/api/3/permissions/project with BROWSE_PROJECTS to get list of user projects.
  • Loop over /rest/api/3/project/{projectIdOrKey}/role/{id} for each user project and each project role, collecting their role(s) for each project.
    • This will return the project name, which I also need.

There are 107 projects and 3 roles. This means I will need up to 322 API calls (323, if I need to translate email to account id).

This is horrible. There has to be a better way!

The Web UI does a version of this here: https://<site>.atlassian.net/secure/admin/roles/ViewUserProjectRoles.jspa?accountId=<accountId>

Still can’t find a public API to do similar.

Was never able to find a similar API to the web call that is available. Decided to simply link out to the native page from my macro for the Jira perms and only worried about listing Confluence perms in my macro.

Not ideal - would rather have all perms listed on same page in the macro, but it gets the job done.