Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,836
Community Members
 
Community Events
168
Community Groups

How do I export the users and roles page within a project?

Hi guys, I'm currently in the processing of auditing my Jira database and would like to export the Users and Roles page for each of my current active projects.

Is there a feature I can use to do this? I've tried to see if there is an export available but am not finding anything useful.

Any help is hugely appreciated.

 

Many thanks,

Karan

3 answers

2 votes

@Karan Ponnuthurai @Joseph Hani 

One way that wasn't mentioned yet is the User export feature of Better Excel Exporter. With a single click, it exports your users, their statuses (inactive/active), last login, roles and many more attributes:

jira-user-export.png

Hello @Levente Szabo _Midori_ , 

I will take a look at this App, it can be really useful if it can also export all user and tell us in which AD group he is and in which project he is. 

Do you know if it can give the size of a project ? For example i'm looking for the total size of attachment in each project. 

I'm trying to code this but I know it would work only 1 project at a time. 

 

Thanks you for your help ! 

Regards, 

JH

Yes, it looks possible for a first glance by customizing the script behind the export template. You can find the documentation for customizing Excel reports here. Feel free to start a trial and open a support ticket with our technical support team if you have questions, they are ready to give you pointers. 

Have a similar task. Main part:

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;

final String projectRoleName = 'Testers' // use particular role, but can be redev to list or use all roles
final List<String> projectKeys = ['ABC', 'Project key(short name)']

ProjectManager projectManager = ComponentAccessor.getProjectManager()
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)

//gets all project roles
def projectRoles = projectRoleManager.getProjectRoles()
ProjectRole projectRole = projectRoleManager.getProjectRole(projectRoleName)

String result
projectKeys.each{ String projectKey ->
    Project project = projectManager.getProjectObjByKey(projectKey)
    if (project) {
        ProjectRoleActors actors = projectRoleManager.getProjectRoleActors(projectRole, project)
        actors.getRoleActors().each { result += "${it.getParameter()}, type:${it.getType()}\n" }
      //  result += "$project.key, $project.name, $project.leadUserKey, ${actors.getUsers()*.name}\n"
    }
}
return result
Hope it helps somebody
p.s. Use Scriptrunner console for execution
0 votes

Hi @Karan Ponnuthurai 

What kind of information related to users and roles do you want to export?

There are some export options.

  • In Jira natively you can export the issues to a csv.
  • You can also take full backup of your instance to an XML file, so not very specific to your requirements.
  • You can pull data from Jira using REST API.
  • If you have access to database then you can always query your db.

If you are looking for active users, active projects, user login information, where users are referred in issues, permissions or something similar on these lines then I would say ScriptRunner for Jira can be used to achieve this. For instance this script will give you list of inactive users, this is of course one example but there are lot of possibilities when you use ScriptRunner for Jira.

I hope it helps.

Ravi

Hi @Ravi Sagar _Sparxsys_ , thanks for getting back so promptly.

I'd essentially like to export the information in below pages such as in the screenshot below. The very minimum I would require is the name of the user/group and which role has been assigned.

If there's a plugin within JIRA that can be used that would be perfect, but if not, that's perfectly fine as well.

2021-09-28 17_04_07-Window.png

 

Thanks,

Karan

Like Ravi Sagar _Sparxsys_ likes this

Also, I have made couple of videos on this topic.

I hope it helps.

Ravi

Hey @Karan Ponnuthurai , 

Sorry to update your request, have you find any way to do it ? I have the exact same request :) 

 

I have found this solution, but maybe you have find another way, better one. 

https://community.atlassian.com/t5/Jira-questions/How-to-get-new-user-id-added-to-the-role-from/qaq-p/1590650

 

Let me know, 

Regards, 

JH

Suggest an answer

Log in or Sign up to answer