summary refs log tree commit diff
path: root/synapse/handlers/space_summary.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2021-08-31 17:16:21 +0100
committerBrendan Abolivier <babolivier@matrix.org>2021-08-31 17:16:21 +0100
commit5a33232e0fde6b716640f4c1140d41d8cf79f092 (patch)
treed6c671f186bd1b76e93db30f6168409a10e86868 /synapse/handlers/space_summary.py
parentMerge tag 'v1.35.0' into babolivier/dinsic_1.41.0 (diff)
parentClarify changelog. (diff)
downloadsynapse-5a33232e0fde6b716640f4c1140d41d8cf79f092.tar.xz
Merge tag 'v1.35.1' into babolivier/dinsic_1.41.0
Synapse 1.35.1 (2021-06-03)
===========================

Bugfixes
--------

- Fix a bug introduced in v1.35.0 where invite-only rooms would be shown to all users in a space, regardless of if the user had access to it. ([\#10109](https://github.com/matrix-org/synapse/issues/10109))
Diffstat (limited to 'synapse/handlers/space_summary.py')
-rw-r--r--synapse/handlers/space_summary.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/synapse/handlers/space_summary.py b/synapse/handlers/space_summary.py

index abd9ddecca..046dba6fd8 100644 --- a/synapse/handlers/space_summary.py +++ b/synapse/handlers/space_summary.py
@@ -26,7 +26,6 @@ from synapse.api.constants import ( HistoryVisibility, Membership, ) -from synapse.api.errors import AuthError from synapse.events import EventBase from synapse.events.utils import format_event_for_client_v2 from synapse.types import JsonDict @@ -456,16 +455,16 @@ class SpaceSummaryHandler: return True # Otherwise, check if they should be allowed access via membership in a space. - try: - await self._event_auth_handler.check_restricted_join_rules( - state_ids, room_version, requester, member_event + if self._event_auth_handler.has_restricted_join_rules( + state_ids, room_version + ): + allowed_spaces = ( + await self._event_auth_handler.get_spaces_that_allow_join(state_ids) ) - except AuthError: - # The user doesn't have access due to spaces, but might have access - # another way. Keep trying. - pass - else: - return True + if await self._event_auth_handler.is_user_in_rooms( + allowed_spaces, requester + ): + return True # If this is a request over federation, check if the host is in the room or # is in one of the spaces specified via the join rules.