Skip to content

Commit

Permalink
Merge pull request #13 from NINAnor/private-datasets
Browse files Browse the repository at this point in the history
Support private dataset versions
  • Loading branch information
frafra committed Dec 30, 2022
2 parents 883fbcc + d164c3a commit bdec239
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ckanext/datasetversions/logic/action/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class DatasetType:
else:
dataset_type = DatasetType.unversioned

# Do default CKAN authentication
all_active_versions = _get_ordered_active_dataset_versions(
get_context(context),
data_dict.copy(), # Will get modified so make a copy
Expand Down Expand Up @@ -145,8 +146,11 @@ def _get_ordered_active_dataset_versions(context, data_dict, child_names):

for name in child_names:
data_dict['id'] = name
version = ckan_package_show(context, data_dict)
if version['state'] == 'active' and not version['private']:
try:
version = ckan_package_show(context, data_dict)
except logic.NotAuthorized:
continue
if version['state'] == 'active':
versions.append(version)

versions.sort(key=_get_version, reverse=True)
Expand Down

0 comments on commit bdec239

Please sign in to comment.