mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-22 08:04:57 -05:00
Tweak guest access permissions
* Allow world_readable rooms to be read by guests who have joined and left * Allow regular users to access world_readable rooms
This commit is contained in:
parent
473a239d83
commit
fb7e260a20
@ -267,17 +267,18 @@ class MessageHandler(BaseHandler):
|
|||||||
member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
|
member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
|
||||||
defer.returnValue((member_event.membership, member_event.event_id))
|
defer.returnValue((member_event.membership, member_event.event_id))
|
||||||
return
|
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:
|
if not is_guest:
|
||||||
raise
|
raise auth_error
|
||||||
|
|
||||||
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 AuthError(
|
raise AuthError(
|
||||||
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user