summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-05-22 12:01:43 +0100
committerGitHub <noreply@github.com>2018-05-22 12:01:43 +0100
commit3b2def6c7a83584d064d550cf5a1df4320f19922 (patch)
tree7cce87b9e5550e8d041030a518060e0f2f212614 /synapse/config
parentMerge pull request #3236 from matrix-org/rav/consent_notice (diff)
parentReject attempts to send event before privacy consent is given (diff)
downloadsynapse-3b2def6c7a83584d064d550cf5a1df4320f19922.tar.xz
Merge pull request #3257 from matrix-org/rav/fonx_on_no_consent
Reject attempts to send event before privacy consent is given
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/consent_config.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/config/consent_config.py b/synapse/config/consent_config.py
index 8698b2993f..44c4711e6c 100644
--- a/synapse/config/consent_config.py
+++ b/synapse/config/consent_config.py
@@ -34,6 +34,10 @@ DEFAULT_CONFIG = """\
 # asking them to consent to the privacy policy. The 'server_notices' section
 # must also be configured for this to work.
 #
+# 'block_events_error', if set, will block any attempts to send events
+# until the user consents to the privacy policy. The value of the setting is
+# used as the text of the error.
+#
 # user_consent:
 #   template_dir: res/templates/privacy
 #   version: 1.0
@@ -41,6 +45,8 @@ DEFAULT_CONFIG = """\
 #     msgtype: m.text
 #     body: |
 #       Pls do consent kthx
+#   block_events_error: |
+#     You can't send any messages until you consent to the privacy policy.
 """
 
 
@@ -51,6 +57,7 @@ class ConsentConfig(Config):
         self.user_consent_version = None
         self.user_consent_template_dir = None
         self.user_consent_server_notice_content = None
+        self.block_events_without_consent_error = None
 
     def read_config(self, config):
         consent_config = config.get("user_consent")
@@ -61,6 +68,9 @@ class ConsentConfig(Config):
         self.user_consent_server_notice_content = consent_config.get(
             "server_notice_content",
         )
+        self.block_events_without_consent_error = consent_config.get(
+            "block_events_error",
+        )
 
     def default_config(self, **kwargs):
         return DEFAULT_CONFIG