how can i get a listing of groups in confluence?

Bob Doppel April 21, 2015

I want to generate a report that shows a listing of all groups in our Confluence instance.  Anyone done anything like this?

Thanks!

 

4 answers

1 vote
Davin Studer
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.
April 21, 2015

You could do it with a user macro.

## Developed by: Davin Studer
## Date created: 04/21/2015
## @noparams
<ul>
#foreach($group in $userAccessor.getGroups())
    <li>$group</li>
#end
</ul>
Mallmann
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 21, 2015

Nice one, Davin! :)

Norman Walter July 3, 2019

Just in case the special characters in Davin's script causes issues like they did for me - this slightly changed version worked flawlessly for me (Confluence version 6.4):

## Developed by: Davin Studer
## Date created: 04/21/2015
## @noparams
<ul>
#foreach($group in $userAccessor.getGroups())
<li>$group</li>
#end
</ul>

 Thanks, @Davin Studer. Awesome little script.

Davin Studer
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.
July 3, 2019

Yeah, unfortunately when these posts were migrated from the old Atlassian Answers site the code blocks were html encoded, which messes up the code. : (

1 vote
Mallmann
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 21, 2015

Hello Bob,

You can get a list of all group names by running a query against your database. For instance:

select group_name from cwd_group;

It's also possible to retrieve the directory name that this group comes from and other kind of information you might need.

Let me know if that helps! smile

Eduardo

0 votes
Panos
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.
April 21, 2015

similarly from the java api

public class MyClass extends ConfluenceActionSupport{
	private final UserAccessor useraccessor;
	public MyClass(UserAccessor userAccessor){
		this.useraccessor=userAccessor;
	}
	public String execute()
	{
		//do something with
		useraccessor.getGroups()
	}
}

 

 

0 votes
Bob Doppel April 21, 2015

Thanks, Eduardo!  I'll give it a shot.

Bob

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events