diff options
author | Erik Johnston <erik@matrix.org> | 2018-05-17 14:00:41 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-05-17 14:00:41 +0100 |
commit | 3b505a80dc213f51fbdb76901312db7e13809026 (patch) | |
tree | 4fcf465dfff95dc78f96b13acd0f315a83dad79e /synapse/storage/registration.py | |
parent | Begin adding implementing room chunks (diff) | |
parent | Merge pull request #3212 from matrix-org/erikj/epa_stream (diff) | |
download | synapse-3b505a80dc213f51fbdb76901312db7e13809026.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/chunk_base
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r-- | synapse/storage/registration.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index a50717db2d..8d1a01f1ee 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -286,6 +286,24 @@ class RegistrationStore(RegistrationWorkerStore, "user_set_password_hash", user_set_password_hash_txn ) + def user_set_consent_version(self, user_id, consent_version): + """Updates the user table to record privacy policy consent + + Args: + user_id (str): full mxid of the user to update + consent_version (str): version of the policy the user has consented + to + + Raises: + StoreError(404) if user not found + """ + return self._simple_update_one( + table='users', + keyvalues={'name': user_id, }, + updatevalues={'consent_version': consent_version, }, + desc="user_set_consent_version" + ) + def user_delete_access_tokens(self, user_id, except_token_id=None, device_id=None): """ @@ -526,3 +544,42 @@ class RegistrationStore(RegistrationWorkerStore, except self.database_engine.module.IntegrityError: ret = yield self.get_3pid_guest_access_token(medium, address) defer.returnValue(ret) + + def add_user_pending_deactivation(self, user_id): + """ + Adds a user to the table of users who need to be parted from all the rooms they're + in + """ + return self._simple_insert( + "users_pending_deactivation", + values={ + "user_id": user_id, + }, + desc="add_user_pending_deactivation", + ) + + def del_user_pending_deactivation(self, user_id): + """ + Removes the given user to the table of users who need to be parted from all the + rooms they're in, effectively marking that user as fully deactivated. + """ + return self._simple_delete_one( + "users_pending_deactivation", + keyvalues={ + "user_id": user_id, + }, + desc="del_user_pending_deactivation", + ) + + def get_user_pending_deactivation(self): + """ + Gets one user from the table of users waiting to be parted from all the rooms + they're in. + """ + return self._simple_select_one_onecol( + "users_pending_deactivation", + keyvalues={}, + retcol="user_id", + allow_none=True, + desc="get_users_pending_deactivation", + ) |