I am looking at migrating around 75 Projects from an existing Permission scheme into a new Permission scheme. Is there any way to change them in a bulk operation rather than going into each existing project & changing the permission scheme it is associated with?
@Zachary SinghWe have suggestion such as this register to Atlassian so for now you can't do it base on the API. https://jira.atlassian.com/browse/JRACLOUD-37941
but you can try to use this plugin i believe is possible
https://bobswift.atlassian.net/wiki/spaces/JCLI/pages/91881524/Documentation#Documentation-updateProject
I don't have the exact query using this plugin yet.
Best!
@Zachary Singh Did you resolve the issue? If yes, please help me out how to do it, I was in the same boat.
@niranjan I wasn't able to do so with the plugin provide, so I ended up manually doing so.
@Zachary Singh @niranjan anyone please help here if it can be done using REST call ?
@Narendra Kumar
Just wanted to say a big thank you for your script. I just moved 400+ projects to a different permission scheme in about 30mins. This would have taken me hours if I had to do it manually one by one.
Thank you!!
Hi @Hoc
It will be great if you share complete script for this.
Thanks in advance.
Hi @Amar Ghag
The script was already provided by Narendra Kumar above.
Thanks!
I have tried that script but its throws me an error "Cannot find matching method".
Using below script in console:
import java.util.ArrayListimport groovy.lang.Closureimport java.lang.String
ArrayList<String> allProjectKeys = new ArrayList<String>();Arrays.asList('A','B');for( projKey in allProjectKeys)
{def result2 = put('/rest/api/2/project/'+ projKey +'/permissionscheme').header('Content-Type', 'application/json').body([id::12302]).asString()}
Error :
------------------------------------------------------------------
Here is the working code, folks!! It perfectly works.*Just copy and paste* in your Script Runner's Script Console. Replace the below Project keys with your list (you can put up to *50 Project keys in one go*.. it processed first 50 keys, when I added 75 keys) and replace the Target Permission Scheme name.====================
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.project.Project
def list = ["Proj Key 1", "Proj Key 2", "Proj Key 3", "Proj Key 4"]
for(item in list){def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey(item)
log.warn("Project is:"+project)
String permissionScheme = "Target Permission Scheme"
ComponentAccessor.getPermissionSchemeManager().removeSchemesFromProject(project)ComponentAccessor.getPermissionSchemeManager().addSchemeToProject(project, ComponentAccessor.getPermissionSchemeManager().getSchemeObject(permissionScheme))}
This really works with latest script runner plugin as well. Is there a way we can pass .txt file in the def list. ?
I know this is an old post, but any idea how to update this for cloud?
When I past this in the ScriptRunner console, there is an error message:
"Invalid Imports
It looks like you're trying to import some Java classes intended to work with Jira Server. Unfortunately these won't work due to the differences between Jira Cloud and Jira Server.
ScriptRunner for Jira Cloud is designed to be used with the Jira Cloud REST APIs."
Sorry, but I don't have the knowledge to know how to fix this.
It looks like you're new here. Sign in or register to get started.