Skip to content

Commit

Permalink
[#3556] datastore_search update whitelist check
Browse files Browse the repository at this point in the history
_table_metadata no longer appears in _table_metadata (and thats just fine)
  • Loading branch information
wardi authored and David Read committed Aug 25, 2017
1 parent 228b932 commit 3ee86e9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ckanext/datastore/logic/action.py
Expand Up @@ -450,16 +450,16 @@ def datastore_search(context, data_dict):

res_id = data_dict['resource_id']

res_exists, real_id = backend.resource_id_from_alias(res_id)
# Resource only has to exist in the datastore (because it could be an
# alias)
if data_dict['resource_id'] not in WHITELISTED_RESOURCES:
res_exists, real_id = backend.resource_id_from_alias(res_id)
# Resource only has to exist in the datastore (because it could be an
# alias)

if not res_exists:
raise p.toolkit.ObjectNotFound(p.toolkit._(
'Resource "{0}" was not found.'.format(res_id)
))
if not res_exists:
raise p.toolkit.ObjectNotFound(p.toolkit._(
'Resource "{0}" was not found.'.format(res_id)
))

if data_dict['resource_id'] not in WHITELISTED_RESOURCES:
# Replace potential alias with real id to simplify access checks
if real_id:
data_dict['resource_id'] = real_id
Expand Down

0 comments on commit 3ee86e9

Please sign in to comment.