diff --git a/ckanext/xloader/helpers.py b/ckanext/xloader/helpers.py index a28f89f7..6c4b8b9b 100644 --- a/ckanext/xloader/helpers.py +++ b/ckanext/xloader/helpers.py @@ -31,10 +31,8 @@ def xloader_status_description(status): def is_resource_supported_by_xloader(res_dict, check_access = True): is_supported_format = XLoaderFormats.is_it_an_xloader_format(res_dict.get('format')) is_datastore_active = res_dict.get('datastore_active', False) - if check_access: - user_has_access = toolkit.h.check_access('package_update', {'id':res_dict.get('package_id')}) - else: - user_has_access = True + user_has_access = not check_access or toolkit.h.check_access('package_update', + {'id':res_dict.get('package_id')}) try: is_supported_url_type = res_dict.get('url_type') not in toolkit.h.datastore_rw_resource_url_types() except AttributeError: diff --git a/ckanext/xloader/utils.py b/ckanext/xloader/utils.py index 0d2a182b..99284bff 100644 --- a/ckanext/xloader/utils.py +++ b/ckanext/xloader/utils.py @@ -33,6 +33,7 @@ def is_it_an_xloader_format(cls, format_): if cls.formats is None: cls._formats = config.get("ckanext.xloader.formats") if cls._formats is not None: + # use config value. preserves empty list as well. cls._formats = cls._formats.lower().split() else: cls._formats = DEFAULT_FORMATS