It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I display a list of users of a space on a confluence page?

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

 

2 answers

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

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.  


## 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 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

@Jan,

That's exactly what I was looking for! And I think, it's also what @Klaus_Blum 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
Like # people like this

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.

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.

Like Nicolai_Sibler likes this

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:

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

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

Thanks

Nicola

This would be helpful.

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

That was where I started. Where is the selection box?

Screen Shot 2018-04-23 at 1.32.06 PM.pngScreen Shot 2018-04-23 at 1.32.19 PM.png

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

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

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

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.

@Rodney When I did that, It listed all groups and users, period. Not only the ones that have access to the space.

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

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.

... 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

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

32 views 2 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you