Cannot update group owners via Ruby or REST API

The ruby API shows an option to assign owner_usernames on create_group and update_group. The create_group seems to work (and the owner is there after the group is created) but it appears that owner_usernames are only assignable on create on the REST side of things. So we can’t promote a user to an existing group owner without the UI (at least with the Ruby API).

Is this by design or is this worth a PR? Am I correct in assuming the Ruby side of things would need matching methods for groups#add_owners and groups#remove_owner?

1 Like

The UI is using the API. Have you tried this?

3 Likes

Thanks, Régis. I’m not seeing anything for ownership in https://github.com/discourse/discourse_api/blob/master/lib/discourse_api/api/groups.rb. I was just checking to make sure I wasn’t missing something. I can certainly just do a put request to the /admin/groups/:group_name/owners API endpoint directly without a method in the Ruby API.

1 Like

The API gem may have some gaps, if you find any feel free to plug them in with PRs.

image

1 Like

Methods for adding and removing group owners now exist in the discourse_api gem.

@client.group_add_owners(41, { usernames: "48ce9df193c627574202" } )
@client.group_remove_owners(41, { usernames: "48ce9df193c627574202" } )
2 Likes