datopian / ckanext-blob-storage

CKAN extension to offload blob storage to cloud storage providers (S3, GCS, Azure etc).
http://tech.datopian.com/blob-storage/
MIT License
14 stars 4 forks source link

Support of Resource download from previous activities #57

Closed pdelboca closed 3 years ago

pdelboca commented 3 years ago

This is a clean follow-up PR of #55. This branch include:

shevron commented 3 years ago

@pdelboca to make this work with latest ckanext-authz-service, authorizer callback functions need to be changed to accept the optional context=None argument. It allows callers such as the authorize action to pass in CKAN context and not have it fetched from globals.

If you prefer, I can create a new version of cknext-blob-storage which is compatible with this new version, and you can base your PR on it.

pdelboca commented 3 years ago

@shevron sure, feel free to update the codebase to support the latest version of ckanext-authz-service. So far this is working perfectly against ckanext-authz-service=v0.1.5.

This PR will make ckanext-blob-storage no longer work with CKAN 2.8 since it's heavily using activity_id parameter and activity_show method that only exist in CKAN >= 2.9. I added a few checks in the code to only execute the activity_id logic if it is supported by the installed CKAN, if not, it will always default to package_show and will ignore any activity_id parameter (that shouldn't exist in prior CKAN versions.

Also, the download blueprint is turned out to be quite complex and Flake 8 checks where failing. I bumped the allowed complexity to 13, probably worth opening an issue to refactor if this is a problem.

I'm expecting on merging this soon, so let me know your thoughts! (If you have time)