From 5c153f25e2813b70065a750c60f1b313b460712d Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Mon, 16 Dec 2024 16:00:37 +0000 Subject: [PATCH] cohorts, datasets scoping fixes --- bento_beacon/endpoints/cohorts.py | 4 ++-- bento_beacon/endpoints/datasets.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bento_beacon/endpoints/cohorts.py b/bento_beacon/endpoints/cohorts.py index 954416b..8576dba 100644 --- a/bento_beacon/endpoints/cohorts.py +++ b/bento_beacon/endpoints/cohorts.py @@ -9,14 +9,14 @@ @route_with_optional_project_id("/cohorts", methods=["GET", "POST"]) @authz_middleware.deco_public_endpoint -def get_cohorts(): +def get_cohorts(project_id=None): cohorts = current_app.config["BEACON_COHORT"] return beacon_collections_response({"collections": cohorts}) @route_with_optional_project_id("/cohorts/", methods=["GET", "POST"]) @authz_middleware.deco_public_endpoint -def get_cohort_by_id(id): +def get_cohort_by_id(id, project_id=None): cohorts = current_app.config["BEACON_COHORT"] cohort_this_id = next((c for c in cohorts if c.get("id") == id), []) return beacon_collections_response({"collections": cohort_this_id}) diff --git a/bento_beacon/endpoints/datasets.py b/bento_beacon/endpoints/datasets.py index b22ffe0..cd7a732 100644 --- a/bento_beacon/endpoints/datasets.py +++ b/bento_beacon/endpoints/datasets.py @@ -19,7 +19,7 @@ async def get_datasets(project_id=None): @route_with_optional_project_id("/datasets/", methods=["GET", "POST"]) @authz_middleware.deco_public_endpoint # TODO: authz - more flexibility in what is visible (?) -async def get_datasets_by_id(id): +async def get_datasets_by_id(id, project_id=None): k_dataset = await katsu_dataset_by_id(id=id) dataset_beacon_format = katsu_to_beacon_dataset_mapping(k_dataset) if k_dataset else [] return beacon_collections_response({"collections": dataset_beacon_format})