Dear Confluence gurus,
If I have the name of a particular Confluence group that does not give a strong clue to which Space belongs to in the name then is there a way of making the query somewhere to know?
We are using Confluence 5.1.5
I appreciate any clue
Kind regards
Carlos
In that case it seems to be a string compare issue. Maybe try .toLowerCase()? As in: $permission.getGroup().toLowerCase() == $param0.toLowerCase() Does it work with different groups?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, try this: ## Macro title: My Macro ## Macro has a body: Y or N ## Body processing: Selected body processing option ## Output: Selected output option ## ## Developed by: My Name ## Date created: dd/mm/yyyy ## Installed by: My Name ## This is an example macro ## @param 0:title=group|type=string|required=true #foreach($space in $spaceManager.getAllSpaces()) #foreach ($permission in $space.getPermissions()) #if ($permission.isGroupPermission() && $permission.getGroup().toLoweCase() == $param0.toLoweCase() ) Group has permission in space $space.name <br/> #end #end #end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Lukas It works beautifully now :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you are welcome :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Carlos,
You can also list the spaces which the group have direct permission by querying it directly from the database.Replace the <GROUP_NAME> in the query with the name of the group you wish to find:
select SPACENAME, SPACEKEY from spaces JOIN spacepermissions ON spacepermissions.SPACEID= spaces.SPACEID where spacepermissions.PERMGROUPNAME=<GROUP_NAME>;
Hope this helps!
Kind Regards,
Jing Hwa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jing, Thanks for the reply I appreciate your solution and I will have it as an option. The only issue in my site is that only the database administrator can query directly the database so I would have to go to him to get it done. The user macro is something that I can do myself as the application administrator Regards Carlos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lukas, Thanks for your patience and help I think that the last suggestion should be a winner If I can implement it correctly. I coded this but it did not work: ## Macro title: My Macro ## Macro has a body: Y or N ## Body processing: Selected body processing option ## Output: Selected output option ## ## Developed by: My Name ## Date created: dd/mm/yyyy ## Installed by: My Name ## This is an example macro ## @param 0:title=group|type=string|required=true #foreach($space in $spaceManager.getAllSpaces()) #foreach ($permission in $space.getPermissions()) #if ($permission.isGroupPermission().toLowerCase() && $permission.getGroup().toLowerCase()==$param0.toLowerCase()) Group has permission in space $space.name <br/> #end #end #end What would be the right code to make the comparison in lower cases Kind regards Carlos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, try it the other way round: display all groups that have permission on the space by changing the line: #if ($permission.isGroupPermission() && $permission.getGroup()==$param0) to #if ($permission.isGroupPermission()) Group name: $permission.getGroup().name <br/> Group: $permission.getGroup() <br/> and check if the group occurs there. maybe it has some kind of strange internal name?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sry getGroup().name won't work, it's a string.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The macro (the other way around) worked for me though it provided a list of all the groups by Space. Now, If I use the ITS-Confluence-IT Resources in the original macro then nothing happens. Any idea? Carlos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lukas,
Thanks for the reply.
I like your approach and keen to implement it. Now, I tried to follow your instructions
Macro Code.JPG
and this what I get
Macro Result.JPG
I know that group has related Spaces and when I refresh then I get nothing so something is not quite right in my implementation . Needles to say that I have never used "User Macros" before so likely I am missing something. Any idea?
Kind regards
Carlos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which version of confluence are you on? Groups should be lowercase only.. Please test for a simple group, it works for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i usually use a user macro for that.
That's the code (should work, not tested):
## Macro title: My Macro ## Macro has a body: Y or N ## Body processing: Selected body processing option ## Output: Selected output option ## ## Developed by: My Name ## Date created: dd/mm/yyyy ## Installed by: My Name ## This is an example macro ## @param 0:title=group|type=string|required=true #foreach($space in $spaceManager.getAllSpaces()) #foreach ($permission in $space.getPermissions()) #if ($permission.isGroupPermission() && $permission.getGroup()==$param0) Group has permission in space $space.name <br/> #end #end #end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jobin,
Thanks for the reply. Now, will it be a way of providing a group name and then get a list of the Space (or Spaces) that it is referenced to?
Kind regards
Carlos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no one-to-one relation between spaces and groups. You can use groups in space permissions and that is it. But the same group might be used in many spaces.
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.