How can I display a list of users of a space on a confluence page?
Asked by Klaus Blum:

I would like to display a list of users of a particular space on a page automatically based on the permissions of the users in that space so that the list updates automatically with the changing list of users on the permissions page?

So far I only see ways to manually add users of a space with some macros, but none of them doies this automatically.

Klaus


Answers:
author: Jan
body: I do not think this answers the original question. Listing all users having access to a specific space would be helpful, to reflect all users of that space on the space homepage or somewhere else. As only space admins can view the space permissions, this would be a great info for everybody contributing to that space.

Ideally this should be shown with profile pics in a contemporary way, as it is standard in many collaboration tools. **Any ideas for plugins or user macros?**

![members.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/24617iEFFE23F5DC3C85CD/image-dimensions/487x200?v=v2 "members.PNG")

We realized a list of all space members by user macro, but it does not look really nice as it is a table listing all admins, then users of the space , then groups. Groups can be dissolved which should be standard in a proper way to display all people haveing access.

<br />

## Macro has a body: Y or N (N)  
## Body processing: Selected body processing option  
## Output: Selected output option  
## Macro to list all users and groups with the permission to administer the current space.  
## [@Param](/t5/user/viewprofilepage/user-id/1345631) ShowUsers:title=List all users\|type=boolean\|desc=Show a list of all users who have access to the space\|default=true  
## [@Param](/t5/user/viewprofilepage/user-id/1345631) ShowGroups:title=List all groups\|type=boolean\|desc=Show a list of all groups who have access to the space\|default=true  
## [@Param](/t5/user/viewprofilepage/user-id/1345631) ListUsers:title=List all users inside a group\|type=boolean\|desc=Shows a list of all users inside the groups, instead of just the groups\|default=false  
\<h1\>Space Members\</h1\>  
\<p\>The following users and groups have permission to access the \<strong\>$space.getName()\</strong\> Space.\</p\>  
#if($paramShowUsers == true)  
\<h2\>Users\</h2\>  
\<table class="confluenceTable"\>  
\<tr\>  
\<th class="confluenceTh"\>Space Administrators\</th\>  
\</tr\>  
#foreach ($permission in $space.getPermissions())  
#if ($permission.isUserPermission() \&\& $permission.getType() == "SETSPACEPERMISSIONS")  
\<tr\>  
\<td class="confluenceTd"\>#usernameLink($permission.getUserName())\</td\>  
\</tr\>  
#end  
#end  
\</table\>  
\<table class="confluenceTable"\>  
\<tr\>  
\<th class="confluenceTh"\>Space Members\</th\>  
\</tr\>  
#foreach ($permission in $space.getPermissions())  
#if ($permission.isUserPermission() \&\& $permission.getType() == "VIEWSPACE")  
\<tr\>  
\<td class="confluenceTd"\>#usernameLink($permission.getUserName())\</td\>  
\</tr\>  
#end  
#end  
\</table\>  
#end  
#if($paramShowGroups == true)  
\<h2\>Groups\</h2\>  
#if($paramListUsers == true)  
#foreach ($permission in $space.getPermissions())  
#if ($permission.isGroupPermission() \&\& $permission.getType() == "SETSPACEPERMISSIONS")  
#set ( $groupString = $permission.getGroup() )  
#set ( $groupObject = $userAccessor.getGroup($groupString) )  
#set ( $memberList = $userAccessor.getMemberNamesAsList($groupObject) )  
\<h3\>$groupString\</h3\>  
\<table class="confluenceTable"\>  
\<tr\>  
\<th class="confluenceTh"\>Space Administrators\</th\>  
\</tr\>  
#foreach ($member in $memberList)  
\<tr\>  
\<td class="confluenceTd"\>#usernameLink($member)\</td\>  
\</tr\>  
#end  
\</table\>  
#end  
#end  
#foreach ($permission in $space.getPermissions())  
#if ($permission.isGroupPermission() \&\& $permission.getType() == "VIEWSPACE")  
#set ( $groupString = $permission.getGroup() )  
#set ( $groupObject = $userAccessor.getGroup($groupString) )  
#set ( $memberList = $userAccessor.getMemberNamesAsList($groupObject) )  
\<h3\>$groupString\</h3\>  
\<table class="confluenceTable"\>  
\<tr\>  
\<th class="confluenceTh"\>Space Members\</th\>  
\</tr\>  
#foreach ($member in $memberList)  
\<tr\>  
\<td class="confluenceTd"\>#usernameLink($member)\</td\>  
\</tr\>  
#end  
\</table\>  
#end  
#end  
#else  
#foreach ($permission in $space.getPermissions())  
#if ($permission.isGroupPermission() \&\& $permission.getType() == "SETSPACEPERMISSIONS")  
#set ( $groupString = $permission.getGroup() )  
#set ( $groupObject = $userAccessor.getGroup($groupString) )  
\<li\>$groupString\</li\>  
#end  
#end  
#foreach ($permission in $space.getPermissions())  
#if ($permission.isGroupPermission() \&\& $permission.getType() == "VIEWSPACE")  
#set ( $groupString = $permission.getGroup() )  
#set ( $groupObject = $userAccessor.getGroup($groupString) )  
\<li\>$groupString\</li\>  
#end  
#end  
#end  
#end

