Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Setting issue security level based on user group

Bhushan Nagaraj
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.
January 10, 2013

We have two user groups : RESTRICTED and UNRESTRICTED

We have two possible security levels for an issue : Restricted and Unrestricted

When an issue is created, can we set the security level based on the group that the person creating the issue belongs to?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Mizan
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.
January 10, 2013

I do something similar using a groovy postfunction .

def secLevelString = "Restricted"  
     
    ComponentManager componentManager = ComponentManager.getInstance()  
    IssueSecurityLevelManager securityLevelManager = componentManager.getComponentInstanceOfType(com.atlassian.jira.issue.security.IssueSecurityLevelManager)  
    IssueSecuritySchemeManager issueSecuritySchemeManager = ManagerFactory.getIssueSecuritySchemeManager()  
    IssueSecurityLevelManager issueSecurityLevelManager = ManagerFactory.getIssueSecurityLevelManager()
	
    GenericValue srcProjectGV = issue.getProject()  

    def issueSecurityScheme = issueSecuritySchemeManager.getSchemes(srcProjectGV).size() == 0 ? null : issueSecuritySchemeManager.getSchemes(srcProjectGV)[0]  
 	def secLevelGv=securityLevelManager.getSchemeIssueSecurityLevels(issueSecurityScheme.id).find ({it.get("name")==secLevelString})
    //log.error (secLevelGv)

    User currentUser = componentManager.getJiraAuthenticationContext().getUser()
    if(componentManager.getCrowdService().isUserMemberOfGroup(currentUser.getName(),"Restricted")) {    		
    if (secLevelGv) {  
        issue.setSecurityLevel(secLevelGv) 
		
    }  
    else {  
        log.error ("Could not find security level for $secLevelString")  
    }  
  }
  issue.store();

The default securirty level will be unrestricted .

0 votes
Jobin Kuruvilla [Adaptavist]
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.
January 10, 2013

If you make the field mandatory, users will be forced to select one. And they will be able to see only the security level where they are a member of!

Only other option will be javascript hacks I guess...

Renjith Pillai
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.
January 10, 2013

Not possible using script runner as a post function?

Bhushan Nagaraj
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.
January 10, 2013

I am guessing the only clean way of doing it is to set the default security level to "Unrestricted" but also provide the option to set security level during creation of the issue.

This way, users in the UNRESTRICTED group have the option of setting the security level. But if any users in the RESTRICTED group creates an issue, it is set to Unrestricted by default.

Bhushan Nagaraj
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.
January 10, 2013

Hi Jobin,

Thanks for your response.

Here is the catch. Only users in the UNRESTRICTED group have permission to "Set security level".

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2013

Or find/write a post-function that can do it.

TAGS
AUG Leaders

Atlassian Community Events