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

Cannot view or edit private datasets as authorised user #84

Closed
wiebket opened this issue Nov 24, 2016 · 9 comments
Closed

Cannot view or edit private datasets as authorised user #84

wiebket opened this issue Nov 24, 2016 · 9 comments

Comments

@wiebket
Copy link

wiebket commented Nov 24, 2016

Thanks for a great ckanr package. I love it. I'm running ckan 2.6.0 and have run into the following issue:

  • ckanr_setup('my-site', key = 'apikey'): works fine; correct details displayed with ckanr_settings()
  • package_create(id='my_package'): works fine
  • package_show('my_package'): works fine
  • package_patch(list(private='true'), 'my_package'): works fine and changes the dataset to private
  • now the problem: package_show('my_package') now returns Error: 403, access denied.

Similarly, if I use user_show('admin', include_datasets=T) as admin user, I only see public datasets even though the documentation states that I ought to be able to view private ones too if I'm the authorised user. When running the same queries with the python API, I don't have a problem.

Happy to fork and suggest a fix if you tell me where to look. Otherwise would appreciate hearing where I'm going wrong.

Thanks! Wiebke

@florianm
Copy link
Contributor

florianm commented Nov 24, 2016

@SaintlyVi this looks similar to ckan/ckan#3176 - if your CKAN instance is older than this bug fix (end Aug 2016 - I suspect 2.5 would be affected and 2.6 might be fine), it could be a CKAN problem, rather than a ckanr one.
What CKAN version are you using? What does /api/util/status say?

@wiebket
Copy link
Author

wiebket commented Nov 24, 2016

Thanks for the comment @florianm. I upgraded to 2.6 at the beginning of the month specifically because I wanted to view private datasets. I've also tested with the python API, in which I can access private datasets without a problem. So I suspect that the problem lies with ckanr, unless there's a specific convention/setting in R that I haven't observed.

@florianm
Copy link
Contributor

@SaintlyVi thanks for the clarification - bummer, this needs some investigating, paging @sckott - we're in the middle of upgrading our datacats/Docker based CKAN instances (including data-demo.dpaw.wa.gov.au which is used as a test server for ckanR), so not sure how much available time and servers not on fire I've got on my end.

@wiebket
Copy link
Author

wiebket commented Nov 25, 2016

I'm happy to give the trouble shooting a shot myself if you can point me into the right direction of where to start looking @florianm @sckott Been keen on getting a bit deeper into development and this seems like a good opportunity to learn.

@sckott
Copy link
Contributor

sckott commented Nov 25, 2016

@SaintlyVi thanks for raising this issue, and offering to chip in

if you haven't already, fork and pull down the repo, make a feature branch. Then look into internals of package_show and user_show and see what could be going wrong with those, maybe credentials aren't being set properly, etc. If you sort it out, send a PR!

@sckott
Copy link
Contributor

sckott commented Feb 15, 2017

@SaintlyVi any thoughts?

@juusotam
Copy link

juusotam commented Jun 1, 2017

Not familiar (yet) with the git pull/push system... but I guess this should work... I added the ´key´ argument to the function.

So when calling the function it should be:

´package_show(id = 'xxxxxxxxxxxxxxxxxxxx', key = get_default_key())´

package_show <- function (id, use_default_schema = FALSE, url = get_default_url(), key = NULL, 
          as = "list", ...) {
  id <- as.ckan_package(id, url = url, key = key)
  args <- cc(list(id = id$id, use_default_schema = use_default_schema))
  res <- ckan_GET(url, "package_show", args, key = key, ...)
  switch(as, json = res, list = as_ck(jsl(res), "ckan_package"), 
         table = jsd(res))
}

@sckott
Copy link
Contributor

sckott commented Jun 7, 2017

good idea @juusotam - thanks

@sckott
Copy link
Contributor

sckott commented Sep 14, 2017

@juusotam opened new issue for your package_show fix, closing this issue due to inactivity

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

No branches or pull requests

4 participants