From 8cef1ab2ac8d1602ea6a087384059d104097140f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 29 Sep 2021 04:32:45 -0600 Subject: Implement MSC3069: Guest support on whoami (#9655) --- synapse/rest/client/account.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'synapse/rest/client') diff --git a/synapse/rest/client/account.py b/synapse/rest/client/account.py index 6a7608d60b..bacb828330 100644 --- a/synapse/rest/client/account.py +++ b/synapse/rest/client/account.py @@ -878,9 +878,13 @@ class WhoamiRestServlet(RestServlet): self.auth = hs.get_auth() async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: - requester = await self.auth.get_user_by_req(request) + requester = await self.auth.get_user_by_req(request, allow_guest=True) - response = {"user_id": requester.user.to_string()} + response = { + "user_id": requester.user.to_string(), + # MSC: https://github.com/matrix-org/matrix-doc/pull/3069 + "org.matrix.msc3069.is_guest": bool(requester.is_guest), + } # Appservices and similar accounts do not have device IDs # that we can report on, so exclude them for compliance. -- cgit 1.4.1