From 2a99a895be2e1f917e049bd242a4ed1b68d719a5 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 12 Oct 2023 03:16:39 +0300 Subject: CaseAttributes: Bug: Fix privileges check --- gn3/case_attributes.py | 10 +++++----- 1 file 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 -- cgit v1.2.3