zilencer: Tie RemotePushDeviceToken to RemoteRealm at registration.

This consists of the following pieces:
1. Makes servers using the bouncer send realm_uuid in requests for token
   registration. (Sidenote: realm_uuid is already sent in the "send
   notification" codepath as of
   48db4bf854)
2. This allows the bouncer to tie RemotePushDeviceToken to the
   RemoteRealm with matching realm_uuid at registration time.
3. Introduce handling of some potential weird edge cases around the
   realm_uuid and RemoteRealm objects in get_remote_realm_helper.
This commit is contained in:
Mateusz Mandera
2023-12-01 22:57:34 +01:00
committed by Tim Abbott
parent c9b0602320
commit 7f33d6f0ea
5 changed files with 153 additions and 7 deletions

View File

@@ -80,6 +80,8 @@ class RemotePushDeviceToken(AbstractPushDeviceToken):
user_id = models.BigIntegerField(null=True)
user_uuid = models.UUIDField(null=True)
remote_realm = models.ForeignKey("RemoteRealm", on_delete=models.SET_NULL, null=True)
class Meta:
unique_together = [
# These indexes rely on the property that in Postgres,