summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-31 15:42:51 +0100
committerNeil Johnson <neil@matrix.org>2018-08-31 15:42:51 +0100
commit09f3cf1a7ef0c533d052a5c87257503b710093c6 (patch)
tree527504fc38a6763a2ea9b1453f3332fbfd9f820b /synapse/storage
parentnews fragemnt (diff)
downloadsynapse-09f3cf1a7ef0c533d052a5c87257503b710093c6.tar.xz
ensure post registration auth checks do not fail erroneously
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/monthly_active_users.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/synapse/storage/monthly_active_users.py b/synapse/storage/monthly_active_users.py
index d178f5c5ba..173867c4b1 100644
--- a/synapse/storage/monthly_active_users.py
+++ b/synapse/storage/monthly_active_users.py
@@ -36,7 +36,6 @@ class MonthlyActiveUsersStore(SQLBaseStore):
 
     @defer.inlineCallbacks
     def initialise_reserved_users(self, threepids):
-        # TODO Why can't I do this in init?
         store = self.hs.get_datastore()
         reserved_user_list = []
 
@@ -220,3 +219,17 @@ class MonthlyActiveUsersStore(SQLBaseStore):
                     yield self.upsert_monthly_active_user(user_id)
             elif now - last_seen_timestamp > LAST_SEEN_GRANULARITY:
                 yield self.upsert_monthly_active_user(user_id)
+
+    def is_threepid_reserved(self, threepid):
+        """Check the threepid against the reserved threepid config
+        Args:
+            threepid(dict) - The threepid to test for
+        Returns:
+            boolean Is the threepid undertest reserved_user
+        """
+        for tp in self.hs.config.mau_limits_reserved_threepids:
+            if (threepid['medium'] == tp['medium']
+                    and threepid['address'] == tp['address']):
+                return True
+            else:
+                return False