summaryrefslogtreecommitdiffstats
path: root/module/UserDatabase.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/UserDatabase.py')
-rw-r--r--module/UserDatabase.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/module/UserDatabase.py b/module/UserDatabase.py
index 54852fae1..471363cf9 100644
--- a/module/UserDatabase.py
+++ b/module/UserDatabase.py
@@ -49,5 +49,22 @@ class UserMethods():
c.execute('UPDATE users SET password=? WHERE name=?', (password, user))
else:
c.execute('INSERT INTO users (name, password) VALUES (?, ?)', (user, password))
+
+ @style.queue
+ def listUsers(db):
+ c = db.createCursor()
+ c.execute('SELECT name FROM users')
+ users = []
+ for row in c.fetchall():
+ users.append(row[0])
+ return users
+
+ @style.queue
+ def removeUser(db, user):
+ c = db.createCursor()
+ c.execute('SELECT name FROM users WHERE name=?', (user, ))
+ if c.fetchone() is not None:
+ c.execute('DELETE FROM users WHERE name=?', (user, ))
+
DatabaseBackend.registerSub(UserMethods)