Clone group memberships to a new user from an existing user

Darren Shinkins August 14, 2016

We use groups heavily to manage our permission model. It is made up of groups to get access to our permissions schemes, and also to lock down transitions in some of our workflows.

 

Usually, when creating new users, they don't need that many groups to be added, but for some roles, it's necessary for us to add a large number of groups. While the level of control and visibility benefits us greatly, it can be very time consuming to create new users in those roles.

 

It would be perfect for us if there was a means of applying multiple groups to a new user quickly. If it were possible to copy group memberships to a new user from an existing one, that would work brilliantly. Even if I could enter a comma-separated list of groups into the Edit Groups form, that would work well enough for us.

 

Any ideas?

 

Thanks

1 answer

2 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2016

Hi Darren,

 

Currently, it's an open request - https://jira.atlassian.com/browse/CONF-22297

But I implemented something similar using a python script, which takes existing username and new username as input and adds the new user to all the groups same as the existing users. Crowd/JIRA have REST Apis thus it's easy to implement such functionality.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2016

Please see here - https://github.com/m4ce/crowd-api-python you can retrieve the details of a user and add his groups to a list and then map these groups to the new user. 

Darren Shinkins August 15, 2016

Thanks Tarun,

I'd spotted that suggestion earlier, but I thought it was more to do with moving users/groups between directories, rather than group memberships between users. Still probably worth a watch, though.

I'm not a huge scripting wizard (at the moment!) but I'll bear this idea in mind. I'll see what I can do with Python, or maybe see if I can wrap my head around @Adaptavist Script Runner to do it.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2016

The Adaptavist script runner isn't stand alone as far I know, but by python script I meant to have a stand alone script which will the the work for you. But yeah, you can user the script runner to have the groovy script in the post-function of the workflow of an issue. And for that issue have two fields , one having existing username and one having new username and then use a REST call to copy existing one's groups to new one, an example of rest call - https://answers.atlassian.com/questions/9875846

Suggest an answer

Log in or Sign up to answer