asset submissions permissions

master
justcool393 2022-10-05 20:15:10 -07:00
parent c2109fd611
commit c0f753e101
2 changed files with 10 additions and 6 deletions

View File

@ -137,6 +137,10 @@ PERMS = { # Minimum admin_level to perform action.
'BYPASS_PIN_LIMIT': 3, 'BYPASS_PIN_LIMIT': 3,
'VIEW_PENDING_SUBMITTED_MARSEYS': 3, 'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
'VIEW_PENDING_SUBMITTED_HATS': 3, 'VIEW_PENDING_SUBMITTED_HATS': 3,
'MODERATE_PENDING_SUBMITTED_MARSEYS': 3, # note: there is an extra check so that only """carp""" can approve them
'MODERATE_PENDING_SUBMITTED_HATS': 3, # note: there is an extra check so that only """carp""" can approve them
'UPDATE_MARSEYS': 3, # note: extra check is here for 4 different users
'UPDATE_HATS': 3, # note: extra check is here for 4 different users
'BUY_GHOST_AWARD': 2, 'BUY_GHOST_AWARD': 2,
'LOTTERY_ADMIN': 3, 'LOTTERY_ADMIN': 3,
'LOTTERY_VIEW_PARTICIPANTS': 2, 'LOTTERY_VIEW_PARTICIPANTS': 2,

View File

@ -92,7 +92,7 @@ def submit_marsey(v):
@app.post("/admin/approve/marsey/<name>") @app.post("/admin/approve/marsey/<name>")
@admin_level_required(3) @admin_level_required(PERMS['MODERATE_PENDING_SUBMITTED_MARSEYS'])
def approve_marsey(v, name): def approve_marsey(v, name):
if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID): if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID):
return {"error": "Only Carp can approve marseys!"}, 403 return {"error": "Only Carp can approve marseys!"}, 403
@ -251,7 +251,7 @@ def submit_hat(v):
@app.post("/admin/approve/hat/<name>") @app.post("/admin/approve/hat/<name>")
@admin_level_required(3) @admin_level_required(PERMS['MODERATE_PENDING_SUBMITTED_HATS'])
def approve_hat(v, name): def approve_hat(v, name):
if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID): if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID):
return {"error": "Only Carp can approve hats!"}, 403 return {"error": "Only Carp can approve hats!"}, 403
@ -345,7 +345,7 @@ def remove_hat(v, name):
@app.get("/admin/update/marseys") @app.get("/admin/update/marseys")
@admin_level_required(3) @admin_level_required(PERMS['UPDATE_MARSEYS'])
def update_marseys(v): def update_marseys(v):
if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID): if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
abort(403) abort(403)
@ -354,7 +354,7 @@ def update_marseys(v):
@app.post("/admin/update/marseys") @app.post("/admin/update/marseys")
@admin_level_required(3) @admin_level_required(PERMS['UPDATE_MARSEYS'])
def update_marsey(v): def update_marsey(v):
if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID): if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
abort(403) abort(403)
@ -408,7 +408,7 @@ def update_marsey(v):
@app.get("/admin/update/hats") @app.get("/admin/update/hats")
@admin_level_required(3) @admin_level_required(PERMS['UPDATE_HATS'])
def update_hats(v): def update_hats(v):
if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID): if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
abort(403) abort(403)
@ -417,7 +417,7 @@ def update_hats(v):
@app.post("/admin/update/hats") @app.post("/admin/update/hats")
@admin_level_required(3) @admin_level_required(PERMS['UPDATE_HATS'])
def update_hat(v): def update_hat(v):
if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID): if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
abort(403) abort(403)