Limit process transformation through components and operators [ScriptRunner]

arno
Contributor
June 14, 2024

Hi All

    We hope to detect whether the operator has permission conversion issue by judging the compoent information and the group to which the user belongs

   When component is test, currentuser belongs to the test group and can convert issue. When component is not test, anyone can convert issue.

  I set up a simple validator, but I found that it does not meet my effect, it can only work in one of the cases, can you tell me what the problem is, my code is as follows:


 

import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def name = currentUser.name

def component = issue.components
def com = component.getAt('name')
def a = ( ComponentAccessor.getGroupManager().getGroupsForUser(name)?.find { it.name == "test" } )
if (['test','test1' in com ]){
   a != null
}

At this point my component is text and a == null, but I can't convert the flow

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events