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 currDate = i
if i >= datetime.now(tz).strftime("%Y-%m-%d"): if i >= datetime.now(tz).strftime("%Y-%m-%d"):
break 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': elif pl == 'group':
classes = db.child("Users").child( classes = db.child("Users").child(
session['uid']).child("class").get().val() session['uid']).child("class").get().val()
@ -577,7 +580,8 @@ def upload_admin_acc():
row['username'] + '@group-attendance.fhjh.tp.edu.tw', row['password']) row['username'] + '@group-attendance.fhjh.tp.edu.tw', row['password'])
db.child("Users").child(user['localId']).update({ db.child("Users").child(user['localId']).update({
'permission': 'admin', 'permission': 'admin',
'username': row['username'] 'username': row['username'],
'showUpload': row['permission']
}) })
os.remove(filepath) os.remove(filepath)
except Exception as e: except Exception as e:

View file

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