Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Get Space Admins for all Confluence Spaces Using Macro

Hi community,

I'm new to macros on Confluence so forgive me!

I found this macro from the community site and I want to pull out only individuals who are named as space admins. I don't want to pull the groups out.

How would this be done?

Right now, it pulls out the space name, key and all the admins on the spaces. I'm just looking to either exclude the groups or just pick named individuals.

Here is the code:

## @noparams
#set($D = "$")
#set($P = "#")

#set($users = $userAccessor.getUsers())
#set($spaces = $spaceManager.getAllSpaces())

<div id="conf-space-lister"><ul><span id="conf-space-loading" class="aui-icon aui-icon-wait">Loading...</span></ul></div>
<div id="conf-spacetbl-lister">
<table class="confluenceTable tablesorter tablesorter-default stickyTableHeaders" role="grid" resolved="" style="padding: 0px;"><colgroup><col><col><col></colgroup>
</table>
</div>

<pre><script>
AJS.${D}('${P}conf-space-loading').remove()
AJS.${D}('${P}conf-spacetbl-lister table').append('<tr><td colspan="3"><p><b>Found ' + $spaces.size() + ' Spaces</b><br><br></p></td></tr>');

AJS.${D}('${P}conf-spacetbl-lister table').append('<tr role="row" class="tablesorter-headerRow"></th><th class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="0" tabindex="1" scope="col" role="columnheader" aria-disabled="false" unselectable="on" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort" style="user-select: none; min-width: 8px; max-width: none;"><div class="tablesorter-header-inner">Space Name</div></th><th class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="1" tabindex="2" scope="col" role="columnheader" aria-disabled="false" unselectable="on" aria-sort="none" aria-label="Value: No sort applied, activate to apply an ascending sort" style="user-select: none; min-width: 8px; max-width: none;"><div class="tablesorter-header-inner">Space Key</div></th><th class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="2" tabindex="3" scope="col" role="columnheader" aria-disabled="false" unselectable="on" aria-sort="none" aria-label="Value: No sort applied, activate to apply an ascending sort" style="user-select: none; min-width: 8px; max-width: none;"><div class="tablesorter-header-inner">Space Administrators</div></th></tr>');


#foreach($spacer in $spaces)
AJS.${D}('${P}conf-spacetbl-lister table').append('<tr><td class="confluenceTd"><a href="$spacer.getUrlPath()">$spacer.name</a></td><td class="confluenceTd">$spacer.key</td><td class="confluenceTd">#set($admins=$spaceManager.getSpaceAdmins($spacer)) #foreach($admin in $admins) $admin.name, #end</td></tr>');
#end

AJS.${D}('${P}conf-spacetbl-lister table').append('</tbody></table>');
</script></pre>

 Thanks in advance

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events