Confluence Space Admins List

Is there any macro which shows the list of all spaces with respecive admins?

1 answer

Its done. I had written a small macro to fetch the required data.

How did you do this? I was looking for the same thing: a macro that would list the spaces but also admins.

## Macro title: Space Administrators

## Macro has a body: Y or N (N)

## Body processing: Selected body processing option

## Output: Selected output option

##

## Developed by: Srinivas Patruni

## Date created: 28/04/2012

## Installed by: <your name>

## Macro to list all users and groups with the permission to administer the current space.

## @noparams

#set($containerManagerClass=$action.class.forName('com.atlassian.spring.container.ContainerManager'))

#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))

#set($containerManager=$getInstanceMethod.invoke(null,null))

#set($containerContext=$containerManager.containerContext)

## the spaceManager gives you access to the spaces

#set($spaceManager =$containerContext.getComponent('spaceManager'))

<h1>Pages Count</h1>

<table class="confluenceTable">

<tr>

<th class="confluenceTh">Space Name</th>

<th class="confluenceTh">Administrators</th>

<th class="confluenceTh">Count</th>

</tr>

#foreach($sp in $spaceManager.getAllSpaces())

#if($sp.isGlobal())

<tr><td>

<a href="/display/$sp.getKey()">$sp.getName()</a>

</td>

<td class="confluenceTd">

#foreach ($permission in $sp.getPermissions())

#if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")

#usernameLink($permission.getUserName())

#end

#end

</td>

<td>

$spaceManager.findPageTotal($sp)

</td>

</tr>

#end

#end

</table>

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,821 views 27 11
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