From 6d39ea99231aa0d07726a013c9a17c89a72e407a Mon Sep 17 00:00:00 2001 From: John Nduli Date: Tue, 6 Aug 2024 08:10:04 +0300 Subject: fix: pass in proper list of priviledge_ids --- gn2/wqflask/oauth2/ui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gn2') 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 } -- cgit v1.2.3