aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-17 15:46:26 -0500
committerAlexander_Kabui2024-08-28 15:02:45 +0300
commit3ec7180cfe0fdd8dc7d7064d9a34e421efdac14e (patch)
treeed038c4b67b18e113ed3b7fb33a9c2373317514e /gn2/wqflask
parent1484101101bbc3d1388fc351f44c494cb1b72540 (diff)
downloadgenenetwork2-3ec7180cfe0fdd8dc7d7064d9a34e421efdac14e.tar.gz
Fix error display logic
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/oauth2/resources.py5
-rw-r--r--gn2/wqflask/templates/oauth2/create-role.html4
2 files changed, 6 insertions, 3 deletions
diff --git a/gn2/wqflask/oauth2/resources.py b/gn2/wqflask/oauth2/resources.py
index 0befac85..7ebb82ad 100644
--- a/gn2/wqflask/oauth2/resources.py
+++ b/gn2/wqflask/oauth2/resources.py
@@ -409,11 +409,14 @@ def create_resource_role(resource_id: UUID):
return render_ui("oauth2/create-role.html", **kwargs)
def __fetch_resource_roles__(resource):
- lambda error: __render__(resource_role_error=error),
user = session.session_info()["user"]
return oauth2_get(
f"auth/resource/{resource_id}/users/{user['user_id']}"
"/roles").either(
+ lambda error: {
+ "resource": resource,
+ "resource_role_error": process_error(error)
+ },
lambda roles: {"resource": resource, "roles": roles})
if request.method == "GET":
diff --git a/gn2/wqflask/templates/oauth2/create-role.html b/gn2/wqflask/templates/oauth2/create-role.html
index 198eacdd..6cf0bb78 100644
--- a/gn2/wqflask/templates/oauth2/create-role.html
+++ b/gn2/wqflask/templates/oauth2/create-role.html
@@ -9,8 +9,8 @@
<p>Create a new role to act on resource "{{resource.resource_name}}"</p>
- {%if group_privileges_error is defined%}
- {{display_error("Group Privileges", group_privileges_error)}}
+ {%if resource_role_error is defined%}
+ {{display_error("Resource Role", resource_role_error)}}
{%else%}
{%if "resource:role:create-role" in (user_privileges|map(attribute="privilege_id")) %}
<form method="POST" action="{{url_for('oauth2.resource.create_resource_role',