Added admin_acc permission level filtering

This commit is contained in:
Aaron Lee 2021-09-15 22:45:34 +08:00
parent ecde63333d
commit dfae62ad68
2 changed files with 8 additions and 2 deletions

8
app.py
View file

@ -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:

View file

@ -164,6 +164,7 @@
{% endif %}
{% endfor %}
</div>
{% if showUpload == '1' %}
<div class="row margin-top">
<div class="col">
<h3>此排請勿點選</h3>
@ -184,6 +185,7 @@
<a href="/upload/dates"><button class="btn btn-primary">[WEEKLY] Dates</button></a>
</div>
</div>
{% endif %}
</div>
<script type="text/javascript" src="/static/jquery.min.js"></script>