SQL Query to return which Projects a user is explicitly listed in

Good afternoon

I am looking for a bit of help to write a SQL query which will return which JIRA projects a user is explicitly listed in within Roles.

Any help would be appreciated :) 

2 answers

1 accepted

0 vote

Hi Helen,

There is a KB for this over in How to get a list of users assigned to project roles for your project.  I believe you can use the SQL query of:

SELECT p.pname, pr.NAME, u.display_name 
FROM projectroleactor pra
INNER JOIN projectrole pr ON pr.ID = pra.PROJECTROLEID
INNER JOIN project p ON p.ID = pra.PID
INNER JOIN app_user au ON au.lower_user_name = pra.ROLETYPEPARAMETER
INNER JOIN cwd_user u ON u.user_name = au.user_key;

in order to retun all the usernames that have been explicitly assigned a role in a project in JIRA.   In my own testing this does not include groups that have been assigned to a role that users might be a member of, so I think this should be able to provide you with a list of the explicit user accounts added to specific project roles.

Good morning @Andrew Heinzer

You're absolutely right. I found the KB article not long after posting this but forgot to update to say i'd found it.

The SQL works perfectly, I did a bit of an addition at the end to search for a key word within the account name and it did exactly what I wanted it to do.

Thank you for coming back to me, it's very much appreciated :)

Hi,
I'm using the query above (from the confluence link), but I've found a couple scenarios where active users assigned a project role aren't showing in the query results. Other users in the same project / project role are showing in the query results.
Out of 3,000 users, I know of 2 users who aren't in the output of this query. I'm not sure how many other users are missing in the output.
Has anybody else run into this issue?
Thanks!
Bridy

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Service Desk

Wy are we still using email for Service Desk workflows?

...attest to the experience of an urgent approval that gets lost in the boss’s inbox and requires that special “Please Approve” email or text message. In an age where we have distributed teams...

111 views 0 2
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you