summary refs log tree commit diff
path: root/synapse/handlers/groups_local.py
diff options
context:
space:
mode:
authorTravis Ralston <travpc@gmail.com>2020-08-18 15:21:30 -0600
committerTravis Ralston <travpc@gmail.com>2020-08-21 19:35:36 -0600
commitb8a05b5a3fb3c43d08ef50be18bafbd44b163ec1 (patch)
treec5da9e0e1f727041ddd0990aeed88814e85770df /synapse/handlers/groups_local.py
parentMerge remote-tracking branch 'origin/release-v1.15.1' into bbz/info-mainline-... (diff)
downloadsynapse-b8a05b5a3fb3c43d08ef50be18bafbd44b163ec1.tar.xz
Add rudimentary API for promoting/demoting other people in a group
For https://github.com/matrix-org/synapse/issues/2855 (initial)
Diffstat (limited to 'synapse/handlers/groups_local.py')
-rw-r--r--synapse/handlers/groups_local.py19
1 files changed, 19 insertions, 0 deletions
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
     ):