mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 16:34:49 -04:00
Send users a server notice about consent
When a user first syncs, we will send them a server notice asking them to consent to the privacy policy if they have not already done so.
This commit is contained in:
parent
d14d7b8fdc
commit
9ea219c514
11 changed files with 255 additions and 11 deletions
|
@ -33,7 +33,10 @@ class RegistrationWorkerStore(SQLBaseStore):
|
|||
keyvalues={
|
||||
"name": user_id,
|
||||
},
|
||||
retcols=["name", "password_hash", "is_guest"],
|
||||
retcols=[
|
||||
"name", "password_hash", "is_guest",
|
||||
"consent_version", "consent_server_notice_sent",
|
||||
],
|
||||
allow_none=True,
|
||||
desc="get_user_by_id",
|
||||
)
|
||||
|
@ -297,12 +300,41 @@ class RegistrationStore(RegistrationWorkerStore,
|
|||
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 f(txn):
|
||||
self._simple_update_one_txn(
|
||||
txn,
|
||||
table='users',
|
||||
keyvalues={'name': user_id, },
|
||||
updatevalues={'consent_version': consent_version, },
|
||||
)
|
||||
self._invalidate_cache_and_stream(
|
||||
txn, self.get_user_by_id, (user_id,)
|
||||
)
|
||||
return self.runInteraction("user_set_consent_version", f)
|
||||
|
||||
def user_set_consent_server_notice_sent(self, user_id, consent_version):
|
||||
"""Updates the user table to record that we have sent the user a server
|
||||
notice about privacy policy consent
|
||||
|
||||
Args:
|
||||
user_id (str): full mxid of the user to update
|
||||
consent_version (str): version of the policy we have notified the
|
||||
user about
|
||||
|
||||
Raises:
|
||||
StoreError(404) if user not found
|
||||
"""
|
||||
def f(txn):
|
||||
self._simple_update_one_txn(
|
||||
txn,
|
||||
table='users',
|
||||
keyvalues={'name': user_id, },
|
||||
updatevalues={'consent_server_notice_sent': consent_version, },
|
||||
)
|
||||
self._invalidate_cache_and_stream(
|
||||
txn, self.get_user_by_id, (user_id,)
|
||||
)
|
||||
return self.runInteraction("user_set_consent_server_notice_sent", f)
|
||||
|
||||
def user_delete_access_tokens(self, user_id, except_token_id=None,
|
||||
device_id=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue