diff options
Diffstat (limited to 'pyload/database/User.py')
-rw-r--r-- | pyload/database/User.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/pyload/database/User.py b/pyload/database/User.py index 52b05749f..94f70d499 100644 --- a/pyload/database/User.py +++ b/pyload/database/User.py @@ -7,9 +7,9 @@ import random from pyload.database import DatabaseBackend, style class UserMethods(object): - @style.queue + @style.queue def checkAuth(db, user, password): c = db.c c.execute('SELECT id, name, password, role, permission, template, email FROM "users" WHERE name=?', (user,)) @@ -26,9 +26,8 @@ class UserMethods(object): else: return {} - @style.queue - + @style.queue def addUser(db, user, password): salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for i in range(0, 5)]) h = sha1(salt + password) @@ -43,8 +42,6 @@ class UserMethods(object): @style.queue - - def changePassword(db, user, oldpw, newpw): db.c.execute('SELECT id, name, password FROM users WHERE name=?', (user,)) r = db.c.fetchone() @@ -66,21 +63,16 @@ class UserMethods(object): @style.async - - def setPermission(db, user, perms): db.c.execute("UPDATE users SET permission=? WHERE name=?", (perms, user)) - @style.async - + @style.async def setRole(db, user, role): db.c.execute("UPDATE users SET role=? WHERE name=?", (role, user)) @style.queue - - def listUsers(db): db.c.execute('SELECT name FROM users') users = [] @@ -88,9 +80,8 @@ class UserMethods(object): users.append(row[0]) return users - @style.queue - + @style.queue def getAllUserData(db): db.c.execute("SELECT name, permission, role, template, email FROM users") user = {} @@ -99,9 +90,8 @@ class UserMethods(object): return user - @style.queue - + @style.queue def removeUser(db, user): db.c.execute('DELETE FROM users WHERE name=?', (user,)) |