summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2015-11-12 15:22:02 +0000
committerDaniel Wagner-Hall <dawagner@gmail.com>2015-11-12 15:22:02 +0000
commit06bfd0a3c00b1bbb716c7e325daad2de9e8e8c1f (patch)
tree81d66bd7531f3d4393d66ba42582115e27741a20 /synapse
parentMerge pull request #360 from matrix-org/daniel/guestroominitialsync (diff)
parentTweak guest access permissions (diff)
downloadsynapse-06bfd0a3c00b1bbb716c7e325daad2de9e8e8c1f.tar.xz
Merge pull request #367 from matrix-org/daniel/readafterleave
Merge pull request #367 from matrix-org/daniel/readafterleave

Tweak guest access permissions
Diffstat (limited to '')
-rw-r--r--synapse/handlers/message.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 21cdd6cdbe..14051aee99 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -267,17 +267,18 @@ class MessageHandler(BaseHandler):
             member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
             defer.returnValue((member_event.membership, member_event.event_id))
             return
-        except AuthError:
+        except AuthError, auth_error:
+            visibility = yield self.state_handler.get_current_state(
+                room_id, EventTypes.RoomHistoryVisibility, ""
+            )
+            if (
+                visibility and
+                visibility.content["history_visibility"] == "world_readable"
+            ):
+                defer.returnValue((Membership.JOIN, None))
+                return
             if not is_guest:
-                raise
-
-        visibility = yield self.state_handler.get_current_state(
-            room_id, EventTypes.RoomHistoryVisibility, ""
-        )
-        if visibility.content["history_visibility"] == "world_readable":
-            defer.returnValue((Membership.JOIN, None))
-            return
-        else:
+                raise auth_error
             raise AuthError(
                 403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
             )