You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!

1

Show User Installed Confluence Apps

Overview

When working in Confluence, it is good to know which apps are installed and the functionality they provide. This script provides a macro to show a list of apps a user has installed on their instance and which macros they provide.

Example

I am a project manager preparing a report. I would like to see a complete list of all apps installed and their macros so I can use all available functionality to customize and enhance my report.

Additional Information

This script is designed to be used as a Confluence macro. You can read more information about creating custom macros in our custom macro documentation.

We have also created a script that you can use in a Confluence macro to show which apps are installed on your Jira instance.

Requirements

  • Confluence Confluence (6.6 - 6.15)
  • ScriptRunner for Confluence ScriptRunner for Confluence (6.21.0)
    
import com.atlassian.confluence.xhtml.api.XhtmlContent import com.atlassian.plugin.PluginAccessor import com.atlassian.plugin.PluginState import com.atlassian.plugin.metadata.PluginMetadataManager import com.atlassian.sal.api.component.ComponentLocator import groovy.xml.MarkupBuilder import groovyx.net.http.HTTPBuilder import groovyx.net.http.HttpResponseException import org.json.JSONObject // Plugin Manager and Accessor def pluginAccessor = ComponentLocator.getComponent(PluginAccessor) def pluginMetadata = ComponentLocator.getComponent(PluginMetadataManager) def plugins = pluginAccessor.plugins // HTTP Request to Marketplace def httpBuilder = new HTTPBuilder("https://marketplace.atlassian.com") // Content access def xhtmlContent = ComponentLocator.getComponent(XhtmlContent) def writer = new StringWriter() def builder = new MarkupBuilder(writer) builder.table { tbody { tr { th { p("App Name") } th { p("Vendor") } th { p("Installed Version") } th { p("Status") } th { p("License Type") } th { p("Expiry Date") } th { p("Marketplace Version") } th { p("Description") } } plugins.each { plugin -> if (pluginMetadata.isUserInstalled(plugin)) { def addonsData try { addonsData = httpBuilder.get( path: "/rest/latest/addons/${plugin.key}" ) as JSONObject } catch (HttpResponseException ex) { addonsData = new JSONObject("{}") } def latestVersionData try { latestVersionData = httpBuilder.get( path: "/rest/latest/addons/${plugin.key}/versions/latest" ) as JSONObject } catch (HttpResponseException ex) { latestVersionData = new JSONObject("{}") } tr { td { p(plugin.name) } td { p(plugin.pluginInformation.vendorName) } td { p(plugin.pluginInformation.version) } if (plugin.pluginState == PluginState.ENABLED) { td { p { "ac:emoticon"("ac:name": "tick") } } } else { td { p("") } } td { p("") } td { p("") } if (latestVersionData.has("name")) { td { p(latestVersionData["name"]) } } else { td { p("") } } if (addonsData.has("summary")) { td { p(addonsData["summary"]) } } else { td { p("") } } } } } } } xhtmlContent.convertStorageToView(writer.toString(), context)
Discovered an issue? Report it here

Suggested for you