diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-01 14:34:56 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:20 +0200 |
| commit | 88166f393012d9b231c36461556f92e99bb7f985 (patch) | |
| tree | f7b676a7f8aab980630c58bc71304d94ec177a95 /web-server/opendc | |
| parent | 85901acea556c69891b13ab7299cd62445292c7a (diff) | |
Fix deletion
Diffstat (limited to 'web-server/opendc')
| -rw-r--r-- | web-server/opendc/api/v2/simulations/simulationId/endpoint.py | 6 |
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) |
