diff options
author | Daniel Wagner-Hall <daniel@matrix.org> | 2015-11-05 14:32:26 +0000 |
---|---|---|
committer | Daniel Wagner-Hall <daniel@matrix.org> | 2015-11-05 14:32:26 +0000 |
commit | ca2f90742d5606f8fc5b7ddd3dd7244c377c1df8 (patch) | |
tree | 3094f16ebc3448ba3379cf209ac8b097a5968ecf /synapse/rest/client/v1/events.py | |
parent | Merge pull request #347 from matrix-org/markjh/check_filter (diff) | |
download | synapse-ca2f90742d5606f8fc5b7ddd3dd7244c377c1df8.tar.xz |
Open up /events to anonymous users for room events only
Squash-merge of PR #345 from daniel/anonymousevents
Diffstat (limited to 'synapse/rest/client/v1/events.py')
-rw-r--r-- | synapse/rest/client/v1/events.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/rest/client/v1/events.py b/synapse/rest/client/v1/events.py index 4073b0d2d1..3e1750d1a1 100644 --- a/synapse/rest/client/v1/events.py +++ b/synapse/rest/client/v1/events.py @@ -34,7 +34,15 @@ class EventStreamRestServlet(ClientV1RestServlet): @defer.inlineCallbacks def on_GET(self, request): - auth_user, _, _ = yield self.auth.get_user_by_req(request) + auth_user, _, is_guest = yield self.auth.get_user_by_req( + request, + allow_guest=True + ) + room_id = None + if is_guest: + if "room_id" not in request.args: + raise SynapseError(400, "Guest users must specify room_id param") + room_id = request.args["room_id"][0] try: handler = self.handlers.event_stream_handler pagin_config = PaginationConfig.from_request(request) @@ -49,7 +57,8 @@ class EventStreamRestServlet(ClientV1RestServlet): chunk = yield handler.get_stream( auth_user.to_string(), pagin_config, timeout=timeout, - as_client_event=as_client_event + as_client_event=as_client_event, affect_presence=(not is_guest), + room_id=room_id, is_guest=is_guest ) except: logger.exception("Event stream failed") |