Confluence - Identifying all the Space Administrators
Asked by Mirek:

Hi all,

I am wondering if there is a way (plugin/s, macro/s, .. ) that could help quickly identyfy all Space Administrators in Confluence instance..

I am aware that this could be done using some scripts, but I am looking more for a OOTB or easy solution that will give me a list on a Confluence page. (Information about administrators as a result need to be available for all users to quickly identify who is responsible for a specific space without asking global Confluence Admins) ..

Any ideas?

Thanks,

Mirek


Answers:
author: Mirek
body: Hi all,

I was able to create a simple user macro that resolve my problem. It is listing all non personal spaces that could be expanded to view current space administrators (excluding confluence administrators). It is working fine on smaller instances.. not sure how long it will render on larger one..

Maybe someone will want to use it also on his own instance, so I am pasting the source code. If you have any comments or suggestions/improvements add a comment or please let me know direcly

```
## Macro title: Space Administrators## Macro has a body: N## Body processing: Selected body processing option## Output: Selected output option#### Developed by: Mirek## Date created: 06/12/2012## Installed by: Mirek## Macro to display a list of user that are able to administer the current space.## @noparams#set($containerManagerClass = $content.class.forName('com.atlassian.spring.container.ContainerManager'))#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))#set($containerManager = $getInstanceMethod.invoke(null,null))#set($containerContext = $containerManager.containerContext)##set($users = $userAccessor.getUsers())#set($pageManager=$containerContext.getComponent('pageManager'))#set($spaceManager=$containerContext.getComponent('spaceManager'))#set($spaceList=$spaceManager.getAllSpaces())&lt;h2&gt;List of all space administrators&lt;/h2&gt;  #foreach($s in $spaceList)   #if( $s.isPersonal() )   #else      &lt;ac:macro ac:name="expand"&gt;    &lt;ac:default-parameter&gt;$s.getName()&lt;/ac:default-parameter&gt;       &lt;ac:rich-text-body&gt;    &lt;br /&gt;         &lt;table&gt;    &lt;tr&gt;      &lt;th&gt;Space Administrators $s.getKey()&lt;/th&gt;    &lt;/tr&gt;    #foreach($u in $spaceManager.getSpaceAdmins($s))    &lt;tr&gt;      &lt;td&gt;#usernameLink($u.name)&lt;/td&gt;    &lt;/tr&gt;    #end   &lt;/table&gt;   &lt;br /&gt;    &lt;/ac:rich-text-body&gt;   &lt;/ac:macro&gt;    #end#end&lt;/ul&gt;
```

Best Regards,

Mirek


author: Szymon Bartkowiak
body: I found only information about the macros [https://answers.atlassian.com/questions/43122/know-space-administrators](/questions/43122/know-space-administrators) \& <http://blog.networkedcollaboration.com/2012/03/22/confluence-list-space-administrators-user-macro/>

Hope one of the solution will help.

Cheers,

Szymon

comments: author: Mirek
body: Hi Szymon,

Thank you!

I have quickly tested those solutions but is not yet ideally what I am looking for.. Both solutions give ability to show administrators but in different ways. First is showing individual users and groups.. Second one all administrators that have this permission (including Confluence Space administrators) ..The problem is that I need to add this macro on a specific space to see who is an administrator. If a user want to contact admin because for example he do not have permissions to view the space then this information is useless for him.

Ideally I want to have a macro that will show on different space a list of all spaces including list of administrators that are not Confluence Admins.

Regards,

Mirek


author: Adam Barylak
body: Here is my macro to return all non-personal spaces as well as their administrators. It is optimized as much as i can at this time so that it doesn't take over my confluence instance like the solution provided at <https://confluence.atlassian.com/display/CONFKB/How+Do+I+View+a+List+of+All+Space+Administrators+for+All+Spaces>

This is a much more streamlined approach:

```
## Macro title: Space Administrators
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Andrew Frayling
## Modified by: Adam Barylak
## Date created: 21/03/2012
## Date modified: 7/23/2017
## Installed by: <your name>
## Macro to display a list of space administrators
## @noparams
#set($containerManagerClass = $content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)
#set($spaces = $spaceManager.getAllSpaces())
<table class="aui aui-table-interactive">
 <tr>
 <th class="confluenceTh">Space</th><th class="confluenceTh">Administrator(s)</th>
 </tr>
#foreach($spacer in $spaces)
 #if (!$spacer.isPersonal())
 <tr>
 <td class="confluenceTd"><a href="$req.contextPath/display/$spacer.key">$spacer.name</a></td><td class="confluenceTd"><ul>
 #set($administrators = $spaceManager.getSpaceAdmins($spacer))
 #foreach($admin in $administrators)
 <li>#usernameLink($admin.name)</li>
 #end
 </ul>
 </td>
 </tr>
 #end
#end
</table>
```


Tags: space-administrator