From 2df4c10b0d4bcab6370946b7c258ab09c18c7a7f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 19 May 2023 10:22:24 +0300 Subject: auth: Provide user and resource info in the trait data Provide the user and resource_id information in each trait's authorisation details to help with linking on the UI end. --- gn3/auth/authorisation/data/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gn3/auth/authorisation/data/views.py b/gn3/auth/authorisation/data/views.py index b899b83..d84b080 100644 --- a/gn3/auth/authorisation/data/views.py +++ b/gn3/auth/authorisation/data/views.py @@ -123,13 +123,13 @@ def authorisation() -> Response: return f"{dataset_type}::{dataset_name}::{trait['trait_name']}" return f"{dataset_type}::{dataset_name}" - return jsonify({ - "user": user._asdict(), - "trait_privileges": tuple( + return jsonify(tuple( { + "user": user._asdict(), **{key:trait[key] for key in ("trait_fullname", "trait_name")}, "dataset_name": trait["db"]["dataset_name"], "dataset_type": __translate__(trait["db"]["dataset_type"]), + "resource_id": data_to_resource_map.get(__trait_key__(trait)), "privileges": privileges.get( data_to_resource_map.get( __trait_key__(trait), @@ -137,7 +137,7 @@ def authorisation() -> Response: tuple()) } for trait in (build_trait_name(trait_fullname) - for trait_fullname in traits_names))}) + for trait_fullname in traits_names))) def __search_mrna__(): query = __request_key__("query", "") -- cgit v1.2.3