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
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 . 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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
should work with storage format <ac:emoticon ac:name="tick" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! Thanks a lot! I really have to learn velocity. Are there any good ressources?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is of course https://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html, but you need to combine it with https://developer.atlassian.com/confdev/development-resources/confluence-architecture/confluence-internals/velocity-template-overview/confluence-objects-accessible-from-velocity. I learned most of it from existing code, it's not that hard, just a few strange effects...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hopefully. :) What's the matter?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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! :))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.