Skip to content

Commit

Permalink
fix for network query sections auth
Browse files Browse the repository at this point in the history
  • Loading branch information
gsfk committed Sep 18, 2024
1 parent a2cdb71 commit 631eae2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bento_beacon/network/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def info_for_host_beacon():
"variants": bento_overview.get("counts", {}).get("variants", {}),
**biosample_and_experiment_stats,
},
"querySections": get_katsu_config_search_fields().get("sections", []),
"querySections": get_katsu_config_search_fields(requires_auth="full").get("sections", []),
}


Expand Down
8 changes: 5 additions & 3 deletions bento_beacon/utils/katsu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ def search_from_config(config_filters):
return response.get("matches", [])


def get_katsu_config_search_fields():
# Use forwarded auth for getting available search fields, which may be limited based on access level
fields = katsu_get(current_app.config["KATSU_PUBLIC_CONFIG_ENDPOINT"], requires_auth="forwarded")
def get_katsu_config_search_fields(requires_auth="forwarded"):
# standard forwarded auth for normal beacon requests
# "full" auth for beacon network init, which does not have a request context
# any network-specific search field censorship should be managed at the token level (or here)
fields = katsu_get(current_app.config["KATSU_PUBLIC_CONFIG_ENDPOINT"], requires_auth=requires_auth)
current_app.config["KATSU_CONFIG_SEARCH_FIELDS"] = fields
return fields

Expand Down

0 comments on commit 631eae2

Please sign in to comment.