Whats the best way to show users who has access to a certain space?

Hey there, what is the best way to show users of a certain space who else has access to this space? Since normal users cannot access the group admin function it seems a bit hard. And often users ask me: Is this guy in this space, too? And this guy?

Is there a good way to increase the transparency here?

Thanks in advance, Lars

2 answers

1 accepted

This widget could not be displayed.

Ok, i must admit, it's awful code and I am really sorry that you have to work with that, but I don't have more time at the moment, so here it is:

## @param 1:title=Max Users shown|type=int|required=true|default=50
##
#if($param1)
    #set ( $Integer = 0 )
    #set ( $max = $Integer.parseInt($param1) )
#else 
    #set ( $max = 50 )
#end
#set ( $morestring = "...")
#set($groups = {})
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() )
    #if ($groups.get($permission.getGroup()) )
       #set($h = $groups.get($permission.getGroup()) )
       #set($x = [])
       #foreach($elem in $h)
       	#set($succ = $x.add($elem))
       #end
       #set($succ = $x.add($permission.getType()))
       #set($succ = $groups.put($permission.getGroup(), $x) )
    #else  
         #set( $g =  [ $permission.getType() ]  )
         #set( $discard = $groups.put($permission.getGroup(), $g)) 
    #end
#else
#set($username = $permission.getUserSubject().getName())
#if(!$username)
#set($username = "Anonymous")
#end 
 #if ($groups.get($username) )
       #set($h = $groups.get($username) )
       #set($x = [])
       #foreach($elem in $h)
       	#set($succ = $x.add($elem))
       #end
       #set($succ = $x.add($permission.getType()))
       #set($succ = $groups.put($username, $x) )
    #else  
        #set( $g =  [ $permission.getType() ]  )
        #set( $discard = $groups.put($username, $g)) 
    #end
#end
#end
  <table class="confluenceTable" style="float: left;">
    <tr>
      <th class="confluenceTh">Group</th>
      <th class="confluenceTh">View</th>
      <th class="confluenceTh">Edit</th>
      <th class="confluenceTh">Admin</th>
      <th class="confluenceTh">Users</th>
    </tr>
    #foreach ($group in $groups.keySet())
      #set ( $groupO = $userAccessor.getGroup($group) )
      #if($groupO)
        #set ( $memberList = $userAccessor.getMemberNamesAsList($groupO) )
      #end
  <tr>
   <td class="confluenceTd">$group</td>
   
   <td class="permissionCell" style="text-align: center;" >
     #foreach($perm in $groups.get($group))
            #if($perm == "VIEWSPACE")
              X
              #break
            #end 
    #end
   </td>
   <td class="permissionCell" style="text-align: center;">
        #foreach($perm in $groups.get($group))
            #if($perm == "EDITSPACE")
              X
              #break
            #end 
    #end
   </td>
   <td class="permissionCell" style="text-align: center;">
   #foreach($perm in $groups.get($group))
            #if($perm == "SETSPACEPERMISSIONS")
              X
              #break
            #end 
    #end
   </td>
   <td class="confluenceTd" >
    #foreach ($member in $memberList)
        #if( $velocityCount  > $max)
          $morestring
          #break
        #end
        
        #if($velocityCount < $memberList.size() && $velocityCount < $max )
        #usernameLink($member),
        #else
        #usernameLink($member)
        #end
      #end
   </td>
  </tr>
#end
</table>

It basically displays all groups with it's users with permissions in this space. The permissions are simplified to view/edit/administer so it doesn't get to long. 

Please don't rip my head off for coding style smile. sorry again.

best regards from Austria, 

Lukas

All the best! Code is beautiful (I have no clue about it: D). Can I replace the X somehow with a Wiki Markup (e.g. (/))? Is this possible? Thanks for all!

should work with storage format <ac:emoticon ac:name="tick" />

Great! Thanks a lot! I really have to learn velocity. Are there any good ressources?

But if you need more difficult stuff it might be worth investing some time in learning plugin development. It makes things much easier. Velocity is not ment to collect data, as it is a templating language.

Hey Lukas, we experienced some difficulties with the macro. We tried to fix it on our own but we weren't successful. Can you help out?

Hopefully. :) What's the matter?

@Lukas Knoch [Rumpelcoders] long time no see. Actually here is that problem as you can see on the screenshot the groups and users are mixed up in the display: http://fs5.directupload.net/images/151129/7skauqw3.png

This widget could not be displayed.

Hi,

you might want to take a look at this related question. If that does not help you, let me know in a bit more detail and we will figure something out for you.

Best regards,

Lukas

This is a great user macro! So what makes the macro: it shows me the space admins. So what I want to achieve have to look like a mix of Space > Groups which have access to that space > member of this certain groups I guess thats a little bit too much. So maybe the better way is to build a permission page where I put manually all the spaces and the related groups? This would be really static and I have to add new spaces manually but I cannot see a good way to solve it with such a macro (since it is way too big data).

Or maybe a macro which recognizes the space and shows - the groups which have access to that space - the member of that groups - single users Would that be a solvable problem for a user macro?

That would be solveable, with the limitation that groups with 200+ users might slow down the loading time of the macro drastically. Are you into plugin development? If so, that might be the quicker and easier way. (I have some source code for that somewhere) If not, i can give it a try with a user macro if you want to.

I have only little knowledge about velocity (copied some stuff and customized 1% for our dashboard). I would print you a wonderful picture of flowers and would send you a beautiful picture of that if you could go into it! :))

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday 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...

458 views 6 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