Skip to content
Snippets Groups Projects
Commit 4172cacf authored by David Schmitz's avatar David Schmitz
Browse files

REST API: allow full delete according to settings also for a list of non-admin...

REST API: allow full delete according to settings also for a list of non-admin users; if allowed fully delete even active rules (after deactivation); log file names cleanup
parent 19ec8ad6
No related branches found
No related tags found
No related merge requests found
...@@ -132,7 +132,10 @@ def delete(routepk, **kwargs): ...@@ -132,7 +132,10 @@ def delete(routepk, **kwargs):
commit, response = applier.apply(operation="delete") commit, response = applier.apply(operation="delete")
reason_text = '' reason_text = ''
logger.info("tasks::delete(): initial_status="+str(initial_status)) logger.info("tasks::delete(): initial_status="+str(initial_status))
fully_deleted=False
if commit and initial_status == "PENDING_TODELETE": # special new case for fully deleting a rule via REST API if commit and initial_status == "PENDING_TODELETE": # special new case for fully deleting a rule via REST API
fully_deleted=True
route.status="INACTIVE"
route.delete() route.delete()
msg1 = "[%s] Fully deleted route : %s%s- Result %s" % (route.applier, route.name, reason_text, response) msg1 = "[%s] Fully deleted route : %s%s- Result %s" % (route.applier, route.name, reason_text, response)
logger.info("tasks::delete(): DELETED msg="+msg1) logger.info("tasks::delete(): DELETED msg="+msg1)
...@@ -149,10 +152,11 @@ def delete(routepk, **kwargs): ...@@ -149,10 +152,11 @@ def delete(routepk, **kwargs):
logger.error("edit(): route="+str(route)+", INACTIVE, add_null_value failed: "+str(e)) logger.error("edit(): route="+str(route)+", INACTIVE, add_null_value failed: "+str(e))
else: else:
status = "ERROR" status = "ERROR"
route.status = status if not fully_deleted:
route.response = response route.status = status
route.save() route.response = response
announce("[%s] Suspending rule : %s%s- Result %s" % (route.applier_username_nice, route.name, reason_text, response), route.applier, route) route.save()
announce("[%s] Suspending rule : %s%s- Result %s" % (route.applier_username_nice, route.name, reason_text, response), route.applier, route)
except TimeLimitExceeded: except TimeLimitExceeded:
route.status = "ERROR" route.status = "ERROR"
route.response = "Task timeout" route.response = "Task timeout"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment