Hi,
Would anybody know how I can get a list of space adminstrators and the space they administrate.
Does anybody know of a SQL query or macro plugin.
Why I need is this information so I can supply the helpdesk so they can supply the user who to contact concerning access to the required space.
So you have any ideas it would be great to hear from you. :-)
Many Thanks
Regards
Jaime
You can add a user macro through Confluence Admin > User Macros and add the following template:
## This is an example macro ## @param Test:title=Test|type=string #set($spaces = $spaceManager.getAllSpaces()) #foreach($space in $spaces) <h3>Space Name: $space.getName()</h3> <table class="confluenceTable"> #foreach ( $permission in $space.getPermissions() ) #if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS") <tr> <td class="confluenceTd">User</td> <td class="confluenceTd">$permission.getUserName()</td> </tr> #elseif ($permission.isGroupPermission() && $permission.getType() == "SETSPACEPERMISSIONS") #set ( $group = $permission.getGroup() ) <tr> <td class="confluenceTd">Group</td> <td class="confluenceTd">$group</td> </tr> #end #end </table> #end
I know this is old, but i found a more streamlined approach to this which will only return the non-personal spaces and only list the administrators in a table. Also the solution provided by the KB article causes massive performance issues even on small to medium sized confluence instances. My solution runs in seconds compared to 30 minutes for the KB solution.
Here is my user macro:
## 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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.