aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-03-03 14:02:10 +0300
committerFrederick Muriuki Muriithi2023-03-03 14:02:10 +0300
commite7c136949d3daf5310b33423f27918aaa9e92c65 (patch)
tree550cf39cdbdace19137399760307473a69bb13b7
parent6799268ea735ece65c548a5111e8e444680dd0fd (diff)
downloadgenenetwork2-e7c136949d3daf5310b33423f27918aaa9e92c65.tar.gz
oauth2: group role: View group role details.
-rw-r--r--wqflask/wqflask/oauth2/groups.py17
-rw-r--r--wqflask/wqflask/templates/oauth2/list_roles.html2
2 files changed, 18 insertions, 1 deletions
diff --git a/wqflask/wqflask/oauth2/groups.py b/wqflask/wqflask/oauth2/groups.py
index f9e9bffe..2effaae8 100644
--- a/wqflask/wqflask/oauth2/groups.py
+++ b/wqflask/wqflask/oauth2/groups.py
@@ -1,3 +1,4 @@
+import uuid
import datetime
from functools import partial
@@ -131,3 +132,19 @@ def reject_join_request():
data=request.form).either(
handle_error("oauth2.group.list_join_requests"),
__success__)
+
+@groups.route("/role/<uuid:group_role_id>", methods=["GET"])
+@require_oauth2
+def group_role(group_role_id: uuid.UUID):
+ """View the details of a particular role."""
+ def __role_error__(error):
+ return render_template(
+ "oauth2/view-group-role.html",
+ group_role_error=process_error(error))
+
+ def __role_success__(role):
+ return render_template(
+ "oauth2/view-group-role.html", group_role=role)
+
+ return oauth2_get(f"oauth2/group/role/{group_role_id}").either(
+ __role_error__, __role_success__)
diff --git a/wqflask/wqflask/templates/oauth2/list_roles.html b/wqflask/wqflask/templates/oauth2/list_roles.html
index 7d9c4ac2..6feccb6f 100644
--- a/wqflask/wqflask/templates/oauth2/list_roles.html
+++ b/wqflask/wqflask/templates/oauth2/list_roles.html
@@ -52,7 +52,7 @@
<tr>
<td>{{grole.role.role_name}}</td>
<td>
- <a href="#/group/role/{{grole.group_role_id}}"
+ <a href="{{url_for('oauth2.group.group_role', group_role_id=grole.group_role_id)}}"
title="Link to role {{grole.role.role_name}}"
class="btn btn-info">
View