I have a Jira User Group called "Jira Business Users"
I need a SQL query to find all Jira projects with that specific User Group assigned to it.
If you can tell me what db or table to query that would be a big help too :)
Hi @Judah
First of all I would say you don't really need to query your database for doing these things.
Groups are not directly associated with projects. Here are some relations.
Take a look at the database schema but using Java API will be much more convenient. Use ScriptRunner for Jira if you already have it or evaluate it. You will find plenty of scripts in the library and also here on the community.
I hope it helps.
Ravi
Well that is great news! For a little more clarification:
In the Users and Roles section of a given Project I can see a list of Users and their roles.
Some of these users are actual a User Group. Is their anyway I can see all of the Projects in which a specific group appears?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ravi Sagar _Sparxsys_ Here is my script.
It is working to return all Projects in which <user> has Administrator Role.
Can we change this so it returns all Projects in which <mygroup> has Administrator role?
import com.atlassian.jira.bc.projectroles.ProjectRoleService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleActor
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.util.SimpleErrorCollection
def groupManager = ComponentAccessor.getGroupManager()
def projectManager = ComponentAccessor.getProjectManager()
def projectRoleService = ComponentAccessor.getComponent(ProjectRoleService)
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def errorCollection = new SimpleErrorCollection()
// Fetch project role object by name
def projectRole = projectRoleManager.getProjectRole("Administrators")
// Fetch group (case insensitive)
def mygroup = groupManager.getGroup("Jira Business PMO Management")
// Myself as user
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def allProjects = projectManager.getProjects()
def adminProjects = []
allProjects.each{
// If I try to pass <mygroup> in place of <user> on the line below I get an error
def projectRoles = projectRoleManager.getProjectRoles(user, it)
if(projectRoles.find(){it.getName() == "Administrators"}){
adminProjects.push(it.key)
}
}
return (adminProjects)
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.