diff options
author | Frederick Muriuki Muriithi | 2023-10-12 03:16:39 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-10-12 03:16:39 +0300 |
commit | 2a99a895be2e1f917e049bd242a4ed1b68d719a5 (patch) | |
tree | 75798254495066b355c31631a74a25d0ada6e35a | |
parent | 2e5b3b87a6ba2bf3d48ba19f0e54f10fa4187288 (diff) | |
download | genenetwork3-2a99a895be2e1f917e049bd242a4ed1b68d719a5.tar.gz |
CaseAttributes: Bug: Fix privileges check
-rw-r--r-- | gn3/case_attributes.py | 10 |
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 |