Skip to content

Commit

Permalink
Merge pull request #691 from okfn/691-override-fq-on-legacy-api
Browse files Browse the repository at this point in the history
Disallow fq parameter on the legacy search API and force to search only public datasets
  • Loading branch information
johnglover committed Apr 3, 2013
2 parents f6459ca + 8eca497 commit 8ac9596
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckan/controllers/api.py
Expand Up @@ -532,6 +532,12 @@ def search(self, ver=None, register=None):
params = search.\
convert_legacy_parameters_to_solr(params)
query = search.query_for(model.Package)

# Remove any existing fq param and set the capacity to
# public
if 'fq' in params:
del params['fq']
params['fq'] = '+capacity:public'
results = query.run(params)
return self._finish_ok(results)
except search.SearchError, e:
Expand Down
6 changes: 6 additions & 0 deletions doc/legacy-api.rst
Expand Up @@ -366,6 +366,12 @@ The ``Dataset`` and ``Revision`` data formats are as defined in `Model Formats`_

filter_by_openness and filter_by_downloadable were dropped from CKAN version 1.5 onwards.

.. Note::

Only public datasets can be accessed via the legacy search API, regardless of
the provided authorization. If you need to access private datasets via the
API you will need to use the `package_search` method of the :doc:`api`.


**Resource Parameters**

Expand Down

0 comments on commit 8ac9596

Please sign in to comment.