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

list group permissions on spaces

Miryam Duella November 17, 2011

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

5 votes
Answer accepted
Remo Siegwart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2011

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

Steve Goldberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2011

That's really helpful, Remo.

Steve Goldberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2011

That's really helpful, Remo.

Julie Driscoll March 14, 2012

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

Remo Siegwart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 14, 2012

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)
Julie Driscoll March 14, 2012

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

RodneyH March 24, 2013

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?

Felicity Chapman February 24, 2014

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

Remo Siegwart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2014

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

Felicity Chapman February 24, 2014

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)?

Remo Siegwart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2014

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

Felicity Chapman February 25, 2014

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.

Remo Siegwart February 25, 2014

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

3 votes
aaron wideen April 4, 2013

Is it possible to do the opposite?

For each space see what groups have access...

Thank you!

-Aaron

Bartosz Czyżewski September 15, 2015

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events