From f119fc78dda4d1e828dde04f378a63a93e3a0a7e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 2 Jul 2020 18:39:28 +0200 Subject: Add current progress on frontend port --- web-server/opendc/models/topology.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'web-server/opendc/models') diff --git a/web-server/opendc/models/topology.py b/web-server/opendc/models/topology.py index 1c717221..0ceecec5 100644 --- a/web-server/opendc/models/topology.py +++ b/web-server/opendc/models/topology.py @@ -18,7 +18,10 @@ class Topology(Model): :param edit_access: True when edit access should be checked, otherwise view access. """ user = User.from_google_id(google_id) + if 'simulationId' not in self.obj: + raise ClientError(Response(400, 'Missing simulationId in topology.')) + authorizations = list( filter(lambda x: str(x['simulationId']) == str(self.obj['simulationId']), user.obj['authorizations'])) if len(authorizations) == 0 or (edit_access and authorizations[0]['authorizationLevel'] == 'VIEW'): - raise ClientError(Response(403, "Forbidden from retrieving topology.")) + raise ClientError(Response(403, 'Forbidden from retrieving topology.')) -- cgit v1.2.3