summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-03-19 16:40:19 +0000
committerErik Johnston <erik@matrix.org>2019-03-19 16:40:19 +0000
commit320667a47977ebbc9a1c0f320a06c80f953a4f86 (patch)
treea30709c39d10393807749e2890a6ec3318bc6494 /synapse/rest
parentMerge pull request #4894 from matrix-org/erikj/postgres_tuning (diff)
downloadsynapse-320667a47977ebbc9a1c0f320a06c80f953a4f86.tar.xz
Add option to disable searching in the user dir
We still populate it, as it can still be accessed via the admin API.
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/user_directory.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/user_directory.py b/synapse/rest/client/v2_alpha/user_directory.py
index cac0624ba7..36b02de37f 100644
--- a/synapse/rest/client/v2_alpha/user_directory.py
+++ b/synapse/rest/client/v2_alpha/user_directory.py
@@ -59,6 +59,12 @@ class UserDirectorySearchRestServlet(RestServlet):
         requester = yield self.auth.get_user_by_req(request, allow_guest=False)
         user_id = requester.user.to_string()
 
+        if not self.hs.config.user_directory_search_enabled:
+            defer.returnValue((200, {
+                "limited": False,
+                "results": [],
+            }))
+
         body = parse_json_object_from_request(request)
 
         limit = body.get("limit", 10)