From 9c526589575c0f0f1f4de5941d85f0c5adeccff6 Mon Sep 17 00:00:00 2001
From: Frederick Muriuki Muriithi
Date: Tue, 25 Apr 2023 09:55:11 +0300
Subject: auth: disable UI elements for non-editable roles
If a role is not user-editable, disable the UI elements that allow
editting of the role to prevent that as an option in the first place.
---
wqflask/wqflask/oauth2/ui.py | 1 +
wqflask/wqflask/templates/oauth2/view-group-role.html | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/wqflask/wqflask/oauth2/ui.py b/wqflask/wqflask/oauth2/ui.py
index 31b873be..4fdbe869 100644
--- a/wqflask/wqflask/oauth2/ui.py
+++ b/wqflask/wqflask/oauth2/ui.py
@@ -2,6 +2,7 @@
from flask import session, render_template
from .client import oauth2_get
+from .request_utils import process_error
def render_ui(templatepath: str, **kwargs):
"""Handle repetitive UI rendering stuff."""
diff --git a/wqflask/wqflask/templates/oauth2/view-group-role.html b/wqflask/wqflask/templates/oauth2/view-group-role.html
index 5536d475..efc8fd75 100644
--- a/wqflask/wqflask/templates/oauth2/view-group-role.html
+++ b/wqflask/wqflask/templates/oauth2/view-group-role.html
@@ -37,7 +37,10 @@
+ value="Remove"
+ {%if not group_role.role.user_editable%}
+ disabled="disabled"
+ {%endif%} />
@@ -72,7 +75,10 @@
+ value="Add to Role"
+ {%if not group_role.role.user_editable%}
+ disabled="disabled"
+ {%endif%} />
--
cgit v1.2.3