From f690b7b8279551b5cab782e2e4cd5811fc9d3789 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 22 Aug 2014 15:59:15 +0100 Subject: Impl: /rooms/roomid/state/eventtype/state_key - Renamed RoomTopicRestServlet to RoomStateEventRestServlet. Support generic state event sending. --- synapse/api/auth.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'synapse/api/auth.py') diff --git a/synapse/api/auth.py b/synapse/api/auth.py index 31852b29a5..ae61319a2c 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -44,15 +44,15 @@ class Auth(object): be raised only if raises=True. """ try: - if event.type in [RoomTopicEvent.TYPE, MessageEvent.TYPE, - FeedbackEvent.TYPE]: - yield self.check_joined_room(event.room_id, event.user_id) - defer.returnValue(True) - elif event.type == RoomMemberEvent.TYPE: - allowed = yield self.is_membership_change_allowed(event) - defer.returnValue(allowed) + if hasattr(event, "room_id"): + if event.type == RoomMemberEvent.TYPE: + allowed = yield self.is_membership_change_allowed(event) + defer.returnValue(allowed) + else: + yield self.check_joined_room(event.room_id, event.user_id) + defer.returnValue(True) else: - raise AuthError(500, "Unknown event type %s" % event.type) + raise AuthError(500, "Unknown event: %s" % event) except AuthError as e: logger.info("Event auth check failed on event %s with msg: %s", event, e.msg) -- cgit 1.4.1