diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-10-08 17:05:01 +0100 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-10-08 17:05:01 +0100 |
commit | 23b50d6fb881db23324cac9f64cba33a1d3747b3 (patch) | |
tree | 160ac2f45363782b0bbc77dc845f410b18585199 /synapse/handlers/directory.py | |
parent | Add `xyz.amorgan.knock` /versions string (diff) | |
parent | Merge tag 'v1.21.0rc3' into develop (diff) | |
download | synapse-23b50d6fb881db23324cac9f64cba33a1d3747b3.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into soru/knock
Diffstat (limited to 'synapse/handlers/directory.py')
-rw-r--r-- | synapse/handlers/directory.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py index 46826eb784..ad5683d251 100644 --- a/synapse/handlers/directory.py +++ b/synapse/handlers/directory.py @@ -37,7 +37,7 @@ logger = logging.getLogger(__name__) class DirectoryHandler(BaseHandler): def __init__(self, hs): - super(DirectoryHandler, self).__init__(hs) + super().__init__(hs) self.state = hs.get_state_handler() self.appservice_handler = hs.get_application_service_handler() @@ -46,6 +46,7 @@ class DirectoryHandler(BaseHandler): self.config = hs.config self.enable_room_list_search = hs.config.enable_room_list_search self.require_membership = hs.config.require_membership_for_aliases + self.third_party_event_rules = hs.get_third_party_event_rules() self.federation = hs.get_federation_client() hs.get_federation_registry().register_query_handler( @@ -383,7 +384,7 @@ class DirectoryHandler(BaseHandler): """ creator = await self.store.get_room_alias_creator(alias.to_string()) - if creator is not None and creator == user_id: + if creator == user_id: return True # Resolve the alias to the corresponding room. @@ -454,6 +455,15 @@ class DirectoryHandler(BaseHandler): # per alias creation rule? raise SynapseError(403, "Not allowed to publish room") + # Check if publishing is blocked by a third party module + allowed_by_third_party_rules = await ( + self.third_party_event_rules.check_visibility_can_be_modified( + room_id, visibility + ) + ) + if not allowed_by_third_party_rules: + raise SynapseError(403, "Not allowed to publish room") + await self.store.set_room_is_public(room_id, making_public) async def edit_published_appservice_room_list( |