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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

260 views 0 6
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