diff options
author | Frederick Muriuki Muriithi | 2024-06-17 15:45:39 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-06-17 15:45:39 -0500 |
commit | 2d0261add8df5a0b49e80eb2fab3a98f27871067 (patch) | |
tree | 73ee85c150a24c71787d6deaff2cf13e812a13ec /gn2/wqflask/oauth2 | |
parent | cb8154f79a755e2d6f38de969acc10e5240ca888 (diff) | |
download | genenetwork2-2d0261add8df5a0b49e80eb2fab3a98f27871067.tar.gz |
Fetch the active user's roles on a particular resource.
Diffstat (limited to 'gn2/wqflask/oauth2')
-rw-r--r-- | gn2/wqflask/oauth2/resources.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gn2/wqflask/oauth2/resources.py b/gn2/wqflask/oauth2/resources.py index cf600b51..0befac85 100644 --- a/gn2/wqflask/oauth2/resources.py +++ b/gn2/wqflask/oauth2/resources.py @@ -4,6 +4,7 @@ from flask import ( flash, request, url_for, redirect, Response, Blueprint) from . import client +from . import session from .ui import render_ui as _render_ui from .checks import require_oauth2 from .client import oauth2_get, oauth2_post @@ -408,9 +409,12 @@ def create_resource_role(resource_id: UUID): return render_ui("oauth2/create-role.html", **kwargs) def __fetch_resource_roles__(resource): - return oauth2_get(f"auth/resource/{resource_id}/roles").either( lambda error: __render__(resource_role_error=error), - lambda roles: {"resource": resource, "roles": roles}) + user = session.session_info()["user"] + return oauth2_get( + f"auth/resource/{resource_id}/users/{user['user_id']}" + "/roles").either( + lambda roles: {"resource": resource, "roles": roles}) if request.method == "GET": return oauth2_get(f"auth/resource/view/{resource_id}").map( |