Skip to content

Commit

Permalink
Merge pull request #754 from hubmapconsortium/Derek-Furst/fix-collect…
Browse files Browse the repository at this point in the history
…ion-enumeration

Fixed a bug where datasets within a public collection were not being filtered for excluded fields in get_entity_by_id
  • Loading branch information
yuanzhou authored Oct 16, 2024
2 parents d211647 + 1dfacaf commit 32da714
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ def get_entity_by_id(id):
if public_entity and not user_in_hubmap_read_group(request):
final_result = schema_manager.exclude_properties_from_response(fields_to_exclude, final_result)
if normalized_entity_type == 'Collection':
for i, dataset in enumerate(final_result.get('datasets')):
for i, dataset in enumerate(final_result.get('datasets', [])):
if _get_entity_visibility(normalized_entity_type='Dataset', entity_dict=dataset) != DataVisibilityEnum.PUBLIC or user_in_hubmap_read_group(request):
# If the dataset is non-public, or if the user has read-group access, there is no need to remove fields, continue to the next dataset
continue
Expand Down

0 comments on commit 32da714

Please sign in to comment.