How to restrict cloning to only a certain group in a workflow?

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2023

I have a workflow property key that denies the ability to clone: "jira.permission.create.clone.denied" with property value as empty, and it works fine. So I know the syntax 'jira.permission.create.clone' works.

Now I need a certain group to have permission to clone on the same workflow. I have followed these references Atlassian document , Hide-ui-element-built-in-script , and Previous asked questions but none are working. I've created a group called "Clone Access" and added my name to test. I should be able to clone.

In the workflow property key, I've removed the old one and tried:

  • jira.permission.create.clone.group='Clone Access'
  • jira.permission.create.clone.group with 'Clone Access' as the property value

Then I tried creating a Project Role, also called 'Clone Access" and tried using:

  • jira.permission.create.clone.projectrole=10500
  • jira.permission.create.clone.projectrole with 10500 as the property value.

In the project's permission scheme, I have tried both the Clone Access (group and project role) allowed in Create Permission. But the workflow property does the opposite effect where I am denied the ability to clone, which is weird. Is there a way to allow cloning permission to only a certain group?

In addition, I have attempted to use ScriptRunner's Hide UI Fragments, but the code hides the clone button from all projects even when I put this under Conditions:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.crowd.embedded.api.Group

def loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def groupManager = ComponentAccessor.getGroupManager()
def cloneAccess = groupManager.getGroup("Clone Access")
def cloneAccessUsers = groupManager.getUserNamesInGroup(cloneAccess)

//since the module returns true for entire instance, need to make conditions so that only 1 project and 1 issue type is denied cloning with only the group
if(issue.projectObject?.key != 'ABC' && issue.issueType.name != 'Bug'){
return false
if(cloneAccessUsers.contains(loggedInUsers)){
return false
}
}

Any suggestions?

1 answer

1 accepted

1 vote
Answer accepted
Dave Mathijs
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2023

Hi @Diana Gorv 

Here's a reference to a KB article: How to restrict issue cloning in Jira

Basically, it says: "Jira doesn't have a Clone permission, only a Create permission."

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2023

@Dave Mathijs Thank you for the quick response!

Oh I see!

My final solution for future users with similar questions:

  1. Create a group, call it "Clone Access", add you users to grant access to clone/create
  2. On the project permission scheme, add "Clone Access" to Create Issues
  3. On your workflow, on all the status, add properties "jira.permission.create.group" and in the Property Key "Clone Access". Save workflow draft

 

One more question, does this workflow property key also affect with ScriptRunner's listener scripts? For example, if there is a listener script that auto-creates an issue if a custom field was selected on the parent issue, does the workflow property key take precedence over Scriptrunner's custom scripts? Meaning, unless the user was in the Clone Access group, the listener script will not function?

Suggest an answer

Log in or Sign up to answer