summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-05-29 20:25:12 +0100
committerGitHub <noreply@github.com>2018-05-29 20:25:12 +0100
commit711f61a31d581bd7392ddc56ac87e6309607c974 (patch)
treeeb66dac49778e24d1d91a61b1c41f42b12335101
parentMerge pull request #3302 from krombel/py3_extend_tox_testing (diff)
parentfix tests (diff)
downloadsynapse-711f61a31d581bd7392ddc56ac87e6309607c974.tar.xz
Merge pull request #3304 from matrix-org/rav/exempt_as_users_from_gdpr
Exempt AS-registered users from doing gdpr
-rw-r--r--synapse/handlers/message.py3
-rw-r--r--synapse/storage/registration.py1
-rw-r--r--tests/storage/test_registration.py1
3 files changed, 5 insertions, 0 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 81cff0870e..1cb81b6cf8 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -572,6 +572,9 @@ class EventCreationHandler(object):
 
         u = yield self.store.get_user_by_id(user_id)
         assert u is not None
+        if u["appservice_id"] is not None:
+            # users registered by an appservice are exempt
+            return
         if u["consent_version"] == self.config.user_consent_version:
             return
 
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index a530e29f43..40f7cc16ee 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -36,6 +36,7 @@ class RegistrationWorkerStore(SQLBaseStore):
             retcols=[
                 "name", "password_hash", "is_guest",
                 "consent_version", "consent_server_notice_sent",
+                "appservice_id",
             ],
             allow_none=True,
             desc="get_user_by_id",
diff --git a/tests/storage/test_registration.py b/tests/storage/test_registration.py
index cc637dda1c..f863b75846 100644
--- a/tests/storage/test_registration.py
+++ b/tests/storage/test_registration.py
@@ -49,6 +49,7 @@ class RegistrationStoreTestCase(unittest.TestCase):
                 "is_guest": 0,
                 "consent_version": None,
                 "consent_server_notice_sent": None,
+                "appservice_id": None,
             },
             (yield self.store.get_user_by_id(self.user_id))
         )