list group permissions on spaces

Is there a way in Confluence to list all the spaces a group, say group X, has permissions on?

I'd like to avoid going manually through every space permissions page and look for the presence of group X...

Instead it would be useful to report on the list of spaces Group X has access to, but I can't find any hint in documentation of macros, plugins,...

Thanks in advance

2 answers

1 accepted

This widget could not be displayed.

We created a user macro with similar functionality. Maybe something like this:

## @param Group:title=Group|type=string|required=true|desc=The group to check permissions

All spaces where group "$paramGroup" has VIEWSPACE permission:

#set($allSpaces=$spaceManager.getAllSpaces())
<ul>
  #foreach($space in $allSpaces)
    #set($spacePermissions=$space.getPermissions())
    #foreach($permission in $spacePermissions)
      #if ($permission.getType() == 'VIEWSPACE' && $permission.getGroup() == $paramGroup)
        <li><a href="$req.contextPath/spaces/spacepermissions.action?key=$space.key">$space.name ($space.key)</a></li>
      #end
    #end
  #end
</ul>

Hope this helps

That's really helpful, Remo.

That's really helpful, Remo.

Hi, this looks very helpful, but I'm not quite sure how to use it. I created a macro using the cod you pasted above. Referencing it like

{my_get_spaces_macro:title=my_group_name}

results in a list of users. Would you mind giving an explanation as to how to use it? Thanks, Julie

If you create a user macro called "group-permissions" using the code above and reference it like:

{group-permissions:Group=confluence-users}

Then you should see something like the following output:

All spaces where group "confluence-users" has VIEWSPACE permission:

  • Demonstration Space (ds)
  • Testspace (test)

That's terrific! Saves lots of time. Thank you!

is it possible to do the same thing for each User individually - i.e. list the Spaces that Fred has access to, followed by John's Spaces, followed by Percy's Spaces .... for all Users?

The user macro here is brilliant, but like Rodney I'm struggling to modify it to display the same information for an individual user. Not sure what I'm doing wrong but replacing group with user doesn't work and I can't find anything helpful in the Confluence documentation

The following macro should work for individual users:

## @param User:title=User|type=username|required=true|desc=Select user to check permissions

All spaces where user "$paramUser" has VIEWSPACE permission:
 
#set($allSpaces=$spaceManager.getAllSpaces())
<ul>
  #foreach($space in $allSpaces)
    #set($spacePermissions=$space.getPermissions())
    #foreach($permission in $spacePermissions)
      #if ($permission.getType() == 'VIEWSPACE' && $permission.getUserName() == $paramUser)
        <li><a href="$req.contextPath/spaces/spacepermissions.action?key=$space.key">$space.name ($space.key)</a></li>
      #end
    #end
  #end
</ul>

Hope this helps

Thank you - that was an amazingly quick reply. It works better than what I was trying, but doesn't report on the spaces that a user has access to via group membership. Presumably it would be possible to extend it the macro to report on all spaces that a user can see (via group membership or user permissions)?

The goal of the macro was to find spaces where the group/user has been given explicit permissions, not implicit via group membership.

Maybe this macro is what you are looking for:
https://answers.atlassian.com/questions/73701/macro-to-get-all-permissions-for-a-specific-user

Thank you for pointing me to the other question. I'll experiment with the macros there. I didn't find that one when I was searching before - I often find it hard to find what I'm looking for in "Answers" although there is so much useful information here.

Yep, same for me. I often just search on Google instead of Answers...

This widget could not be displayed.

Is it possible to do the opposite?

For each space see what groups have access...

Thank you!

-Aaron

Hey Aaron, is it possible? Did you find any resolution?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

603 views 8 6
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you