forked from rDrama/rDrama
add and remove admin permissions
parent
3cf972ef9a
commit
4aef026594
|
@ -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 = {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue