List all space administrators

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 29, 2013

Hi,

We are upgrading a confluence instance, and we would like to send all space administrators a mail asking them to validate the result on the staging server.

I'm wondering if there is somewhere a simple macro / plugin which provides this functionality.

3 answers

1 accepted

0 votes
Answer accepted
fsim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 30, 2013

Hey Francis,


I found a way to get all space administrators for all spaces. Added it as a KB article here: https://confluence.atlassian.com/display/CONFKB/How+Do+I+View+a+List+of+All+Space+Administrators+for+All+Spaces

Modified the source from the link given by Diallo earlier. What I do notice though, is that the permissionHelper seems to be affected by this bug: https://jira.atlassian.com/browse/CONF-18104

Which means that the permission checks via Velocity might not be accurate (I noticed that it seems to only fetch users that are members of confluence-administrators, regardless of individual permissions set in the space's permissions).

Anyway, do give it a try!

Foogie

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 30, 2013

Hi,

Thanks for it - we tried that one but ran into a performance issue. Expect to brew some cans of coffee when you have like 4000 users, and 90 spaces.

Francis

4 votes
Adam Barylak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 26, 2017

Regarding the performance issues of the atlassian KB provided macro.  I re-wrote it to drastically improve the performance of the macro by only iterating through the spaces and only getting the distinct administrators from each space.  Below is my new macro code which i thought i should share so that others can benefit from this:

## 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>
David October 17, 2018

Hi Adam,

Thanks for this update. 

Is there a way to add the email address after the space admin name ?

Thanks,

DB

Claudio Maia October 17, 2019

@David Change the line of $admin.name to: 

<li>#usernameLink($admin.name) #if ($admin.email) (<a href="mailto:$admin.email">$admin.email</a>) #end</li>

Like David likes this
David October 17, 2019

Thank you very much !

John Smith January 12, 2020

Great update Adam - much appreciated (we also had the problem in prod which the macro was timing out and would essentially cause the page to break).

Sylvain Leduc February 1, 2021

Hello @Adam Barylak 

Unfortunately it did not work for me :

"Error: Rendering this content exceeded the timeout of 120 seconds."

Even if the (empty but this macro) page took like 10 min to load, with no results in the end.

Confluence server 6.1.3

0 votes
Abdoulaye Kindy Diallo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 29, 2013

I just came accross this discussion regarding this concern. Hope that helps.

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 29, 2013

That's cool. I need a distinct list of all space administrators in all spaces, but that's a small extention.

Thanks,

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events