diff options
author | Andy Balaam <andy.balaam@matrix.org> | 2022-05-12 11:41:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 10:41:35 +0000 |
commit | de1e599b9defdc9b541f14a03157f614cb688729 (patch) | |
tree | 48d1c2e38b70bd891ed0725e668b73b26d697ffd /synapse/handlers/room.py | |
parent | Fix reference to the wrong symbol in the media admin api docs (#12715) (diff) | |
download | synapse-de1e599b9defdc9b541f14a03157f614cb688729.tar.xz |
add default_power_level_content_override config option. (#12618)
Co-authored-by: Matthew Hodgson <matthew@matrix.org>
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 604eb6ec15..e71c78adad 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -149,6 +149,10 @@ class RoomCreationHandler: ) preset_config["encrypted"] = encrypted + self._default_power_level_content_override = ( + self.config.room.default_power_level_content_override + ) + self._replication = hs.get_replication_data_handler() # linearizer to stop two upgrades happening at once @@ -1042,9 +1046,19 @@ class RoomCreationHandler: for invitee in invite_list: power_level_content["users"][invitee] = 100 - # Power levels overrides are defined per chat preset + # If the user supplied a preset name e.g. "private_chat", + # we apply that preset power_level_content.update(config["power_level_content_override"]) + # If the server config contains default_power_level_content_override, + # and that contains information for this room preset, apply it. + if self._default_power_level_content_override: + override = self._default_power_level_content_override.get(preset_config) + if override is not None: + power_level_content.update(override) + + # Finally, if the user supplied specific permissions for this room, + # apply those. if power_level_content_override: power_level_content.update(power_level_content_override) |