diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-28 13:39:42 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-28 13:39:42 +0100 |
commit | 327ca883ec51780ea2a914d3c89ca0499f4656ac (patch) | |
tree | dc3f2c06cdbbfce8b1d1bb6a4db31a8852f5b43a /synapse/storage/__init__.py | |
parent | Quickly fix dodgy est. time remaining (diff) | |
parent | Merge pull request #126 from matrix-org/csauth (diff) | |
download | synapse-327ca883ec51780ea2a914d3c89ca0499f4656ac.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into postgres
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r-- | synapse/storage/__init__.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index 995114e405..61215bbc7b 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -487,3 +487,15 @@ def prepare_sqlite3_database(db_conn): " VALUES (?,?)", (row[0], False) ) + + +def are_all_users_on_domain(txn, database_engine, domain): + sql = database_engine.convert_param_style( + "SELECT COUNT(*) FROM users WHERE name NOT LIKE ?" + ) + pat = "%:" + domain + txn.execute(sql, (pat,)) + num_not_matching = txn.fetchall()[0][0] + if num_not_matching == 0: + return True + return False |