Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Retrieve list of projects for particular user with BROWSE permission (API/SQL)

I can't find proper methods even combining more than one in https://docs.atlassian.com/software/jira/docs/api/REST/latest/

Or maybe there is an equivalent SQL query to get this information.

1 answer

0 votes
Andy Heinzer Atlassian Team Jan 23, 2020

Hi,

If I understand your request, you are using Jira Server and you want to be able to see all the projects that a user has the browse permission on.  In this case, this is something you can lookup via the REST API. Specifically you can use the endpoint GET /rest/api/2/project.  This endpoint is permissions based, so it only returns projects that the user making the REST API call has access to:

Returns all projects which are visible for the currently logged in user. If no user is logged in, it returns the list of projects that are visible when using anonymous access.

It might also be possible to find this information via SQL, but I would imagine the query might be somewhat complicated to write up given the different ways permissions can be assigned in Jira (to user, to a group, or to a project role).

I hope this helps.

Andy

It would be great if I could add a username parameter to this method (e.g. GET /rest/api/2/project?username=administrator) because I need to filter this information to build an external tool. But this is not available. Any alternatives?

Andy Heinzer Atlassian Team Jan 27, 2020

Ah, I see what you are getting at now.  However there is not a single REST API endpoint in Jira Server today that can return this information.  You could potentially use the endpoint GET /rest/api/2/user/viewissue/search. This endpoint can search for a supplied username's browse permissions, but you have to supply it with either an issuekey or a project key when doing so.

So perhaps if you can get together a list of all the project keys, perhaps by doing a GET /rest/api/2/project first, and then say build some kind of script (i think perl or python could do this, but I'm not well versed in the exact syntax here) to make calls to the GET /rest/api/2/user/viewissue/search endpoint with the same username, and changing the project key for each call to see if it can build you a complete list.  

It would return a lot of json if you have a lot of projects, but it seems like this could get you back the results I think you want to see here.

Like Bartosz Kaczyński likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you