Confluence - Identifying all the Space Administrators

Mirek Community Champion Nov 28, 2012

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

3 answers

1 accepted

1 vote
Answer accepted
Mirek Community Champion Mar 27, 2013

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())

<h2>List of all space administrators</h2>  

#foreach($s in $spaceList)

   #if( $s.isPersonal() )
   #else  

    <ac:macro ac:name="expand">
    <ac:default-parameter>$s.getName()</ac:default-parameter>
   
    <ac:rich-text-body>

    <br />     
    <table>
    <tr>
      <th>Space Administrators $s.getKey()</th>
    </tr>
    #foreach($u in $spaceManager.getSpaceAdmins($s))
    <tr>
      <td>#usernameLink($u.name)</td>
    </tr>
    #end
   </table>
   <br /> 

   </ac:rich-text-body>
   </ac:macro>

    #end
#end
</ul>

Best Regards,

Mirek

Mirek Community Champion Nov 29, 2012

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

Like 1 person likes this

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>

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,634 views 4 13
Read article

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