From 9f87ab4bbab048b527585929135cab80fafd9ef9 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Tue, 30 Jun 2020 13:28:18 +0200 Subject: Address a number of pylint issues --- web-server/opendc/models/experiment.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'web-server/opendc/models/experiment.py') diff --git a/web-server/opendc/models/experiment.py b/web-server/opendc/models/experiment.py index dd7aa4f8..ac606d64 100644 --- a/web-server/opendc/models/experiment.py +++ b/web-server/opendc/models/experiment.py @@ -5,9 +5,18 @@ 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 simulation. + + :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['simulationId']) == str(self.obj['simulationId']), user.obj['authorizations'])) -- cgit v1.2.3