Add option to disable searching in the user dir

We still populate it, as it can still be accessed via the admin API.
This commit is contained in:
Erik Johnston 2019-03-19 16:40:19 +00:00
parent 11f2125885
commit 320667a479
2 changed files with 13 additions and 0 deletions

View file

@ -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)