add and remove admin permissions

remotes/1693176582716663532/tmp_refs/heads/watchparty
justcool393 2022-10-05 20:37:18 -07:00
parent 3cf972ef9a
commit 4aef026594
2 changed files with 6 additions and 3 deletions

View File

@ -148,6 +148,9 @@ PERMS = { # Minimum admin_level to perform action.
'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
'VIEW_ACTIVE_USERS': 2,
'MERGE_USERS': 3, # note: extra check for Aevann
'ADMIN_ADD': 3, # note: explicitly disabled on rDrama
'ADMIN_REMOVE': 3,
'ADMIN_ADD_PERM_LEVEL': 2, # permission level given when user added via site
}
FEATURES = {

View File

@ -156,13 +156,13 @@ def merge_all(v, id):
@app.post("/@<username>/make_admin")
@admin_level_required(3)
@admin_level_required(PERMS['ADMIN_ADD'])
def make_admin(v, username):
if SITE == 'rdrama.net': abort(403)
user = get_user(username)
user.admin_level = 2
user.admin_level = PERMS['ADMIN_ADD_PERM_LEVEL']
g.db.add(user)
ma = ModAction(
@ -176,7 +176,7 @@ def make_admin(v, username):
@app.post("/@<username>/remove_admin")
@admin_level_required(3)
@admin_level_required(PERMS['ADMIN_REMOVE'])
def remove_admin(v, username):
user = get_user(username)
user.admin_level = 0