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
withBROWSE_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!