diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-02 18:39:28 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:21 +0200 |
| commit | f119fc78dda4d1e828dde04f378a63a93e3a0a7e (patch) | |
| tree | bea1eace5d47f21a7ccb835c6a6079bc92e48710 /web-server/opendc/models/topology.py | |
| parent | 7f27a6370a0af25e1bf6ff8f46360c6c26c21e0b (diff) | |
Add current progress on frontend port
Diffstat (limited to 'web-server/opendc/models/topology.py')
| -rw-r--r-- | web-server/opendc/models/topology.py | 5 |
1 files changed, 4 insertions, 1 deletions
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.')) |
