diff options
author | Michael Telatynski <7t3chguy@gmail.com> | 2019-08-15 09:45:57 +0100 |
---|---|---|
committer | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-08-15 09:45:57 +0100 |
commit | baee288fb462d4a29ea953261d83312129b1d487 (patch) | |
tree | 311febcdceec68e3d5a487d3807529f98a584b3d | |
parent | Merge pull request #5844 from matrix-org/erikj/retry_well_known_lookup (diff) | |
download | synapse-baee288fb462d4a29ea953261d83312129b1d487.tar.xz |
Don't create broken room when power_level_content_override.users does not contain creator_id. (#5633)
-rw-r--r-- | changelog.d/5633.bugfix | 1 | ||||
-rw-r--r-- | synapse/handlers/room.py | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/changelog.d/5633.bugfix b/changelog.d/5633.bugfix new file mode 100644 index 0000000000..b2ff803b9d --- /dev/null +++ b/changelog.d/5633.bugfix @@ -0,0 +1 @@ +Don't create broken room when power_level_content_override.users does not contain creator_id. \ No newline at end of file diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 5caa90c3b7..6e47fe7867 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -560,6 +560,18 @@ class RoomCreationHandler(BaseHandler): yield self.event_creation_handler.assert_accepted_privacy_policy(requester) + power_level_content_override = config.get("power_level_content_override") + if ( + power_level_content_override + and "users" in power_level_content_override + and user_id not in power_level_content_override["users"] + ): + raise SynapseError( + 400, + "Not a valid power_level_content_override: 'users' did not contain %s" + % (user_id,), + ) + invite_3pid_list = config.get("invite_3pid", []) visibility = config.get("visibility", None) @@ -604,7 +616,7 @@ class RoomCreationHandler(BaseHandler): initial_state=initial_state, creation_content=creation_content, room_alias=room_alias, - power_level_content_override=config.get("power_level_content_override"), + power_level_content_override=power_level_content_override, creator_join_profile=creator_join_profile, ) |