summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-12-22 16:09:23 +0000
committerMark Haines <mjark@negativecurvature.net>2015-12-22 16:09:23 +0000
commit7df276d219218a41f40079fd6728f5c15b2e1934 (patch)
tree593bd0facf7ffd5508ba105f8a15023d36becf30 /synapse/rest/client
parentMerge pull request #454 from matrix-org/markjh/room_filtering (diff)
parentInclude the list of bad room ids in the error (diff)
downloadsynapse-7df276d219218a41f40079fd6728f5c15b2e1934.tar.xz
Merge pull request #455 from matrix-org/markjh/guest_access
Allow guest access to /sync
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v2_alpha/sync.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index 697df03dda..35a70ffad1 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -85,7 +85,9 @@ class SyncRestServlet(RestServlet):
 
     @defer.inlineCallbacks
     def on_GET(self, request):
-        user, token_id, _ = yield self.auth.get_user_by_req(request)
+        user, token_id, is_guest = yield self.auth.get_user_by_req(
+            request, allow_guest=True
+        )
 
         timeout = parse_integer(request, "timeout", default=0)
         since = parse_string(request, "since")
@@ -118,8 +120,14 @@ class SyncRestServlet(RestServlet):
             except:
                 filter = FilterCollection({})
 
+        if is_guest and filter.list_rooms() is None:
+            raise SynapseError(
+                400, "Guest users must provide a list of rooms in the filter"
+            )
+
         sync_config = SyncConfig(
             user=user,
+            is_guest=is_guest,
             filter=filter,
         )