How to get all space permissions

Description

It is difficult for administrators to see space permissions across all spaces. This provides a view of all the space permissions.

Steps

  1. Make sure the Run CLI Actions in Confluence and Advanced Tables for Confluence are installed. This example uses Augments available in the Advanced Tables for Confluence add-on release 6.x and higher.
  2. Using the Cache Macro within the Cache for Confluence add-on is optional, but recommended if you have a large number of spaces as the retrieval can take time.
  3. Optionally, add  and  images to the page to replace true and false text for visual appeal.
  4. Configure a profile for the CLI macro to the Confluence system you want to query or provide alternative parameters. Replace the profile name in the example with your profile name or alternative parameters. 
  5. Create a page and insert the following wiki markup (Insert > Markup):

    All space permissions
    {cache:refresh=7d|showRefresh=true|showDate=true}
    {csv:output=wiki|macros=true
    |columns=Space, Space Name, Id Type, Id,6,7,9,10,11,12,13,14,15,16,17,18,19
    |augments=%SPACE%,,,,!%viewspace%.png!,!%editspace%.png!,!%setpagepermissions%.png!,!%removepage%.png!,!%editblog%.png!,!%removeblog%.png!,!%comment%.png!,!%removecomment%.png!,!%createattachment%.png!,!%removeattachment%.png!,!%removemail%.png!,!%exportspace%.png!,!%setspacepermissions%.png!
    |headingAugments=,,,,View,Page\\\\Add,Page\\\\Restrict,Page\\\\Delete,Blog\\\\Add,Blog\\\\Delete,Comment\\\\Add,Comment\\\\Delete,Attachment\\\\Add,Attachment\\\\Delete,Mail\\\\Delete,Space\\\\Export,Space\\\\Admin
    |columnTypes=S,S,S,S,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E}
    {cli:profile=confluence-local|panel=false}
    --action getSpacePermissionList --quiet
    {cli}
    {csv}
    {cache}

    Example Output

    This is a portion of the output generated from this Cloud site taken from another Confluence site (download version needed for add-ons).


Export page

Later versions of Confluence no longer support a separate exportpage permission (column 8) even though it is still output to the CSV file. Having view access to a page is enough to allow export. That column is excluded with this view.

Management

Here is an example CLI command for making global changes:

--action runFromSpaceList --common "-a addPermissions --space @space@ --group developers --permissions VIEWSPACE,EDITSPACE,EXPORTPAGE,SETPAGEPERMISSIONS,REMOVEPAGE,EDITBLOG,REMOVEBLOG,COMMENT,REMOVECOMMENT,CREATEATTACHMENT,REMOVEATTACHMENT,REMOVEMAIL,EXPORTSPACE"
 
or for a specific list of spaces
--action runFromList --list ACLI,BCLI --common "-a addPermissions --space @entry@ --group developers --permissions VIEWSPACE,EDITSPACE,EXPORTPAGE,SETPAGEPERMISSIONS,REMOVEPAGE,EDITBLOG,REMOVEBLOG,COMMENT,REMOVECOMMENT,CREATEATTACHMENT,REMOVEATTACHMENT,REMOVEMAIL,EXPORTSPACE"

Ensure your profile is working

Make sure your CLI profile is defined and works before attempting the example above. A simple test if your profile happens to be named confluence-local is:

{cli:profile=confluence-local|panel=false}
--action getServerInfo
{cli}