From b8a05b5a3fb3c43d08ef50be18bafbd44b163ec1 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 18 Aug 2020 15:21:30 -0600 Subject: Add rudimentary API for promoting/demoting other people in a group For https://github.com/matrix-org/synapse/issues/2855 (initial) --- synapse/handlers/groups_local.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'synapse/handlers/groups_local.py') diff --git a/synapse/handlers/groups_local.py b/synapse/handlers/groups_local.py index ebe8d25bd8..7d62899824 100644 --- a/synapse/handlers/groups_local.py +++ b/synapse/handlers/groups_local.py @@ -470,6 +470,25 @@ class GroupsLocalHandler(GroupsLocalWorkerHandler): return {"state": "invite", "user_profile": user_profile} + async def change_user_admin_in_group( + self, group_id, user_id, want_admin, requester_user_id, content + ): + """Promotes or demotes a user in a group. + """ + + if not self.is_mine_id(user_id): + raise SynapseError(400, "User not on this server") + + # TODO: We should probably support federation, but this is fine for now + if not self.is_mine_id(group_id): + raise SynapseError(400, "Group not on this server") + + res = await self.groups_server_handler.change_user_admin_in_group( + group_id, user_id, want_admin, requester_user_id, content + ) + + return res + async def remove_user_from_group( self, group_id, user_id, requester_user_id, content ): -- cgit 1.5.1