List user keycards on user info page
This commit is contained in:
parent
de8af3cb0d
commit
472c762de2
@ -152,6 +152,10 @@ class DB:
|
|||||||
""", keycards)
|
""", keycards)
|
||||||
self.db.commit()
|
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
|
@staticmethod
|
||||||
def import_ad(json_file):
|
def import_ad(json_file):
|
||||||
with open(json_file) as fp:
|
with open(json_file) as fp:
|
||||||
|
@ -128,7 +128,8 @@ def info(db, user_id):
|
|||||||
user = db.get_user(user_id)
|
user = db.get_user(user_id)
|
||||||
if not user:
|
if not user:
|
||||||
raise HTTPError(404, "User does not exist")
|
raise HTTPError(404, "User does not exist")
|
||||||
return {**user, "keycards": []}
|
keycards = db.get_user_keycards(user_id)
|
||||||
|
return {**user, "keycards": keycards}
|
||||||
|
|
||||||
|
|
||||||
@app.route("/log")
|
@app.route("/log")
|
||||||
|
Loading…
Reference in New Issue
Block a user