diff options
author | Mathieu Velten <matmaul@gmail.com> | 2020-09-23 17:06:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-23 16:06:28 +0100 |
commit | 916bb9d0d15cf941e73b2e808c553a1edd1c2eb9 (patch) | |
tree | 9938653b43064cd6f66f6fb633f1f00cb24f1fd4 /synapse/storage | |
parent | Fix missing null character check on guest_access room state (#8373) (diff) | |
download | synapse-916bb9d0d15cf941e73b2e808c553a1edd1c2eb9.tar.xz |
Don't push if an user account has expired (#8353)
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/databases/main/registration.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index 675e81fe34..33825e8949 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -116,6 +116,20 @@ class RegistrationWorkerStore(SQLBaseStore): desc="get_expiration_ts_for_user", ) + async def is_account_expired(self, user_id: str, current_ts: int) -> bool: + """ + Returns whether an user account is expired. + + Args: + user_id: The user's ID + current_ts: The current timestamp + + Returns: + Whether the user account has expired + """ + expiration_ts = await self.get_expiration_ts_for_user(user_id) + return expiration_ts is not None and current_ts >= expiration_ts + async def set_account_validity_for_user( self, user_id: str, |