1. Home
  2. Docs
  3. Confluence
  4. Confluence User Macros
  5. Anonymous Permissions

Anonymous Permissions


This Confluence user macro lists all spaces with Anonymous permissions.

Use Case

Confluence allows to switch off public viewing. Anonymous users (not logged in) cannot view any content. However, the permission settings for “Anonymous” are still visible and changable for space admins. If the View permission is enabled for Anonymous in such a case, all members of the confluence-users group can view the space. That was not desired in my use case but I could not disable space admins from enabling anonymous permissions. I wrote this user macro to list all spaces where anonymous viewing was enabled so I could go there and disbale it again. The macro provides a direct link to the permissons page of those spaces.

Source Code

#* ============================================================================
* This Confluence user macro lists all spaces with Anonymous permissions.
* Version: 1.0.000
* Date: 2018-09-28
* Author: George Lewe
* Source: https://github.com/glewe/anonymous-permissions
* License: GNU LGPLv3
* Macro body: None

#* ----------------------------------------------------------------------------
## @noparams

#* ----------------------------------------------------------------------------

#* ----------------------------------------------------------------------------
<h1>Spaces with Aonymous Permissions</h1>
#foreach ($space in $spaceManager.getAllSpaces())
   #set ($anonymousPermission = false)
   #foreach ($perm in $space.getPermissions())
      #if ($perm.isAnonymousPermission())
         #set ($anonymousPermission = true)
   #if ($anonymousPermission == true) #end
<table class="confluenceTable">
         <th class="confluenceTh">Space Home</th>
         <th class="confluenceTh">Space Permissions</th>
         <td class="confluenceTd"><a href="/display/$space.key">$space.getName()</a></td>
         <td class="confluenceTd"><a href="/spaces/spacepermissions.action?key=$space.key">Space permissions...</a></td>
Was this article helpful to you? Yes No

Leave a Reply

Your email address will not be published. Required fields are marked *