Skip to content

Commit

Permalink
[#2142] Fix crash on creating datasets in the web UI
Browse files Browse the repository at this point in the history
Try to create any dataset in the web UI and after submitting the first
form it crashes with logic.NotFound.

The package controller is passing a package dict to the
resource_create() auth function, which is surely wrong.

Change it to pass a dict with just the "package_id" for the (not created
yet) new resource instead, this seems to be all the resource_create()
auth function needs.
  • Loading branch information
seanh committed Dec 12, 2014
1 parent 5aef5ed commit caa0b79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ckan/controllers/package.py
Expand Up @@ -744,7 +744,8 @@ def new_resource(self, id, data=None, errors=None, error_summary=None):
except NotFound:
abort(404, _('The dataset {id} could not be found.').format(id=id))
try:
check_access('resource_create', context, pkg_dict)
check_access(
'resource_create', context, {"package_id": pkg_dict["id"]})
except NotAuthorized:
abort(401, _('Unauthorized to create a resource for this package'))

Expand Down

0 comments on commit caa0b79

Please sign in to comment.