summary refs log tree commit diff
path: root/synapse/handlers/room.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-20 16:05:22 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-20 16:05:22 +0000
commit96efc4d179c2990560013bf294d36713073c3b9c (patch)
tree442776a8de76c011c51c087cc30be35789934f77 /synapse/handlers/room.py
parentMerge pull request #5844 from matrix-org/erikj/retry_well_known_lookup (diff)
parentDon't create broken room when power_level_content_override.users does not con... (diff)
downloadsynapse-96efc4d179c2990560013bf294d36713073c3b9c.tar.xz
Don't create broken room when power_level_content_override.users does not contain creator_id. (#5633)
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r--synapse/handlers/room.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index af7cfa7888..c1e5b6bd1b 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -579,6 +579,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,),
+            )
+
         visibility = config.get("visibility", None)
         is_public = visibility == "public"
 
@@ -621,7 +633,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,
         )