diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-10-05 14:57:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 14:57:46 +0100 |
commit | 0991a2da93b6b2010e6ef8f732ffdc3b5b382bab (patch) | |
tree | be2eb6fda46f36a3a08798fc05b0bf774aa4107b /synapse/handlers/room.py | |
parent | Remove stream ordering from Metadata dict (#8452) (diff) | |
download | synapse-0991a2da93b6b2010e6ef8f732ffdc3b5b382bab.tar.xz |
Allow ThirdPartyEventRules modules to manipulate public room state (#8292)
This PR allows `ThirdPartyEventRules` modules to view, manipulate and block changes to the state of whether a room is published in the public rooms directory. While the idea of whether a room is in the public rooms list is not kept within an event in the room, `ThirdPartyEventRules` generally deal with controlling which modifications can happen to a room. Public rooms fits within that idea, even if its toggle state isn't controlled through a state event.
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index f1a6699cd4..f14f791586 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -681,6 +681,15 @@ class RoomCreationHandler(BaseHandler): creator_id=user_id, is_public=is_public, room_version=room_version, ) + # Check whether this visibility value 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, "Room visibility value not allowed.") + directory_handler = self.hs.get_handlers().directory_handler if room_alias: await directory_handler.create_association( |