diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-22 10:25:46 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-22 10:25:46 +0000 |
commit | 45a9e0ae0c9a4c55d4648802fefe96cc2933304f (patch) | |
tree | 50b17b847dadcaf7fb89d886cfb3cc07a47dc488 /synapse/rest/client/v2_alpha/sync.py | |
parent | Add top level filtering by room id (diff) | |
download | synapse-45a9e0ae0c9a4c55d4648802fefe96cc2933304f.tar.xz |
Allow guest access if the user provides a list of rooms in the filter
Diffstat (limited to 'synapse/rest/client/v2_alpha/sync.py')
-rw-r--r-- | synapse/rest/client/v2_alpha/sync.py | 10 |
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, ) |