Jira issue visibility by status

Agile Board Visibiliy

We utilize myGroovy, a great and free Jira add-on. Also, we make use of built-in Security Schemes.

Add this code as a post function. It will create the needed security levels based on values in the cascading custom field. And, it applies this new level to the current issue. You will figure it out.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.security.IssueSecurityLevelManager
import com.atlassian.jira.issue.security.IssueSecuritySchemeManager
import com.atlassian.jira.scheme.SchemeEntity
import com.atlassian.jira.scheme.Scheme
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.type.EventDispatchOption
 
// Cascading Custom Field
 
def cfFacility = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10300)
def cfFacilityValues = issue.getCustomFieldValue(cfFacility) as Map
 
String groupString = "facility-recipients-group-"
groupString += ((String)cfFacilityValues?.get(null)) + "-" + ((String)cfFacilityValues?.get("1"))
groupString = groupString.toLowerCase().replace(' ', '-')
 
// Security Scheme
 
def issueSecuritySchemeManager = ComponentAccessor.getComponent(IssueSecuritySchemeManager)
def issueSecurityLevelManager = ComponentAccessor.getComponent(IssueSecurityLevelManager)
 
def scheme = issueSecuritySchemeManager.getSchemeObjects().find { it.name == "Security Scheme Name" }
def gv = issueSecuritySchemeManager.getScheme(scheme.id)
 
def level = issueSecurityLevelManager.getIssueSecurityLevels(scheme.id).find { it.name == groupString }
if (!level) {
level = issueSecurityLevelManager.createIssueSecurityLevel(scheme.id, groupString, "Facility Group")
}
 
def entity = issueSecuritySchemeManager.getPermissionsBySecurityLevel(level.id).find {
it.getParameter() == groupString
}
if (!entity) {
entity = new SchemeEntity("group", groupString, level.id)
issueSecuritySchemeManager.createSchemeEntity(gv, entity)
}
 
entity = issueSecuritySchemeManager.getPermissionsBySecurityLevel(level.id).find {
it.getParameter() == "10300"
}
if (!entity) {
entity = new SchemeEntity("projectrole", "10300", level.id)
issueSecuritySchemeManager.createSchemeEntity(gv, entity)
}
 
// Update Issue
 
issue.setSecurityLevelId(level.id)
ComponentAccessor.issueManager.updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)

Email me for professional Atlassian support.