comments: author: Martin Boehme
body: [@Jan](/t5/user/viewprofilepage/user-id/680405),

That's exactly what I was looking for! And I think, it's also what [@Klaus Blum](/t5/user/viewprofilepage/user-id/544746) wants.

But it took me a while to get your user macro to work, since Atlassian Community automatically changed "param" to "Param" after the @ character. And "@ Param" (without space) does not work.  
Se here's your macro again, inside a code block. This should work well.

```
## Macro title: Show Space Permissions
##
## Body processing: No macro body
## Source: https://community.atlassian.com/t5/Confluence-questions/Re-How-can-I-display-a-list-of-users-of-a-space-on-a-con/qaq-p/821287/comment-id/110863#M110863

## @param ShowUsers:title=List all users|type=boolean|desc=Show a list of all users who have access to the space|default=true
## @param ShowGroups:title=List all groups|type=boolean|desc=Show a list of all groups who have access to the space|default=true
## @param ListUsers:title=List all users inside a group|type=boolean|desc=Shows a list of all users inside the groups, instead of just the groups|default=false

<h1>Space Members</h1>
<p>The following users and groups have permission to access the <strong>$space.getName()</strong> Space.</p>
#if($paramShowUsers == true)
<h2>Users</h2>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Space Administrators</th>
</tr>
#foreach ($permission in $space.getPermissions())
#if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
<tr>
<td class="confluenceTd">#usernameLink($permission.getUserName())</td>
</tr>
#end
#end
</table>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Space Members</th>
</tr>
#foreach ($permission in $space.getPermissions())
#if ($permission.isUserPermission() && $permission.getType() == "VIEWSPACE")
<tr>
<td class="confluenceTd">#usernameLink($permission.getUserName())</td>
</tr>
#end
#end
</table>
#end
#if($paramShowGroups == true)
<h2>Groups</h2>
#if($paramListUsers == true)
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
#set ( $memberList = $userAccessor.getMemberNamesAsList($groupObject) )
<h3>$groupString</h3>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Space Administrators</th>
</tr>
#foreach ($member in $memberList)
<tr>
<td class="confluenceTd">#usernameLink($member)</td>
</tr>
#end
</table>
#end
#end
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "VIEWSPACE")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
#set ( $memberList = $userAccessor.getMemberNamesAsList($groupObject) )
<h3>$groupString</h3>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Space Members</th>
</tr>
#foreach ($member in $memberList)
<tr>
<td class="confluenceTd">#usernameLink($member)</td>
</tr>
#end
</table>
#end
#end
#else
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
<li>$groupString</li>
#end
#end
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "VIEWSPACE")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
<li>$groupString</li>
#end
#end
#end
#end
```


author: Sven Wagner
body: Awesome, thank you for that macro! Since Confluence doesn't provide such a macro out of the box this is the only way to get space members who aren't member of any one the assigned groups.


