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

package_search include_private flag #3191

Merged
merged 10 commits into from Aug 17, 2016

Conversation

wardi
Copy link
Contributor

@wardi wardi commented Aug 5, 2016

Proposed fix for #3176

Stop using a context variable in package_show to return private datasets (only works from inside ckan), instead allow users to pass include_private=True to have all datasets they have permission to see returned.

This is essentially what is already allowed when users browse to the organzation search page unless there's a customised package_show auth function. In that case we might be exposing more information than was available earlier (users can get the whole dataset metadata not just what's seen in search results). We'll have to change the way permissions on datasets are defined to fix that issue, see: #3192 for next steps.

@wardi
Copy link
Contributor Author

wardi commented Aug 5, 2016

This needs some more tests covering include_private as a normal parameter. We could also add a config option to default to showing private datasets in the normal search page here too.

@wardi
Copy link
Contributor Author

wardi commented Aug 5, 2016

@TkTech this is sure to conflict with #3118. It feels like lots of solr-specific code in this action should be moved into lib/search

@TkTech
Copy link
Member

TkTech commented Aug 6, 2016

@wardi there are a number of actions and methods relying on Solr syntax queries that I'm going to have to work through one-by-one. The changes proposed and upcoming in #3118 will take months to finish, so we shouldn't let that be a blocker or concern for this PR right now.

@amercader amercader self-assigned this Aug 9, 2016
@wardi
Copy link
Contributor Author

wardi commented Aug 12, 2016

Spoke to @amercader about this on Tuesday and we decided to enable display of private datasets on the default search page as part of this PR. There will be a new option ckan.search.default_include_private = False to revert to the old CKAN behaviour if you really want to.

@Aaron-M
Copy link

Aaron-M commented Aug 15, 2016

Question - would having the search results set to (true) include_private datasets affect if private datasets are indexed by google... (currently they are not)?

@wardi
Copy link
Contributor Author

wardi commented Aug 16, 2016

anonymous users (like google) shouldn't be able to see private datasets. If you can see private datasets without logging in with these changes please let me know!

super(cls, cls).setup_class()
helpers.reset_db()
search.clear_all()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why getting rid of these class setup methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're duplicating code already in the base class

@amercader
Copy link
Member

@wardi looks great, some minor comments

@nibecker
Copy link

Thanks @wardi. We should make sure that users with customised package_show will be informed about this change in advance as it might cause trouble for them. This includes of course careful documentation in the release notes. Any other suggestion where to place a notice?

@wardi
Copy link
Contributor Author

wardi commented Aug 17, 2016

@nibecker yes, we'll need to include the new parameters to package_search in the changelog, however If you've customised package_show you should know you're going to have trouble with upgrades. Overriding a core action is pretty much the same as monkey-patching CKAN code.

edit: parameters are new on package_search, not package_show

@amercader
Copy link
Member

@wardi is that ready to go or did you want to add more tests?

@wardi
Copy link
Contributor Author

wardi commented Aug 17, 2016

@amercader I was just looking at that. Are there cases that aren't covered by the current tests?

@amercader
Copy link
Member

Maybe "sysadmin can search private datasets" and "user from org1 can not see private datasets from org2"? I know auth testing of the underlying actions should cover that but just in case :)

@wardi
Copy link
Contributor Author

wardi commented Aug 17, 2016

@amercader sure, but I'd like to do those tests at the action level because there's no custom code for either of those cases in the controller

@amercader
Copy link
Member

But this should be just a matter of setting the appropriate REMOTE_USER (a sysadmin and an org1 user) and check the output as you do in the other tests, right?

@wardi
Copy link
Contributor Author

wardi commented Aug 17, 2016

@amercader ok, added those too

@amercader
Copy link
Member

PEEEEEEEEEEP 8 🎱 💀

@amercader amercader merged commit 5f16935 into master Aug 17, 2016
@amercader
Copy link
Member

@wardi fixed that myself, merged now

@amercader amercader deleted the 3191-package-search-include-private branch August 17, 2016 13:16
@wardi wardi mentioned this pull request Sep 15, 2016
rufuspollock added a commit to rufuspollock/ckan-explorer that referenced this pull request Feb 9, 2017
[all][l]: Rework the CKAN Explorer to provide new features

- Single dataset operation: supply dataset in the URL and we go directly to that resource
- Support grabbing data from CKAN user's private datasets (requires a very recent version of CKAN)
- Don't append resource views but rather replace them so that ckan explorer becomes more of a single-page SQL tool; for opening multiple resources there are buttons to open them in new tabs
- Minor formatting changes (code and appearance)

See also:
ckan/ckan#3191
rufuspollock-okfn/ckan.js#25
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

5 participants