forked from arti/doors
List user keycards on user info page
This commit is contained in:
parent
de8af3cb0d
commit
472c762de2
@ -152,6 +152,10 @@ class DB:
|
||||
""", keycards)
|
||||
self.db.commit()
|
||||
|
||||
def get_user_keycards(self, user_id):
|
||||
cur = self.db.execute("select id, name, created, disabled from keycards where user_id = ?", (user_id,))
|
||||
return cur.fetchall()
|
||||
|
||||
@staticmethod
|
||||
def import_ad(json_file):
|
||||
with open(json_file) as fp:
|
||||
|
@ -128,7 +128,8 @@ def info(db, user_id):
|
||||
user = db.get_user(user_id)
|
||||
if not user:
|
||||
raise HTTPError(404, "User does not exist")
|
||||
return {**user, "keycards": []}
|
||||
keycards = db.get_user_keycards(user_id)
|
||||
return {**user, "keycards": keycards}
|
||||
|
||||
|
||||
@app.route("/log")
|
||||
|
Loading…
Reference in New Issue
Block a user