summary refs log tree commit diff
path: root/synapse/rest/client/account.py
diff options
context:
space:
mode:
authorTravis Ralston <travisr@matrix.org>2021-09-29 04:32:45 -0600
committerGitHub <noreply@github.com>2021-09-29 11:32:45 +0100
commit8cef1ab2ac8d1602ea6a087384059d104097140f (patch)
tree1181566711a70789b31c2b58265172677793f042 /synapse/rest/client/account.py
parentUse `RoomVersion` objects (#10934) (diff)
downloadsynapse-8cef1ab2ac8d1602ea6a087384059d104097140f.tar.xz
Implement MSC3069: Guest support on whoami (#9655)
Diffstat (limited to 'synapse/rest/client/account.py')
-rw-r--r--synapse/rest/client/account.py8
1 files changed, 6 insertions, 2 deletions
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.