diff --git a/ckanext/datastore/db.py b/ckanext/datastore/db.py index 4dc41ff974d..414e0935321 100644 --- a/ckanext/datastore/db.py +++ b/ckanext/datastore/db.py @@ -292,6 +292,8 @@ def convert(data, type_name): if type_name.startswith('_'): sub_type = type_name[1:] return [convert(item, sub_type) for item in data] + if type_name == 'tsvector': + return unicode(data, 'utf-8') if isinstance(data, datetime.datetime): return data.isoformat() if isinstance(data, (int, float)): diff --git a/ckanext/datastore/logic/action.py b/ckanext/datastore/logic/action.py index 804fec1a197..1b90193a1bb 100644 --- a/ckanext/datastore/logic/action.py +++ b/ckanext/datastore/logic/action.py @@ -380,7 +380,7 @@ def datastore_search_sql(context, data_dict): '(; equals chr(59)) and string concatenation (||). ')] }) - p.toolkit.check_access('datastore_search', context, data_dict) + p.toolkit.check_access('datastore_search_sql', context, data_dict) data_dict['connection_url'] = pylons.config['ckan.datastore.read_url'] diff --git a/ckanext/datastore/logic/auth.py b/ckanext/datastore/logic/auth.py index f99d7f45ae3..5a6e3329cc0 100644 --- a/ckanext/datastore/logic/auth.py +++ b/ckanext/datastore/logic/auth.py @@ -34,6 +34,9 @@ def datastore_delete(context, data_dict): def datastore_search(context, data_dict): return datastore_auth(context, data_dict, 'resource_show') +@p.toolkit.auth_allow_anonymous_access +def datastore_search_sql(context, data_dict): + return {'success': True} def datastore_change_permissions(context, data_dict): return datastore_auth(context, data_dict) diff --git a/ckanext/datastore/plugin.py b/ckanext/datastore/plugin.py index f91310ecdec..73103e67121 100644 --- a/ckanext/datastore/plugin.py +++ b/ckanext/datastore/plugin.py @@ -221,6 +221,7 @@ def get_auth_functions(self): 'datastore_upsert': auth.datastore_upsert, 'datastore_delete': auth.datastore_delete, 'datastore_search': auth.datastore_search, + 'datastore_search_sql': auth.datastore_search_sql, 'datastore_change_permissions': auth.datastore_change_permissions} def before_map(self, m):