Skip to content

Commit

Permalink
Merge branch '1373-anon-user-datastore-search-sql'
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Dec 9, 2013
2 parents ca11b7a + 9332098 commit 4de4839
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ckanext/datastore/db.py
Expand Up @@ -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)):
Expand Down
2 changes: 1 addition & 1 deletion ckanext/datastore/logic/action.py
Expand Up @@ -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']

Expand Down
5 changes: 5 additions & 0 deletions ckanext/datastore/logic/auth.py
Expand Up @@ -35,5 +35,10 @@ 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)
1 change: 1 addition & 0 deletions ckanext/datastore/plugin.py
Expand Up @@ -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):
Expand Down

0 comments on commit 4de4839

Please sign in to comment.