How do I know which Space a Confluence group is related to ?

Carlos Reyes
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 17, 2015

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

8 answers

1 accepted

0 votes
Answer accepted
Carlos Reyes
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 18, 2015

Hi LuKas the second macro works nicely

 

Groups today.JPG

it provides 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?

 

Thanks for your help so far

Cheers

Carlos

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 18, 2015

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?

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 19, 2015

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

Carlos Reyes
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 19, 2015

Thanks Lukas It works beautifully now :)

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 19, 2015

you are welcome :)

1 vote
jing_hwa_cheok
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 18, 2015

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=&lt;GROUP_NAME&gt;;


Hope this helps!


Kind Regards,
Jing Hwa

Carlos Reyes
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 18, 2015

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

0 votes
Carlos Reyes
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 19, 2015

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

0 votes
Carlos Reyes
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 17, 2015

The groups that I am interested in are not internal groups but Active Directory groups

 

AD Groups.JPG

 

These AD groups synchronize with my instance of Confluence 5.1.5

AD Sync.JPG

Any idea?

 

Thanks for the help so far

 

Carlos

 

 

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 17, 2015

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?

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 17, 2015

sry getGroup().name won't work, it's a string.

Carlos Reyes
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 18, 2015

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

0 votes
Carlos Reyes
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 17, 2015

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

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 17, 2015

Which version of confluence are you on? Groups should be lowercase only.. Please test for a simple group, it works for me.

0 votes
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 17, 2015

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() &amp;&amp; $permission.getGroup()==$param0)
Group has permission in space $space.name &lt;br/&gt;
#end
#end
#end
0 votes
Carlos Reyes
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 17, 2015

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

0 votes
Jobin Kuruvilla [Adaptavist]
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 17, 2015

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events