From dfae62ad68d8890da717acd330a7cf09487ebbfa Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Wed, 15 Sep 2021 22:45:34 +0800 Subject: [PATCH] Added admin_acc permission level filtering --- app.py | 8 ++++++-- templates/admin.html | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index a24fe6a..98e5bba 100644 --- a/app.py +++ b/app.py @@ -79,7 +79,10 @@ def manageProcess(fCommand, fData): currDate = i if i >= datetime.now(tz).strftime("%Y-%m-%d"): break - return render_template('admin.html', homerooms=homerooms, absData=absData, homeroomCode=currRoom, homeroomData=homeroomData, currDate=currDate, periods=['m', '1', '2', '3', '4', 'n', '5', '6', '7', '8', '9']) + return render_template('admin.html', homerooms=homerooms, absData=absData, + homeroomCode=currRoom, homeroomData=homeroomData, currDate=currDate, periods=['m', '1', '2', '3', '4', + 'n', '5', '6', '7', '8', '9'], showUpload=db.child("Users").child( + session['uid']).child("showUpload").get().val()) elif pl == 'group': classes = db.child("Users").child( session['uid']).child("class").get().val() @@ -577,7 +580,8 @@ def upload_admin_acc(): row['username'] + '@group-attendance.fhjh.tp.edu.tw', row['password']) db.child("Users").child(user['localId']).update({ 'permission': 'admin', - 'username': row['username'] + 'username': row['username'], + 'showUpload': row['permission'] }) os.remove(filepath) except Exception as e: diff --git a/templates/admin.html b/templates/admin.html index 5aeca9b..5d7cc24 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -164,6 +164,7 @@ {% endif %} {% endfor %} + {% if showUpload == '1' %}

此排請勿點選

@@ -184,6 +185,7 @@
+ {% endif %}