There is a standard way to check using a group in all permission schemes. But is there a way to check using a group in all projects' roles?
Try this Groovy script using script console
import com.atlassian.jira.bc.projectroles.ProjectRoleService; import com.atlassian.jira.component.ComponentAccessor; 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.security.roles.ProjectRoleManager; import com.atlassian.jira.security.roles.RoleActor; StringBuilder output = new StringBuilder(); ProjectManager projectManager = ComponentAccessor.getProjectManager(); ProjectRoleService projectRoleService = (ProjectRoleService) ComponentAccessor.getComponentOfType(ProjectRoleService.class); ProjectRoleManager projectRoleManager = (ProjectRoleManager) ComponentAccessor.getComponentOfType(ProjectRoleManager.class); final Collection<ProjectRole> projectRoles = projectRoleManager.getProjectRoles(); for(Project project : projectManager.getProjectObjects()) { for(ProjectRole projectRole: projectRoles) { final ProjectRoleActors projectRoleActors = projectRoleManager.getProjectRoleActors(projectRole, project); for (RoleActor actor : projectRoleActors.getRoleActors()) { if(actor.getDescriptor().equals("TheGroupNameYouLookingFor")){ output.append(project.getKey()).append(" : ").append(projectRole.getName()).append(" : ").append(actor.getDescriptor()).append("\n"); } } } } return output.toString();
Hi Renjith,
Thank you very much!
I hope this ready feature will be added to the next JIRA version.
BR,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Renjith,
Can you guide me a solution to get projectId in "projectroleactor" table ?
if I debug to method bellow then I can see projectId but I can't get projectId.
for (RoleActor actor : projectRoleActors.getRoleActors()) {
// something
}
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A workaround would be to find a user that is part of that role, go to the View Project Roles and then Edit Project Roles for User and it will show if a group is mapping that user to a project role and will name the group.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Renjith Pillai ,
Getting error as below (also in screenshot), while running in Scriptrunner Console
startup failed: Script991.groovy: 15: unexpected token: Collection @ line 15, column 7. final Collection<ProjectRole> projectRoles = projectRoleManager.getProjectRoles(); ^ 1 error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script991.groovy: 15: unexpected token: Collection @ line 15, column 7. final Collection<ProjectRole> projectRoles = projectRoleManager.getProjectRoles(); ^ 1 error
Any thoughts ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
Currently, it is not possible to check a group has specific project roles in all projects. You can raise a new feature request for this at https://jira.atlassian.com and vote for it. In order to be implemented, it must meet certain levels according to our Implementation of new features policy.
Best Regards,
Steven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.