summary refs log tree commit diff
path: root/synapse/api/auth.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-11-25 15:25:30 +0000
committerRichard van der Hoff <richard@matrix.org>2016-11-25 15:25:30 +0000
commit7f02e4d0085b7df0429a298162f7c22b6e19c095 (patch)
tree3aaef324585308f29839743e45dbed9366aef1fd /synapse/api/auth.py
parentMerge pull request #1638 from matrix-org/kegan/sync-event-fields (diff)
downloadsynapse-7f02e4d0085b7df0429a298162f7c22b6e19c095.tar.xz
Give guest users a device_id
We need to create devices for guests so that they can use e2e, but we don't
have anywhere to store it, so just use a fixed one.
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r--synapse/api/auth.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 69b3392735..4321ec26f1 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -39,6 +39,9 @@ AuthEventTypes = (
     EventTypes.ThirdPartyInvite,
 )
 
+# guests always get this device id.
+GUEST_DEVICE_ID = "guest_device"
+
 
 class Auth(object):
     """
@@ -728,7 +731,8 @@ class Auth(object):
                     "user": user,
                     "is_guest": True,
                     "token_id": None,
-                    "device_id": None,
+                    # all guests get the same device id
+                    "device_id": GUEST_DEVICE_ID,
                 }
             elif rights == "delete_pusher":
                 # We don't store these tokens in the database