about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-04-02 11:34:22 +0300
committerBonfaceKilz2024-04-02 13:55:15 +0300
commit027659e21b0614967c3401201afd7de8f8d2e7c1 (patch)
tree4bcf61bc0950a2954fb88659e75a6999277eb696
parent42d678a392aeef8fcf261bd850cbe7cd32fdd4c6 (diff)
downloadgenenetwork2-027659e21b0614967c3401201afd7de8f8d2e7c1.tar.gz
Use the dataset id to fetch the authorisation roles.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn2/wqflask/views.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index 47233099..835a620c 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -1158,17 +1158,20 @@ def get_dataset(name):
     from gn2.wqflask.oauth2.request_utils import user_details
     from gn2.wqflask.oauth2.request_utils import process_error
 
-    result = oauth2_get(
-        f"auth/resource/authorisation/{name}"
-    ).either(
-        lambda err: {"roles": []},
-        lambda val: val
-    )
+    # We need to use the "id" as the identifier
     metadata = requests.get(
         urljoin(
             GN3_LOCAL_URL,
             f"/api/metadata/datasets/{name}")
     ).json()
+    id_ = metadata.get("id", "").split("/")[-1]
+    result = oauth2_get(
+        f"auth/resource/authorisation/{id_}"
+    ).either(
+        lambda err: {"roles": []},
+        lambda val: val
+    )
+
     metadata["editable"] = "group:resource:edit-resource" in result["roles"]
     return render_template(
         "dataset.html",