aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorJohn Nduli2024-08-06 08:10:04 +0300
committerJohn Nduli2024-08-06 08:10:04 +0300
commitb5d32afe62c4ef64b748bacb973c2cb79d559361 (patch)
tree47852839489ea3b738306c85c8b5067f3aaddad9 /gn2/wqflask
parente693056b193c9c08bf0a0e99df4352cfeb83de2f (diff)
downloadgenenetwork2-b5d32afe62c4ef64b748bacb973c2cb79d559361.tar.gz
fix: pass in proper list of priviledge_ids
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/oauth2/ui.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gn2/wqflask/oauth2/ui.py b/gn2/wqflask/oauth2/ui.py
index 90d65e0b..d70a13ec 100644
--- a/gn2/wqflask/oauth2/ui.py
+++ b/gn2/wqflask/oauth2/ui.py
@@ -8,8 +8,11 @@ from .request_utils import process_error
def render_ui(templatepath: str, **kwargs):
"""Handle repetitive UI rendering stuff."""
roles = kwargs.get("roles", tuple()) # Get roles
+ if not roles:
+ roles = oauth2_get("auth/system/roles").either(
+ lambda _err: roles, lambda auth_roles: auth_roles)
user_privileges = tuple(
- privilege for role in roles for privilege in role["privileges"])
+ privilege["privilege_id"] for role in roles for privilege in role["privileges"])
kwargs = {
**kwargs, "roles": roles, "user_privileges": user_privileges
}