Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datastore does not hide private resources in SQL search #652

Closed
wants to merge 581 commits into from

Conversation

domoritz
Copy link
Contributor

Datastore tables that belong to private CKAN resources are not hidden. This could be potentially unexpected even though it says it in the docs http://docs.ckan.org/en/latest/datastore-setup.html.

johnglover and others added 13 commits March 18, 2013 04:18
Also add a docstring.

This schema seems to be a base schema for other package schemas to be
based on, and a private helper function of schema.py. It's not used
outside of schema.py apart from by some tests that probably should not
be using it. The new name hopefully makes it clearer what the purpose of
this function is.
I think package_form_schema() was probably deprecated using a code
comment before we had the Right Way of deprecating things (using the
deprecated decorator).
The package_*() action functions handle fetching package schemas and
using them to validate package dicts, no need to also do it in the
package controller!
Delete package_create_validate() action function.

This function has no docstring and no tests, and duplicates package dict
validation code in package_create().
Delete package_update_validate() action function.

This function has no docstring and no tests, and duplicates package dict
validation code in package_update().
Replace form_to_db_schema(), form_to_db_schema_options(),
form_to_db_schema_api_create(), form_to_db_schema_api_update(),
form_to_db_package_schema() with just two schemas: create and update.
Then get the tests passing.

schema.py:

- Delete _base_package_schema()
- Delete already deprecated package_form_schema()
- Delete form_to_db_package_schema()
- Tweak default_create_package_schema() and
  default_update_package_schema() to get tests passing

DefaultDatasetForm:

- Delete form_to_db_schema_options()
- Delete form_to_db_schema()
- Delete form_to_db_schema_api_create()
- Delete form_to_db_schema_api_update()
- Add create_package_schema(), returns None
- Add update_package_schema(), returns None

Note that by deleting form_to_db_schema() and
form_to_db_schema_options(), _api_create() and _api_update(), we're
breaking backwards compatibility with any plugins that were using these.

package_create():
- Don't call form_to_db_schema_options() or form_to_db_schema().
- Instead call the package plugin's create_package_schema(), if that
  doesn't exist or if it returns None then call
  default_create_package_schema() instead

package_update():
- Don't call form_to_db_schema_options() or form_to_db_schema().
- Instead call the package plugin's update_package_schema(), if that
  doesn't exist or if it returns None then call
  default_update_package_schema() instead

Note that by no longer calling the form_to_db_schema_options() or
form_to_db_schema() methods of IDatasetForm plugins, we're breaking
backward compatibility with those plugins.

Note this makes IDatasetForm less flexible - plugins can return
different schemas for creating, updating or showing packages, but they
can no longer return different schemas depending on whether we're using
the API or web UI, or on other parameters from the Pylons context.

test_tag_vocab.py:

- Update MockVocabTagsPlugin to work with the new interface

Also update some other tests.
@ghost ghost assigned domoritz Mar 19, 2013
Sean Hammond and others added 16 commits March 19, 2013 14:01
…ema()

This makes the name consistent with default_create_package_schema() and
default_update_package_schema().
package_show(): Don't call an IDatasetForm plugin's
db_to_form_schema_options() or db_to_form_schema() anymore, instead call
package_show_schema(), if the plugin doesn't have that method or if it
returns None then fall back on
ckan.logic.schema.default_package_show_schema(). (Same pattern as for
package_create() and package_update()).

Delete DefaultDatasetForm's db_to_form_schema_options() and
db_to_form_schema(), add show_package_schema() that just returns None,
same as create_package_schema() and update_package_schema().
Conflicts:
	ckan/lib/search/index.py
This field accidentally got removed from the templates in a previous
commit
This is necessary to make convert_to/from_extras() work
Conflicts:
	doc/tag-vocabularies.rst

    removed
    This needs to be done via the action API (:doc:`api`). Please check
    the examples section to see which calls are needed.
@domoritz
Copy link
Contributor Author

Closing this because I made the pr to the wrong branch...

@domoritz domoritz closed this Apr 23, 2013
domoritz added a commit that referenced this pull request Apr 23, 2013
domoritz added a commit that referenced this pull request Apr 23, 2013
domoritz added a commit that referenced this pull request Apr 23, 2013
domoritz added a commit that referenced this pull request Apr 24, 2013
domoritz added a commit that referenced this pull request Apr 24, 2013
amercader added a commit that referenced this pull request Jun 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet