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-10 15:44:40 +0100
committerErik Johnston <erik@matrix.org>2017-07-12 11:36:15 +0100
commita62406aaa5c4ef3780e42c9de443a2cc1e82cd9a (patch)
tree4e80c5e6906a082c9b55052f93aa39dab38b46d0 /synapse/federation/transport/server.py
parentMerge pull request #2352 from matrix-org/erikj/group_server_split (diff)
downloadsynapse-a62406aaa5c4ef3780e42c9de443a2cc1e82cd9a.tar.xz
Add group summary APIs
Diffstat (limited to 'synapse/federation/transport/server.py')
-rw-r--r--synapse/federation/transport/server.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/federation/transport/server.py b/synapse/federation/transport/server.py
index 5d6ff79235..bbb66190e0 100644
--- a/synapse/federation/transport/server.py
+++ b/synapse/federation/transport/server.py
@@ -627,6 +627,22 @@ class FederationGroupsProfileServlet(BaseFederationServlet):
         defer.returnValue((200, new_content))
 
 
+class FederationGroupsSummaryServlet(BaseFederationServlet):
+    PATH = "/groups/(?P<group_id>[^/]*)/summary$"
+
+    @defer.inlineCallbacks
+    def on_POST(self, origin, content, query, group_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.get_group_summary(
+            group_id, requester_user_id
+        )
+
+        defer.returnValue((200, new_content))
+
+
 class FederationGroupsRoomsServlet(BaseFederationServlet):
     """Get the rooms in a group on behalf of a user
     """
@@ -784,6 +800,7 @@ ROOM_LIST_CLASSES = (
 
 GROUP_SERVER_SERVLET_CLASSES = (
     FederationGroupsProfileServlet,
+    FederationGroupsSummaryServlet,
     FederationGroupsRoomsServlet,
     FederationGroupsUsersServlet,
     FederationGroupsInviteServlet,