list group permissions on spaces
Asked by Miryam Duella:

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


Answers:
author: Remo Siegwart
body: 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 permissionsAll spaces where group "$paramGroup" has VIEWSPACE permission:#set($allSpaces=$spaceManager.getAllSpaces())&lt;ul&gt;  #foreach($space in $allSpaces)    #set($spacePermissions=$space.getPermissions())    #foreach($permission in $spacePermissions)      #if ($permission.getType() == 'VIEWSPACE' &amp;&amp; $permission.getGroup() == $paramGroup)        &lt;li&gt;&lt;a href="$req.contextPath/spaces/spacepermissions.action?key=$space.key"&gt;$space.name ($space.key)&lt;/a&gt;&lt;/li&gt;      #end    #end  #end&lt;/ul&gt;
```

Hope this helps

comments: author: Steve Goldberg
body: That's really helpful, Remo.


author: Steve Goldberg
body: That's really helpful, Remo.


author: Julie Driscoll
body: 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


author: Remo Siegwart
body: 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)


author: Julie Driscoll
body: That's terrific! Saves lots of time. Thank you!


author: RodneyH
body: 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?


author: Felicity Chapman
body: 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


author: Remo Siegwart
body: The following macro should work for individual users:

```
## @param User:title=User|type=username|required=true|desc=Select user to check permissionsAll spaces where user "$paramUser" has VIEWSPACE permission: #set($allSpaces=$spaceManager.getAllSpaces())&lt;ul&gt;  #foreach($space in $allSpaces)    #set($spacePermissions=$space.getPermissions())    #foreach($permission in $spacePermissions)      #if ($permission.getType() == 'VIEWSPACE' &amp;&amp; $permission.getUserName() == $paramUser)        &lt;li&gt;&lt;a href="$req.contextPath/spaces/spacepermissions.action?key=$space.key"&gt;$space.name ($space.key)&lt;/a&gt;&lt;/li&gt;      #end    #end  #end&lt;/ul&gt;
```

Hope this helps


author: Felicity Chapman
body: 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)?


author: Remo Siegwart
body: 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>


author: Felicity Chapman
body: 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.


author: Remo Siegwart
body: Yep, same for me. I often just search on Google instead of Answers...


author: aaron wideen
body: Is it possible to do the opposite?

For each space see what groups have access...

Thank you!

-Aaron

comments: author: Bartosz Czy?ewski
body: Hey Aaron,is it possible? Did you find any resolution?


Tags: administration

report