summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2015-08-26 13:49:38 +0100
committerDaniel Wagner-Hall <dawagner@gmail.com>2015-08-26 13:49:38 +0100
commit6f0c344ca7fd6e5dd6109d47ecdf90fa63f75f71 (patch)
tree22fc258521ec6c2e46c84a1cd579deb2ca8a7cfb /synapse/storage
parentMerge pull request #253 from matrix-org/tox (diff)
parentMerge erikj/user_dedup to develop (diff)
downloadsynapse-6f0c344ca7fd6e5dd6109d47ecdf90fa63f75f71.tar.xz
Merge pull request #255 from matrix-org/mergeeriksmadness
Merge erikj/user_dedup to develop
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/registration.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index a2d0f7c4b1..c9ceb132ae 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -120,6 +120,20 @@ class RegistrationStore(SQLBaseStore):
             allow_none=True,
         )
 
+    def get_users_by_id_case_insensitive(self, user_id):
+        """Gets users that match user_id case insensitively.
+        Returns a mapping of user_id -> password_hash.
+        """
+        def f(txn):
+            sql = (
+                "SELECT name, password_hash FROM users"
+                " WHERE lower(name) = lower(?)"
+            )
+            txn.execute(sql, (user_id,))
+            return dict(txn.fetchall())
+
+        return self.runInteraction("get_users_by_id_case_insensitive", f)
+
     @defer.inlineCallbacks
     def user_set_password_hash(self, user_id, password_hash):
         """