summary refs log tree commit diff
path: root/synapse/handlers/room.py
diff options
context:
space:
mode:
authorPeerD <github@spy.de>2020-04-13 13:42:32 +0200
committerGitHub <noreply@github.com>2020-04-13 07:42:32 -0400
commitf41b74216140692fcbae68a11d44a0d041d4ae53 (patch)
tree24d2a7a2aadd579216cdf699ec6a1a296e456d88 /synapse/handlers/room.py
parenttypos (diff)
downloadsynapse-f41b74216140692fcbae68a11d44a0d041d4ae53.tar.xz
Check on room creation if the user is allowed to publish the room to the room directory. (#7260)
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r--synapse/handlers/room.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index df3e0cff67..3d10e4b2d9 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -645,6 +645,13 @@ class RoomCreationHandler(BaseHandler):
                 check_membership=False,
             )
 
+        if is_public:
+            if not self.config.is_publishing_room_allowed(user_id, room_id, room_alias):
+                # Lets just return a generic message, as there may be all sorts of
+                # reasons why we said no. TODO: Allow configurable error messages
+                # per alias creation rule?
+                raise SynapseError(403, "Not allowed to publish room")
+
         preset_config = config.get(
             "preset",
             RoomCreationPreset.PRIVATE_CHAT