Tim Preston
Tim Preston

Reputation: 108

SonarQube API: Retrieving a list of users assigned to a project permission?

I'm trying to find a list of users for a specific project (by projectKey) who possess the issueadmin permission. I've found a documented API that gets me pretty close:

api/permissions/search_project_permissions

but the response that I get back only has summary information: counts of groups/users for each permission type.

search_project_permissions response

Does anybody know if there's a way to get to the login details for the users?

Upvotes: 3

Views: 4301

Answers (3)

xxxvodnikxxx
xxxvodnikxxx

Reputation: 1277

just noticed in Sonarqube v6.7 it works as follows:

https://<SQserver>/api/permissions/users?projectKey=<KEY>
https://<SQserver>/api/permissions/users?projectKey=<KEY>&permission=issueadmin
https://<SQserver>/api/permissions/users?projectKey=<KEY>&permission=issueadmin&permission=scan

All possible permissions are (reg. Browse, See Source Code, Administer Issues, Administer and Execute Analysis):

  • admin
  • codeviewer
  • issueadmin
  • scan
  • user

Upvotes: 3

Kislow
Kislow

Reputation: 56

Those looking for UI to API Mapping:

[UI]Browse                       ==  [API]user
[UI]See Source Code              ==  [API]codeviewer
[UI]Administer Issues            ==  [API]issueadmin
[UI]Administer Security Hotspots ==  [API]securityhotspotadmin
[UI]Administer                   ==  [API]admin
[UI]Execute Analysis             ==  [API]scan

Upvotes: 0

G. Ann - SonarSource Team
G. Ann - SonarSource Team

Reputation: 22804

There is an "internal" web service (meaning it could change without notice!) that does this. You'll use it like so:

http://myserver.myco.com/api/permissions/users?projectId=[project guid]&permission=issueadmin

In Web API interface use the "Show Internal API" checkbox at the top of the left column to see it.

Upvotes: 5

Related Questions