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

0 votes
Accepted answer

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
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

342 views 0 1
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