summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-29 13:35:38 +0100
committerErik Johnston <erik@matrix.org>2014-09-29 13:35:38 +0100
commitc65306f8779d480a10b6ce318e73b458538e1eef (patch)
tree5d4b8b93b37f60b77cfecac95bc0ce9e9356918e /synapse/storage
parentSYN-48: Track User-Agents as well as IPs for client devices. (diff)
downloadsynapse-c65306f8779d480a10b6ce318e73b458538e1eef.tar.xz
Add auth check to test if a user is an admin or not.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/registration.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py

index db20b1daa0..f32b000cb6 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py
@@ -103,6 +103,14 @@ class RegistrationStore(SQLBaseStore): token) defer.returnValue(user_id) + @defer.inlineCallbacks + def is_server_admin(self, user): + return self._simple_select_one_onecol( + table="users", + keyvalues={"name": user.to_string()}, + retcol="admin", + ) + def _query_for_auth(self, txn, token): txn.execute("SELECT users.name FROM access_tokens LEFT JOIN users" + " ON users.id = access_tokens.user_id WHERE token = ?",