CODE
import com.atlassian.jira.component.ComponentAccessor
def plugin = ComponentAccessor.pluginAccessor.getPlugin('com.almworks.jira.structure')
def loader = plugin.classLoader
def PermissionLevel = loader.loadClass('com.almworks.jira.structure.api.permissions.PermissionLevel')
def StructureAuth = loader.loadClass('com.almworks.jira.structure.api.auth.StructureAuth')
def structureComponents = plugin.getModuleDescriptor('structure-components').module
def structureManager = structureComponents.structureManager
StructureAuth.sudo {
def activeStructures = structureManager.getAllStructures(PermissionLevel.NONE, false)
def structuresToArchive = activeStructures.findAll { it.owner != null && !it.owner.isActive() }
structuresToArchive
}