How can a non-admin user tell who is the Space Admin for a Space to which the user does not have access?

This is related to, but there have been no satisfactory answers there for 3 1/2 years.

We have spaces which are restricted.  They are NOT open to anonymous access, nor are they open to general groups like "confluence-users".  When a non-authorized user accesses a Space like that, they get "You are not permitted to perform this operation", which isn't very helpful.  Then they email me (the Confluence Admin), and i need to look up the Space owner and ask  if the user can have access, RO or RW.

That's a big waste of time, for the users and for me!

How can I create an auto-updating page/macro/etc that lists all Spaces and who the Space Admins are?  I know I could create it manually, but I'd like to avoid having that maintenance too, if possible.

2 answers

1 accepted

0 votes
Accepted answer

Thanks to @Jonathan Simonoff for his suggestion.  That code was targeted at every page in a Space or the whole Site, and I just wanted a single page (accessible to ALL) that would list ALL Space Admins.  Using Jonathan's code and some more searching, I came up with this user macro which I instantiated on a globally-accessible page:


## @noparams
#set ($allSpaces = $spaceManager.getAllSpaces())
#foreach ($space in $allSpaces)
  #set($permissionCount = 0)
  #if($space.getSpaceType() == "global")
    <b><a href="$req.contextPath/display/$space.getKey()">$</a>: </b>
    #foreach ($permission in $space.getPermissions())
      #if ($permission.getType() == "SETSPACEPERMISSIONS")
        #set($permissionCount = $permissionCount + 1)
        #if ($permissionCount == 1)
          #set($sepchar=" / ")
            #set ( $memberList = $userAccessor.getMemberNamesAsList($userAccessor.getGroup($permission.getGroup())) )
            #foreach ($member in $memberList)
$!sepchar #usernameLink($member)
              #set($sepchar=" / ")
        #if ($permission.isUserPermission())
$!sepchar #usernameLink($permission.getUserName())

I added this to the bottom of the page layout, just before #GENERAL PAGE DECORATION ENDS.  This only works in spaces that use the default theme.

<p style='font-size:12px;color:gray'> Administrators for this space: 
 #foreach ($permission in $space.getPermissions())
    #if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
$!sepchar #usernameLink($permission.getUserName())

Sorry, newbie to wiki markup (but not HTML & CSS). Which menu sequence do I go thru to enter that?

Sorry -- that would need to be installed by an admin. Go to Layouts in the admin interface, and edit the page layout. You can do that on the individual space level or for the whole site, which is what we did. FYI -- that isn't wiki markup -- it is Velocity, the page layout language used in Confluence.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

972 views 50 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you