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

Deleted user May 28, 2015

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

1 vote
Answer accepted
Lukas Knoch -Rumpelcoders-
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.
May 28, 2015

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

Deleted user May 28, 2015

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!

Lukas Knoch -Rumpelcoders-
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.
May 28, 2015

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

Deleted user May 28, 2015

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

Lukas Knoch -Rumpelcoders-
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.
May 28, 2015
Lukas Knoch -Rumpelcoders-
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.
May 28, 2015

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.

Deleted user June 30, 2015

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?

Lukas Knoch -Rumpelcoders-
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.
June 30, 2015

Hopefully. :) What's the matter?

Deleted user November 29, 2015

@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

1 vote
Lukas Knoch -Rumpelcoders-
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.
May 28, 2015

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

Deleted user May 28, 2015

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

Deleted user May 28, 2015

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?

Lukas Knoch -Rumpelcoders-
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.
May 28, 2015

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.

Deleted user May 28, 2015

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
TAGS
AUG Leaders

Atlassian Community Events