无法通过 Ruby 或 REST API 更新群组所有者

Ruby API create_groupupdate_group 中显示了一个分配 owner_usernames 的选项create_group 似乎可以正常工作(创建组后所有者确实存在),但 owner_usernames 似乎仅在 REST 层面的 创建操作时 可分配。因此,我们无法在不使用 UI 的情况下(至少通过 Ruby API)将用户提升为现有组的所有者。

这是有意为之的设计,还是值得提交一个 PR?我是否正确理解,Ruby 端需要为 groups#add_ownersgroups#remove_owner 添加对应的实现方法?

1 个赞

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

3 个赞

Thanks, Régis. I’m not seeing anything for ownership in discourse_api/lib/discourse_api/api/groups.rb at main · discourse/discourse_api · GitHub. 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 个赞

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

image

1 个赞

discourse_api gem 中现已提供添加和移除群组所有者的方法。

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