Skip to content

Commit

Permalink
[#4827] Don't rely at all on resource object in context
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jul 1, 2019
1 parent 5ca0f20 commit 13c4e26
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ckan/logic/auth/get.py
Expand Up @@ -161,12 +161,11 @@ def resource_show(context, data_dict):
def resource_view_show(context, data_dict):

model = context['model']
resource = context.get('resource')
if not resource:
resource_view = model.ResourceView.get(data_dict['id'])
if not resource_view:
raise logic.NotFound(_('Resource view not found, cannot check auth.'))
resource = model.Resource.get(resource_view.resource_id)

resource_view = model.ResourceView.get(data_dict['id'])
if not resource_view:
raise logic.NotFound(_('Resource view not found, cannot check auth.'))
resource = model.Resource.get(resource_view.resource_id)

return authz.is_authorized('resource_show', context, {'id': resource.id})

Expand Down

0 comments on commit 13c4e26

Please sign in to comment.