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

This is related to <https://answers.atlassian.com/questions/16292>, 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.


Answers:
author: JamesT
body: 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")    &lt;b&gt;&lt;a href="$req.contextPath/display/$space.getKey()"&gt;$space.name&lt;/a&gt;: &lt;/b&gt;    #foreach ($permission in $space.getPermissions())      #if ($permission.getType() == "SETSPACEPERMISSIONS")        #set($permissionCount = $permissionCount + 1)        #if ($permissionCount == 1)          #set($sepchar="")        #else          #set($sepchar=" / ")        #end        #if($permission.isGroupPermission())            #set ( $memberList = $userAccessor.getMemberNamesAsList($userAccessor.getGroup($permission.getGroup())) )            #foreach ($member in $memberList)$!sepchar #usernameLink($member)              #set($sepchar=" / ")            #end        #end        #if ($permission.isUserPermission())$!sepchar #usernameLink($permission.getUserName())        #end       #end    #end    &lt;br&gt;&lt;br&gt;  #end#end
```


author: Jonathan Simonoff
body: 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.

```
&lt;p style='font-size:12px;color:gray'&gt; Administrators for this space:  #set($sepchar="") #foreach ($permission in $space.getPermissions())    #if ($permission.isUserPermission() &amp;&amp; $permission.getType() == "SETSPACEPERMISSIONS")$!sepchar #usernameLink($permission.getUserName())        #set($sepchar=",")    #end   #end&lt;/p&gt;
```

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


author: Jonathan Simonoff
body: 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.


Tags: confluence-administration

permission

space-administrator