summary refs log tree commit diff
path: root/synapse/handlers/directory.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-03-21 10:16:54 +0000
committerGitHub <noreply@github.com>2019-03-21 10:16:54 +0000
commit09f991a63d08fb9dc22cd64b82e251fa6fe1b7ca (patch)
tree70d4b3933adcf129a1fc90e686955468489ebfa9 /synapse/handlers/directory.py
parentLog requests which are simulated by the unit tests. (#4905) (diff)
parentAdd test (diff)
downloadsynapse-09f991a63d08fb9dc22cd64b82e251fa6fe1b7ca.tar.xz
Merge pull request #4896 from matrix-org/erikj/disable_room_directory
Add option to disable search room lists
Diffstat (limited to 'synapse/handlers/directory.py')
-rw-r--r--synapse/handlers/directory.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py
index 8b113307d2..fe128d9c88 100644
--- a/synapse/handlers/directory.py
+++ b/synapse/handlers/directory.py
@@ -44,6 +44,7 @@ class DirectoryHandler(BaseHandler):
         self.appservice_handler = hs.get_application_service_handler()
         self.event_creation_handler = hs.get_event_creation_handler()
         self.config = hs.config
+        self.enable_room_list_search = hs.config.enable_room_list_search
 
         self.federation = hs.get_federation_client()
         hs.get_federation_registry().register_query_handler(
@@ -411,6 +412,13 @@ class DirectoryHandler(BaseHandler):
         if visibility not in ["public", "private"]:
             raise SynapseError(400, "Invalid visibility setting")
 
+        if visibility == "public" and not self.enable_room_list_search:
+            # The room list has been disabled.
+            raise AuthError(
+                403,
+                "This user is not permitted to publish rooms to the room list"
+            )
+
         room = yield self.store.get_room(room_id)
         if room is None:
             raise SynapseError(400, "Unknown room")