From 94513310831875a72d21b3e17af9541a328cabd6 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 1 Oct 2024 13:28:49 -0500 Subject: Extract privileges and use them for access control --- uploader/phenotypes/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'uploader/phenotypes') diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 7fc3b08..63e0b84 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -200,7 +200,11 @@ def view_phenotype(# pylint: disable=[unused-argument] "xref_id": xref_id } ).then( - lambda resource: render_template( + lambda resource: tuple( + privilege["privilege_id"] for role in resource["roles"] + for privilege in role["privileges"]) + ).then( + lambda privileges: render_template( "phenotypes/view-phenotype.html", species=species, population=population, @@ -210,7 +214,7 @@ def view_phenotype(# pylint: disable=[unused-argument] population["Id"], dataset["Id"], xref_id), - resource=resource, + privileges=privileges, activelink="view-phenotype") ).either( make_either_error_handler( -- cgit v1.2.3