diff --git a/ckanext/privatedatasets/plugin.py b/ckanext/privatedatasets/plugin.py index b96eb5a..b4a142d 100644 --- a/ckanext/privatedatasets/plugin.py +++ b/ckanext/privatedatasets/plugin.py @@ -11,6 +11,7 @@ from ckan.common import _, request ########################### AUTH FUNCTIONS ########################### ###################################################################### +@tk.auth_allow_anonymous_access def package_show(context, data_dict): user = context.get('user') user_obj = context.get('auth_user_obj') diff --git a/ckanext/privatedatasets/tests/test_plugin.py b/ckanext/privatedatasets/tests/test_plugin.py index fd4bd64..1643c20 100644 --- a/ckanext/privatedatasets/tests/test_plugin.py +++ b/ckanext/privatedatasets/tests/test_plugin.py @@ -44,6 +44,10 @@ class PluginTest(unittest.TestCase): self.assertTrue(plugin.p.IRoutes.implemented_by(plugin.PrivateDatasets)) self.assertTrue(plugin.p.IActions.implemented_by(plugin.PrivateDatasets)) + def test_decordators(self): + self.assertEquals(True, getattr(plugin.package_show, 'auth_allow_anonymous_access', False)) + self.assertEquals(True, getattr(plugin.resource_show, 'auth_allow_anonymous_access', False)) + @parameterized.expand([ # Anonymous user (public) (None, None, None, False, 'active', None, None, None, None, None, True),