summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-08-17 21:50:53 +0100
committerMatthew Hodgson <matthew@matrix.org>2017-08-17 21:50:53 +0100
commitb20602eeb87d5cba05ae6f1b808c4295cdbc4e3f (patch)
tree4a7c4a5ff9d9585d04fe7fa7afe0c57781a38e9a
parentFix user_dir startup (diff)
downloadsynapse-github/matthew/hide-public-rooms.tar.xz
add option to require auth for reading room dir github/matthew/hide-public-rooms matthew/hide-public-rooms
-rw-r--r--synapse/config/server.py8
-rw-r--r--synapse/rest/client/v1/room.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/synapse/config/server.py b/synapse/config/server.py
index 89d61a0503..00cad1e9c5 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -43,6 +43,9 @@ class ServerConfig(Config):
 
         self.filter_timeline_limit = config.get("filter_timeline_limit", -1)
 
+        self.require_auth_for_room_directory = \
+            config.get("require_auth_for_room_directory", False)
+
         if self.public_baseurl is not None:
             if self.public_baseurl[-1] != '/':
                 self.public_baseurl += '/'
@@ -194,6 +197,11 @@ class ServerConfig(Config):
         # and sync operations. The default value is -1, means no upper limit.
         # filter_timeline_limit: 5000
 
+        # Set whether this server's public room directory is restricted to
+        # local authenticated users, or visible to the wider world.
+        # Default is to be visible to the wider world.
+        require_auth_for_room_directory: False
+
         # List of ports that Synapse should listen on, their purpose and their
         # configuration.
         listeners:
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py
index cd388770c8..6ab9cdc116 100644
--- a/synapse/rest/client/v1/room.py
+++ b/synapse/rest/client/v1/room.py
@@ -294,7 +294,7 @@ class PublicRoomListRestServlet(ClientV1RestServlet):
             # In both cases we call the auth function, as that has the side
             # effect of logging who issued this request if an access token was
             # provided.
-            if server:
+            if server or self.hs.config.require_auth_for_room_directory:
                 raise e
             else:
                 pass