Hello, I wrote this macro to retrieve all spaces and display some usage information like number of pages and number of users. I need to use this information to "charge" people internally for how much they use confluence so we can pay for our licenses year to year. Small teams pay less than big team. This macro is working so far, but some teams have organized in such a way they created multiple spaces. I went throught the site and added a category to every site to group them. How do I retrieve this category in a user macro? I have searched for two days and found nothing. It appears it is a label so I have searched on that and found very little and can't get it to work. (I also found some about space groups and have no idea what that is)
Once I get a push in the right direction on getting either the "category" or label (or space group), I will rewrite the macro to group by the label, list respective spaces, pages, and users.
## @noparams
#set ( $allSpaces = $spaceManager.getAllSpaces() )
Hello, $action.remoteUser.getFullName(). <br />
There are $userAccessor.countUsersWithConfluenceAccess() total Confluence users. <br />
Below is a list of all confluence spaces and number of users per space: <br />
<table>
#foreach ($space in $allSpaces)
#if ($space.isGlobal() )
#set($userlist = [] )
#set($grouplist = [] )
<tr>
<td>#foreach ($label in $space.getLabels())
$label <br />
#end
</td>
<td>$space.getName()</td>
<td>$spaceManager.findPageTotal($space)</td>
#foreach ($permission in $space.getPermissions() )
#if ($permission.isUserPermission() && !$userlist.contains($permission.getUserSubject().getFullName()) )
#set ( $added = $userlist.add($permission.getUserSubject().getFullName()) )
#end
#if ($permission.isGroupPermission() && !$grouplist.contains($permission.getGroup()) )
#set( $added = $grouplist.add($permission.getGroup()) )
#set( $groupmembers = $userAccessor.getMemberNamesAsList($userAccessor.getGroup($permission.getGroup() ) ) )
#foreach ($member in $groupmembers)
#if (!$userlist.contains($member))
#set($added = $userlist.add($member))
#end
#end
#end
#end
<td>
$userlist.size()
#*
#foreach ($user in $userlist)
$user <br>
#end
*#
</td>
<td> #foreach ($adminuser in $spaceManager.getSpaceAdmins($space))
$adminuser.getFullName() <br>
#end
</td>
</tr>
#end
#end
</table>