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?
Community moderators have prevented the ability to post new answers.
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 .
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not possible using script runner as a post function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jobin,
Thanks for your response.
Here is the catch. Only users in the UNRESTRICTED group have permission to "Set security level".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or find/write a post-function that can do it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.