Is there a way to find the list of all the users who have access to a particular project

Hi

Could someone help me with a way / script / query wherein I can extract the list of all the users who have access to a particular Jira project. The project is currently using both Users and Groups in the Roles and Permissions

Regards,

Sateesh

6 answers

1 accepted

This widget could not be displayed.

Hi Sateesh

try this query in Database, projectroleactor will give you the list of users who have access on a particular project.

SELECT * FROM `projectroleactor`

where pid = 'XXX'

and projectroleid = 'yyy';

u can get the pid (project id) from the below table.

SELECT * FROM `project`;

projectroleid u can get from

select * from projectrole;

Regards

Sakthi

This widget could not be displayed.

First, you need to define what you mean by "access" to the project. The right to see issues in it? Be in one or more specific roles?

This widget could not be displayed.

Hi,

Look this link, it can give you what do you need.

https://answers.atlassian.com/questions/163400/does-jira-log-admin-s-changes

This widget could not be displayed.

Here is the groovy script to which shows all the users under Administrator role. Add code for required roles:

ProjectRoleService projectRoleService = (ProjectRoleService) ComponentAccessor.getComponentOfType(ProjectRoleService.class);
ProjectRoleManager projectRoleManager = (ProjectRoleManager) ComponentAccessor.getComponentOfType(ProjectRoleManager.class);
ProjectManager projectManager = ComponentAccessor.getProjectManager();

Project project = projectManager.getProjectObjByKey('<PROJECT KEY>')
ProjectRole administrator = projectRoleManager.getProjectRole("Administrators");

ErrorCollection ec = new SimpleErrorCollection();
ProjectRoleActors existingActors = projectRoleService.getProjectRoleActors(administrator,project,ec);
if (existingActors != null){
   Set<User> users = existingActors.getUsers();
   // Do your thing
}

return

This widget could not be displayed.

Here is the error I get.

javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script3.groovy: 1: unable to resolve class ProjectRoleService 
 @ line 1, column 20.
   ProjectRoleService projectRoleService = (ProjectRoleService) ComponentAccessor.getComponentOfType(ProjectRoleService.class);
                      ^

Script3.groovy: 1: unable to resolve class ProjectRoleService 
 @ line 1, column 41.
   eService projectRoleService = (ProjectRo
                                 ^

Script3.groovy: 2: unable to resolve class ProjectRoleManager 
 @ line 2, column 20.
   ProjectRoleManager projectRoleManager = (ProjectRoleManager) ComponentAccessor.getComponentOfType(ProjectRoleManager.class);
                      ^

Script3.groovy: 2: unable to resolve class ProjectRoleManager 
 @ line 2, column 41.
   eManager projectRoleManager = (ProjectRo
                                 ^

Script3.groovy: 3: unable to resolve class ProjectManager 
 @ line 3, column 16.
   ProjectManager projectManager = ComponentAccessor.getProjectManager();
                  ^

Script3.groovy: 5: unable to resolve class Project 
 @ line 5, column 9.
   Project project = projectManager.getProjectObjByKey('ASC')
           ^

Script3.groovy: 6: unable to resolve class ProjectRole 
 @ line 6, column 13.
   ProjectRole administrator = projectRoleManager.getProjectRole("Users");
               ^

Script3.groovy: 8: unable to resolve class ErrorCollection 
 @ line 8, column 17.
   ErrorCollection ec = new SimpleErrorCollection();
                   ^

Script3.groovy: 8: unable to resolve class SimpleErrorCollection 
 @ line 8, column 22.
   ErrorCollection ec = new SimpleErrorCollection();
                        ^

Script3.groovy: 9: unable to resolve class ProjectRoleActors 
 @ line 9, column 19.
   ProjectRoleActors existingActors = projectRoleService.getProjectRoleActors(administrator,project,ec);
                     ^

Script3.groovy: 11: unable to resolve class User 
 @ line 11, column 8.
      Set<User> users = existingActors.getUsers();
          ^

You need to include the required imports. Please read up on groovy scripting. Use these imports:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.projectroles.ProjectRoleService;
import com.atlassian.jira.security.roles.ProjectRoleManager;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager;
import com.atlassian.jira.security.roles.ProjectRole;
import com.atlassian.jira.security.roles.ProjectRoleActors;
import com.atlassian.jira.util.ErrorCollection;
import com.atlassian.jira.util.SimpleErrorCollection;

This widget could not be displayed.

Open permission scheme used for a project. Check to which(Users / Groups / Project Roles) have you provided "Browse Projects" permission.

Count them together.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

143 views 1 3
Join discussion

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