author: Paul Gryfakis
body: This is a great macro! I'm hoping someone can help with a similar need. Can this macro be easily altered to accept a SPACE KEY parameter and report on that, regardless of where the macro is placed? Ideally the macro defaults to current space if no SPACE KEY is provided.


author: Rodney Hughes
body: Put page into Edit Mode

Click the \<\<+Insert\>\>

select "Other Macros"

choose the "User List" macro

configure the list for the selection of Permissions you need to display

:smile:

comments: author: Klaus Blum
body: Thank you Rodney, but all I can configure is to enter Group names into the parameter "Group(s) and wether a user is online or offline.

Can you please explain how to configure the list, that it lists all members of this workspace? (So all users that are listed under "permission" of that workspace?).

Thank you.

Klaus


author: Nicola Barton
body: Hi, did you find an answer to the question? I have the very same one :)

Thanks

Nicola


author: Kristin Bitler
body: This would be helpful.


author: Rodney Hughes
body: Have you read the Documentation?

When you have the macro editing pop up dialog box open, there is a link to "Documentation"

In that it says to get a list of all Users regardless of the Permissions Group enter "\*" in the selection box

Otherwise type in the name of the Permissions Group(s) you want to see


author: Kristin Bitler
body: That was where I started. Where is the selection box?

![Screen Shot 2018-04-23 at 1.32.06 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/20423iDA01DD294A7589FD/image-size/large?v=v2&px=999 "Screen Shot 2018-04-23 at 1.32.06 PM.png")![Screen Shot 2018-04-23 at 1.32.19 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/20424i1F881B9542B5BF59/image-size/large?v=v2&px=999 "Screen Shot 2018-04-23 at 1.32.19 PM.png")


author: Rodney Hughes
body: As I said in my original post, I am using the \<\<User List\>\> macro here is the documentation link

<https://confluence.atlassian.com/confcloud/user-list-macro-724765305.html>


author: Kristin Bitler
body: This works great for those members that we have set up in groups. However, we need to give permissions to those users who have permission to spaces. Much of the time this will work but there will be many times when it doesn't.

Thank you for the info but I think we're still looking for something that shows members of a space as opposed to a group.

Regards,

Kristin


author: Rodney Hughes
body: What happens if you put "\*" in the Groups field? I think that will show you all users in all Permissions grouping but I am not sure what it would do for Users who have access as Individual Permissions (must be a nightmare to manage?) rather than by having Group Permissions

Our host created a macro that does show the Users for that specific Space but we also manage access by granting a permissions group to each user so it is possible to create something


author: Kristin Bitler
body: We had more than the maximum so it wouldn't view. Which is fine, that's too unmanageable.

But it did help, so thank you. For what I need, I'll probably need to ask our dev team to develop something.


author: David
body: [@Rodney](/t5/user/viewprofilepage/user-id/966823) When I did that, It listed all groups and users, period. Not only the ones that have access to the space.


author: Rodney Hughes
body: David

Did you edit the macro to set the Group selection to the specific space group permission name you wish to display the Users for.

You will have one group as "confluence-users"

and say three others as

"alpha-manager" Permission group

"alpha-secretary" Permission group

"alpha-member" Permission group

If you only want to show users with access to this Space who hold "alpha-secretary" Permission, you have to enter than into the macro editor - we are still on v5.8 and it works fine ... 5000+ Users but this shows the list of 6

<https://confluence.atlassian.com/display/CONF58/User+list+Macro>


author: David
body: That only work if your users are set in groups. Some of my users are not. They just have access to the space. I let the Space admins manage that so I can take care of the overall admin tasks.


author: Rodney Hughes
body: ... and there you see the benefit of defining Permission Groups for each Space with certain can/can't do and then just granting the User that group Permission vs randomly assigning individual can/can't do capability on a User-by-user basis


author: David
body: Since there isn't any group delegation, that's more work for me as we have a lot of internal mobility. Space admin can manage that on their own.

I guess we just work differently.