summary refs log tree commit diff
path: root/synapse/api
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/api
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/api')
-rw-r--r--synapse/api/errors.py16
-rw-r--r--synapse/api/filtering.py12
2 files changed, 28 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py

index d4037b3d55..8bc7b9e6db 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py
@@ -120,6 +120,22 @@ class AuthError(SynapseError): super(AuthError, self).__init__(*args, **kwargs) +class GuestAccessError(AuthError): + """An error raised when a there is a problem with a guest user accessing + a room""" + + def __init__(self, rooms, *args, **kwargs): + self.rooms = rooms + super(GuestAccessError, self).__init__(*args, **kwargs) + + def error_dict(self): + return cs_error( + self.msg, + self.errcode, + rooms=self.rooms, + ) + + class EventSizeError(SynapseError): """An error raised when an event is too big.""" diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index 4390d01e38..5287aaa757 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py
@@ -149,6 +149,9 @@ class FilterCollection(object): "include_leave", False ) + def list_rooms(self): + return self.room_filter.list_rooms() + def timeline_limit(self): return self.room_timeline_filter.limit() @@ -181,6 +184,15 @@ class Filter(object): def __init__(self, filter_json): self.filter_json = filter_json + def list_rooms(self): + """The list of room_id strings this filter restricts the output to + or None if the this filter doesn't list the room ids. + """ + if "rooms" in self.filter_json: + return list(set(self.filter_json["rooms"])) + else: + return None + def check(self, event): """Checks whether the filter matches the given event.