diff options
author | Erik Johnston <erik@matrix.org> | 2015-08-21 12:51:14 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-08-21 12:51:14 +0100 |
commit | 5dbd10247055dd6c216503b69902a6e235fcb7e8 (patch) | |
tree | f0e05422ef4f880b9b4f4eeece4624feffd3b528 /synapse/storage | |
parent | Fix bug where we didn't correctly serialize the redacted_because key over fed... (diff) | |
parent | Doc string (diff) | |
download | synapse-5dbd10247055dd6c216503b69902a6e235fcb7e8.tar.xz |
Merge branch 'erikj/user_dedup' into release-v0.10.0
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/registration.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index bf803f2c6e..586628579d 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -98,6 +98,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): """ |