diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-25 13:50:49 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-25 13:50:49 +0200 |
| commit | a1589e75358558eada7ffc2efc7e3fa7160d233e (patch) | |
| tree | 7889a2364292cd8b90fe996da7907bebf200d3dc /opendc/models/authorization.py | |
| parent | 1f34466d41ba01a3dd36b0866696367d397daf7e (diff) | |
Reformat codebase and fix spelling errors
Diffstat (limited to 'opendc/models/authorization.py')
| -rw-r--r-- | opendc/models/authorization.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/opendc/models/authorization.py b/opendc/models/authorization.py index 90c7d399..82d37b76 100644 --- a/opendc/models/authorization.py +++ b/opendc/models/authorization.py @@ -1,10 +1,8 @@ -import json - from opendc.models.model import Model from opendc.models.user import User -class Authorization(Model): +class Authorization(Model): JSON_TO_PYTHON_DICT = { 'Authorization': { 'userId': 'user_id', @@ -26,12 +24,12 @@ class Authorization(Model): self.simulation_id ) ) - + if authorization is None: return False return authorization.has_at_least(authorization_level) - + def has_at_least(self, required_level): """Return True if this Authorization has at least the required level.""" @@ -41,7 +39,7 @@ class Authorization(Model): authorization_levels = ['VIEW', 'EDIT', 'OWN'] try: - index_actual = authorization_levels.index(self.authorization_level) + index_actual = authorization_levels.index(self.authorization_level) index_required = authorization_levels.index(required_level) except: return False @@ -50,4 +48,3 @@ class Authorization(Model): return True else: return False - |
