aboutsummaryrefslogtreecommitdiff
path: root/gn3/case_attributes.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-10-12 03:16:39 +0300
committerFrederick Muriuki Muriithi2023-10-12 03:16:39 +0300
commit2a99a895be2e1f917e049bd242a4ed1b68d719a5 (patch)
tree75798254495066b355c31631a74a25d0ada6e35a /gn3/case_attributes.py
parent2e5b3b87a6ba2bf3d48ba19f0e54f10fa4187288 (diff)
downloadgenenetwork3-2a99a895be2e1f917e049bd242a4ed1b68d719a5.tar.gz
CaseAttributes: Bug: Fix privileges check
Diffstat (limited to 'gn3/case_attributes.py')
-rw-r--r--gn3/case_attributes.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py
index 250478f..b1d1434 100644
--- a/gn3/case_attributes.py
+++ b/gn3/case_attributes.py
@@ -77,11 +77,11 @@ def required_access(inbredset_id: int, access_levels: tuple[str, ...]) -> bool:
json={"resource-ids": [resource_id]},
headers={"Authorization": f"Bearer {the_token.access_token}"})
if auth.status_code == 200:
- privs = (priv["privilege_id"] for role in auth.json()[resource_id]["roles"]
- for priv in role["privileges"])
- authorisedp = all(lvl in privs for lvl in access_levels)
- if authorisedp:
- return authorisedp
+ privs = tuple(priv["privilege_id"]
+ for role in auth.json()[resource_id]["roles"]
+ for priv in role["privileges"])
+ if all(lvl in privs for lvl in access_levels):
+ return privs
except _HTTPException as httpe:
raise AuthorisationError("You need to be logged in.") from httpe