aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-25 13:19:26 -0500
committerAlexander_Kabui2024-08-28 15:02:45 +0300
commit0ca86869d8acaa8a820df45fc1debfbe1b7936df (patch)
tree4dff2e4b14f9509b472f22883606a68a98575ff7 /gn2/wqflask
parent34cd7f95ded2eef66ed3b0367023b9a4529b7b1a (diff)
downloadgenenetwork2-0ca86869d8acaa8a820df45fc1debfbe1b7936df.tar.gz
Remove flawed "group role" idea: use just "role".
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/oauth2/resources.py12
-rw-r--r--gn2/wqflask/templates/oauth2/view-resource.html12
2 files changed, 12 insertions, 12 deletions
diff --git a/gn2/wqflask/oauth2/resources.py b/gn2/wqflask/oauth2/resources.py
index 7ebb82ad..66545802 100644
--- a/gn2/wqflask/oauth2/resources.py
+++ b/gn2/wqflask/oauth2/resources.py
@@ -213,10 +213,10 @@ def unlink_data_from_resource():
@require_oauth2
def assign_role(resource_id: UUID) -> Response:
form = request.form
- group_role_id = form.get("group_role_id", "")
+ role_id = form.get("role_id", "")
user_email = form.get("user_email", "")
try:
- assert bool(group_role_id), "The role must be provided."
+ assert bool(role_id), "The role must be provided."
assert bool(user_email), "The user email must be provided."
def __assign_error__(error):
@@ -233,7 +233,7 @@ def assign_role(resource_id: UUID) -> Response:
return oauth2_post(
f"auth/resource/{resource_id}/user/assign",
json={
- "group_role_id": group_role_id,
+ "role_id": role_id,
"user_email": user_email
}).either(__assign_error__, __assign_success__)
except AssertionError as aserr:
@@ -244,10 +244,10 @@ def assign_role(resource_id: UUID) -> Response:
@require_oauth2
def unassign_role(resource_id: UUID) -> Response:
form = request.form
- group_role_id = form.get("group_role_id", "")
+ role_id = form.get("role_id", "")
user_id = form.get("user_id", "")
try:
- assert bool(group_role_id), "The role must be provided."
+ assert bool(role_id), "The role must be provided."
assert bool(user_id), "The user id must be provided."
def __unassign_error__(error):
@@ -264,7 +264,7 @@ def unassign_role(resource_id: UUID) -> Response:
return oauth2_post(
f"auth/resource/{resource_id}/user/unassign",
json={
- "group_role_id": group_role_id,
+ "role_id": role_id,
"user_id": user_id
}).either(__unassign_error__, __unassign_success__)
except AssertionError as aserr:
diff --git a/gn2/wqflask/templates/oauth2/view-resource.html b/gn2/wqflask/templates/oauth2/view-resource.html
index cfc769c4..0788e30c 100644
--- a/gn2/wqflask/templates/oauth2/view-resource.html
+++ b/gn2/wqflask/templates/oauth2/view-resource.html
@@ -278,14 +278,14 @@
<th>Role</th>
<th>Action</th>
</tr>
- {%for grole in user_row.roles%}
+ {%for role in user_row.roles%}
<tr>
<td>
<a href="{{url_for(
'oauth2.role.role',
- role_id=grole.role_id)}}"
- title="Details for '{{grole.role_name}}' role">
- {{grole.role_name}}
+ role_id=role.role_id)}}"
+ title="Details for '{{role.role_name}}' role">
+ {{role.role_name}}
</a>
</td>
<td>
@@ -294,8 +294,8 @@
method="POST">
<input type="hidden" name="user_id"
value="{{user_row.user.user_id}}" />
- <input type="hidden" name="group_role_id"
- value="{{grole.group_role_id}}">
+ <input type="hidden" name="role_id"
+ value="{{role.role_id}}">
<input type="submit"
value="Unassign"
class="btn btn-danger"