aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-05-19 10:22:24 +0300
committerFrederick Muriuki Muriithi2023-05-19 10:22:24 +0300
commit2df4c10b0d4bcab6370946b7c258ab09c18c7a7f (patch)
treeabcaa227b592b9f51d19e43afb55f913e7b9b3fb
parent4a7b86a5718d444262c2149507b94af09b6433b4 (diff)
downloadgenenetwork3-2df4c10b0d4bcab6370946b7c258ab09c18c7a7f.tar.gz
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.
-rw-r--r--gn3/auth/authorisation/data/views.py8
1 files 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", "")