This article is for Data Center. Visit Cloud
List Structure Names and Permissions
import com.almworks.jira.structure.api.StructureComponents
import com.almworks.jira.structure.api.forest.ForestSpec
import com.almworks.jira.structure.api.permissions.PermissionLevel
import com.almworks.jira.structure.util.Util
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin('com.almworks.jira.structure')
StructureComponents structureComponents = ComponentAccessor.getOSGiComponentInstanceOfType(StructureComponents)
def structureManager = structureComponents.getStructureManager()
def structures = structureManager.getAllStructures(null)
def map = structures.collectEntries {
[(it.name + ' (#' + it.id + ')'): it.permissions]
}
'<table><tr><th>Structure Name (ID)</th><th>permissions</th></tr>' +
map.collect {'<tr><td>' + Util.htmlEncode(it.key as String) + '</td><td>' + it.value + '</td></tr>'}.join('') +
'</table>'