Question about the Confluence command line interface

What is the Confluence command that will, given the name of a confluence group, return its members? I do not have administrative privileges but I looked at 'getUserList' and getGroupList' - neither of them does what I need.

Any help would be appreciated.

3 answers

1 accepted

I will try the suggested queries. Thank you for the suggestions.

Hi, as per what I could see the in this doc, the parameter getUserList would return just the list of users and getGroupList would return just the list of groups, none of those parameters would return the list of members of a specific group.

Aparently there isn't an option to retrieve this information with command line interface, as an alternative you may consider SQL queries as these examples:

This query will return the list of group that are member of the GroupA:

SELECT g.group_name FROM cwd_group g join cwd_membership m on g.id=m.child_group_id WHERE m.parent_id = (select id from cwd_group where group_name = 'GroupA') and m.child_group_id is not null;

This query will return only nested members of GroupA:

select u.id, u.user_name, g.group_name from cwd_user u
join cwd_membership m on u.id=m.child_user_id join cwd_group g on m.parent_id=g.id join cwd_directory d on d.id=g.directory_id
where g.group_name in (SELECT g.group_name FROM cwd_group g join cwd_membership m on g.id=m.child_group_id WHERE m.parent_id = (select id from cwd_group where group_name = 'GroupA') and m.child_group_id is not null) and d.directory_type='CROWD' order by g.group_name;

This query will return only direct members of GroupA:

select u.id, u.user_name from cwd_user u
join cwd_membership m on u.id=m.child_user_id join cwd_group g on m.parent_id=g.id join cwd_directory d on d.id=g.directory_id
where g.group_name = 'GroupA' and d.directory_type='CROWD' order by g.group_name;

This query will return the complete list of members of GroupA. Direct members, plus Nested members:

select u.id, u.user_name, g.group_name from cwd_user u
join cwd_membership m on u.id=m.child_user_id join cwd_group g on m.parent_id=g.id join cwd_directory d on d.id=g.directory_id
where g.group_name in (SELECT g.group_name FROM cwd_group g join cwd_membership m on g.id=m.child_group_id WHERE m.parent_id = (select id from cwd_group where group_name = 'GroupA') and m.child_group_id is not null) and d.directory_type='CROWD' or g.group_name = 'GroupA' and d.directory_type='CROWD' order by g.group_name;
Cheers

The Confluence remote API currently doesn't support what you are requesting, so the CLI doesn't either. If your instance shares users with JIRA, the JCLI does support this capability. Please open an issue and perhaps this can be supported in the future.

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
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

108 views 0 2
Read article

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