Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How I can change the security leves in a issue? by groovy cloud

Eduard Diez
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.
August 31, 2020

Hey community

 

I've a problem, In my listener I need to change the selector when the user change a field.

In theory is easy when in a regular field, but in this case I need to change the field security level.

 

I've 3 levels in my security and I want to change depending of the user, 

With this I can get the tree levels:

 

def result2 = get('/rest/api/3/issuesecurityschemes/10000/')
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header('Content-Type', 'application/json')
.asObject(Map)

 

But now I need  change the level in the issue.

Can you help me?

Thank's

1 answer

0 votes
Kirkie
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.
August 31, 2020

Changing the security level based on user is quite simple,

just get the field option id for the security levels and set it like this:

import com.atlassian.jira.ComponentManager   
 
  ComponentManager componentManager = ComponentManager.getInstance()  
  User currentUser = componentManager.getJiraAuthenticationContext().getUser()
    
 if(currentUser.name == "akirk")
    {
    issue.setSecurityLevelId(10001)  
    }
  else if(currentUser.name == "jojo")  
    {
  issue.setSecurityLevelId(10000)  
    }
Eduard Diez
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.
August 31, 2020

Thanbk's @Kirkie but my JIRA is cloud.

 

Can you help me?

Thank's

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events