From c813f52c1a87ebbb642d7c13cc1cc064b5a004c0 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 20:29:14 -0700 Subject: [PATCH] view active users perm --- files/helpers/const.py | 1 + files/routes/admin.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index f977abd97..f54dd597d 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -146,6 +146,7 @@ PERMS = { # Minimum admin_level to perform action. 'LOTTERY_VIEW_PARTICIPANTS': 2, 'VIEW_MODMAIL': 2, 'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3, + 'VIEW_ACTIVE_USERS': 2, } FEATURES = { diff --git a/files/routes/admin.py b/files/routes/admin.py index cd81a72a5..7b6f043c1 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -31,14 +31,14 @@ def kippy(v): return '10k marseycoins printed!' @app.get('/admin/loggedin') -@admin_level_required(2) +@admin_level_required(PERMS['VIEW_ACTIVE_USERS']) def loggedin_list(v): ids = [x for x,val in cache.get(f'{SITE}_loggedin').items() if time.time()-val < LOGGEDIN_ACTIVE_TIME] users = g.db.query(User).filter(User.id.in_(ids)).order_by(User.admin_level.desc(), User.truecoins.desc()).all() return render_template("loggedin.html", v=v, users=users) @app.get('/admin/loggedout') -@admin_level_required(2) +@admin_level_required(PERMS['VIEW_ACTIVE_USERS']) def loggedout_list(v): users = sorted([val[1] for x,val in cache.get(f'{SITE}_loggedout').items() if time.time()-val[0] < LOGGEDIN_ACTIVE_TIME]) return render_template("loggedout.html", v=v, users=users)