summary refs log tree commit diff
path: root/synapse/federation/transport/server.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-07-11 14:35:07 +0100
committerErik Johnston <erik@matrix.org>2017-07-11 14:35:07 +0100
commitfe4e885f54353f82c5c56d1d2a31593124d39e8a (patch)
tree4298e2181af76323c778d00ecbdfa606b6855dc0 /synapse/federation/transport/server.py
parentComment (diff)
downloadsynapse-fe4e885f54353f82c5c56d1d2a31593124d39e8a.tar.xz
Add federation API for adding room to group
Diffstat (limited to 'synapse/federation/transport/server.py')
-rw-r--r--synapse/federation/transport/server.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/federation/transport/server.py b/synapse/federation/transport/server.py
index 2286f6f8fd..5d6ff79235 100644
--- a/synapse/federation/transport/server.py
+++ b/synapse/federation/transport/server.py
@@ -645,6 +645,24 @@ class FederationGroupsRoomsServlet(BaseFederationServlet):
         defer.returnValue((200, new_content))
 
 
+class FederationGroupsAddRoomsServlet(BaseFederationServlet):
+    """Add room to group
+    """
+    PATH = "/groups/(?P<group_id>[^/]*)/room/(?<room_id>)$"
+
+    @defer.inlineCallbacks
+    def on_POST(self, origin, content, query, group_id, room_id):
+        requester_user_id = content["requester_user_id"]
+        if get_domain_from_id(requester_user_id) != origin:
+            raise SynapseError(403, "requester_user_id doesn't match origin")
+
+        new_content = yield self.handler.add_room(
+            group_id, requester_user_id, room_id, content
+        )
+
+        defer.returnValue((200, new_content))
+
+
 class FederationGroupsUsersServlet(BaseFederationServlet):
     """Get the users in a group on behalf of a user
     """