Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add user_directory_search_enabled check
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowJonathan committed Mar 19, 2022
1 parent 87a9899 commit 9ab447c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions synapse/rest/client/shared_rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,19 @@ def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth()
self.store = hs.get_datastore()
self.user_directory_active = hs.config.server.update_user_directory
self.hs = hs

async def on_GET(
self, request: SynapseRequest, user_id: str
) -> Tuple[int, JsonDict]:

if not self.hs.config.userdirectory.user_directory_search_enabled:
raise SynapseError(
code=400,
msg="User directory searching is disabled",
errcode=Codes.UNKNOWN,
)

UserID.from_string(user_id)

requester = await self.auth.get_user_by_req(request)
Expand Down

0 comments on commit 9ab447c

Please sign in to comment.