diff options
| author | jc0b <j@jc0b.computer> | 2020-06-26 12:30:16 +0200 |
|---|---|---|
| committer | jc0b <j@jc0b.computer> | 2020-06-26 12:30:16 +0200 |
| commit | f1017676a150de60b13ff2b33ca83079d87aebfc (patch) | |
| tree | 15c84fd426f65d54c70d405b9a2fc82b579c2812 /opendc/models/simulation.py | |
| parent | 6f51282cd7c3945ddd0fac68407a7a7be57aa2ba (diff) | |
| parent | 19bede4fc7f7320bb4eb16c3fe1a211b19ab4714 (diff) | |
Merged refactoring changes with upstream
Diffstat (limited to 'opendc/models/simulation.py')
| -rw-r--r-- | opendc/models/simulation.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/opendc/models/simulation.py b/opendc/models/simulation.py index f58581cf..5cd3d49e 100644 --- a/opendc/models/simulation.py +++ b/opendc/models/simulation.py @@ -1,16 +1,15 @@ from opendc.models.model import Model from opendc.models.user import User +from opendc.util.exceptions import ClientError from opendc.util.rest import Response class Simulation(Model): collection_name = 'simulations' - def validate_user_access(self, google_id, edit_access): + def check_user_access(self, google_id, edit_access): user = User.from_google_id(google_id) authorizations = list( filter(lambda x: str(x['simulationId']) == str(self.obj['_id']), user.obj['authorizations'])) if len(authorizations) == 0 or (edit_access and authorizations[0]['authorizationLevel'] == 'VIEW'): - return Response(403, "Forbidden from retrieving simulation.") - - return None + raise ClientError(Response(403, "Forbidden from retrieving simulation.")) |
