summaryrefslogtreecommitdiff
path: root/web-server/opendc
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-07-01 14:34:56 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:47:20 +0200
commit88166f393012d9b231c36461556f92e99bb7f985 (patch)
treef7b676a7f8aab980630c58bc71304d94ec177a95 /web-server/opendc
parent85901acea556c69891b13ab7299cd62445292c7a (diff)
Fix deletion
Diffstat (limited to 'web-server/opendc')
-rw-r--r--web-server/opendc/api/v2/simulations/simulationId/endpoint.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/web-server/opendc/api/v2/simulations/simulationId/endpoint.py b/web-server/opendc/api/v2/simulations/simulationId/endpoint.py
index 93617ea8..0cee3e9c 100644
--- a/web-server/opendc/api/v2/simulations/simulationId/endpoint.py
+++ b/web-server/opendc/api/v2/simulations/simulationId/endpoint.py
@@ -3,6 +3,7 @@ from datetime import datetime
from opendc.models.experiment import Experiment
from opendc.models.simulation import Simulation
from opendc.models.topology import Topology
+from opendc.models.user import User
from opendc.util.database import Database
from opendc.util.rest import Response
@@ -55,6 +56,11 @@ def DELETE(request):
experiment = Experiment.from_id(experiment_id)
experiment.delete()
+ user = User.from_google_id(request.google_id)
+ user.obj['authorizations'] = list(
+ filter(lambda x: str(x['simulationId']) != request.params_path['simulationId'], user.obj['authorizations']))
+ user.update()
+
old_object = simulation.delete()
return Response(200, 'Successfully deleted simulation.', old_object)