allow me to remove/approve marseys and hats

master
Aevann1 2022-09-17 20:43:50 +02:00
parent bd81d5f0ed
commit 1d184661e1
1 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ def submit_marsey(v):
@app.post("/admin/approve/marsey/<name>") @app.post("/admin/approve/marsey/<name>")
@admin_level_required(3) @admin_level_required(3)
def approve_marsey(v, name): def approve_marsey(v, name):
if CARP_ID and v.id != CARP_ID: if v.id not in (AEVANN_ID, CARP_ID):
return {"error": "Only Carp can approve marseys!"}, 403 return {"error": "Only Carp can approve marseys!"}, 403
name = name.lower().strip() name = name.lower().strip()
@ -167,7 +167,7 @@ def remove_marsey(v, name):
if not marsey: if not marsey:
return {"error": f"This marsey '{name}' doesn't exist!"}, 404 return {"error": f"This marsey '{name}' doesn't exist!"}, 404
if v.id not in {marsey.submitter_id, CARP_ID}: if v.id not in (marsey.submitter_id, AEVANN_ID, CARP_ID):
return {"error": "Only Carp can remove marseys!"}, 403 return {"error": "Only Carp can remove marseys!"}, 403
if v.id != marsey.submitter_id: if v.id != marsey.submitter_id:
@ -253,7 +253,7 @@ def submit_hat(v):
@app.post("/admin/approve/hat/<name>") @app.post("/admin/approve/hat/<name>")
@admin_level_required(3) @admin_level_required(3)
def approve_hat(v, name): def approve_hat(v, name):
if CARP_ID and v.id != CARP_ID: if v.id not in (AEVANN_ID, CARP_ID):
return {"error": "Only Carp can approve hats!"}, 403 return {"error": "Only Carp can approve hats!"}, 403
name = name.strip() name = name.strip()
@ -329,7 +329,7 @@ def remove_hat(v, name):
if not hat: if not hat:
return {"error": f"This hat '{name}' doesn't exist!"}, 404 return {"error": f"This hat '{name}' doesn't exist!"}, 404
if v.id not in {hat.submitter_id, CARP_ID}: if v.id not in (hat.submitter_id, AEVANN_ID, CARP_ID):
return {"error": "Only Carp can remove hats!"}, 403 return {"error": "Only Carp can remove hats!"}, 403
if v.id != hat.submitter_id: if v.id != hat.submitter_id: