summaryrefslogtreecommitdiff
path: root/web-server/opendc/models/experiment.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-07-07 20:59:38 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:47:57 +0200
commit9761bdd1f2b0f72a2c0fa46b3dee1920a580a26a (patch)
treef875f9f22cbd0a84457e1bbfdbfd4050ab724c5a /web-server/opendc/models/experiment.py
parentb71a7714639a5d828e914a65357bef6c471dfad0 (diff)
Implement portfolio endpoints
Diffstat (limited to 'web-server/opendc/models/experiment.py')
-rw-r--r--web-server/opendc/models/experiment.py24
1 files changed, 0 insertions, 24 deletions
diff --git a/web-server/opendc/models/experiment.py b/web-server/opendc/models/experiment.py
deleted file mode 100644
index 46373b99..00000000
--- a/web-server/opendc/models/experiment.py
+++ /dev/null
@@ -1,24 +0,0 @@
-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 Experiment(Model):
- """Model representing a Experiment."""
-
- collection_name = 'experiments'
-
- def check_user_access(self, google_id, edit_access):
- """Raises an error if the user with given [google_id] has insufficient access.
-
- Checks access on the parent project.
-
- :param google_id: The Google ID of the user.
- :param edit_access: True when edit access should be checked, otherwise view access.
- """
- user = User.from_google_id(google_id)
- authorizations = list(
- filter(lambda x: str(x['projectId']) == str(self.obj['projectId']), user.obj['authorizations']))
- if len(authorizations) == 0 or (edit_access and authorizations[0]['authorizationLevel'] == 'VIEW'):
- raise ClientError(Response(403, 'Forbidden from retrieving/editing experiment.'))