Hello,

Is there any way to export all users from a group, to know at least the number of users that are in that group?

In paginations, it does not say the total number of elements of each list.

3 answers

1 accepted

Another way to achive this is by writing a little usermacro.

## @param groupname:title=Group Name|type=string|required=true|desc=The Name of the Group

#set($containerManagerClass=$action.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager=$getInstanceMethod.invoke(null,null))
#set($containerContext=$containerManager.containerContext)

  
## the user accessot gives you access to the users
#set($userAccessor=$containerContext.getComponent('userAccessor')) 


#foreach( $group in $userAccessor.groupsAsList  )

    #if( $group.toString().equals($paramgroupname) )
              There are $userAccessor.getMemberNamesAsList($group).size() users in the group $group
    #end

#end

This macro with an example name "usercount" can now be used by using the following macro call at a page:

{usercount|usergroup=confluence-users}

It works perfectly. Thanks so much!

0 vote
Yilin Mo Atlassian Team Mar 20, 2012

In this case, maybe you can open the page with the following URL:

"<Your Confluence base URL>/admin/users/domembersofgroupsearch.action?membersOfGroupTerm=<The name of your group>"

The page will display the member of this group .

Also, you can use the "user list" macro in a page to list the user in a group. :)

Hope this help.

Thank you Yilin.

I really needed some way without having to access the database, since it is something that should manage the Level 1 technical support, and they do not perform queries to database.

Indicate the total number of a listing is a necessary and available information in most applications. Would not this be included in Confluence?

Thank you Momo.

But I need to know the total number of users of a group (without counting them one by one, and without doing a query to database).

Is this possible? Maybe with a param of the userlist macro?

0 vote
Yilin Mo Atlassian Team Mar 20, 2012

Hi Arantxa,

May be you can try the following SQL statement, hope this hlep:

select cu.user_name,cu.active,cu.first_name,cu.last_name,cu.email_address from cwd_user cu join cwd_membership cm on cu.id=cm.child_user_id join cwd_group cg on cm.parent_id=cg.id where cg.group_name='confluence-users';

Cheers

Yilin

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

897 views 23 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you