diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-11-17 16:59:24 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-11-17 16:59:24 +0000 |
commit | 31a049eb692d37387a2db972da754f7ec56218c7 (patch) | |
tree | 9e5f47abad904d30c08d2f340b543a631e436894 /synapse/storage/registration.py | |
parent | Include room membership in room initialSync (diff) | |
parent | SYN-148: Add the alias after creating the room (diff) | |
download | synapse-31a049eb692d37387a2db972da754f7ec56218c7.tar.xz |
Merge branch 'develop' into room-initial-sync
Conflicts: synapse/handlers/message.py
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r-- | synapse/storage/registration.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index 719806f82b..1f89d77344 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -62,8 +62,10 @@ class RegistrationStore(SQLBaseStore): Raises: StoreError if the user_id could not be registered. """ - yield self.runInteraction(self._register, user_id, token, - password_hash) + yield self.runInteraction( + "register", + self._register, user_id, token, password_hash + ) def _register(self, txn, user_id, token, password_hash): now = int(self.clock.time()) @@ -100,17 +102,22 @@ class RegistrationStore(SQLBaseStore): StoreError if no user was found. """ return self.runInteraction( + "get_user_by_token", self._query_for_auth, token ) + @defer.inlineCallbacks def is_server_admin(self, user): - return self._simple_select_one_onecol( + res = yield self._simple_select_one_onecol( table="users", keyvalues={"name": user.to_string()}, retcol="admin", + allow_none=True, ) + defer.returnValue(res if res else False) + def _query_for_auth(self, txn, token): sql = ( "SELECT users.name, users.admin, access_tokens.device_id " |