[#35] Ignore auth when using site_user
This commit is contained in:
parent
cf7774ceba
commit
d921dde407
|
@ -505,6 +505,9 @@ class SpatialHarvester(HarvesterBase):
|
||||||
'extras_as_string': True,
|
'extras_as_string': True,
|
||||||
'api_version': '2',
|
'api_version': '2',
|
||||||
'return_id_only': True}
|
'return_id_only': True}
|
||||||
|
if context['user'] == self._site_user['name']:
|
||||||
|
context['ignore_auth'] = True
|
||||||
|
|
||||||
|
|
||||||
# The default package schema does not like Upper case tags
|
# The default package schema does not like Upper case tags
|
||||||
tag_schema = logic.schema.default_tags_schema()
|
tag_schema = logic.schema.default_tags_schema()
|
||||||
|
@ -646,12 +649,13 @@ class SpatialHarvester(HarvesterBase):
|
||||||
if self._user_name:
|
if self._user_name:
|
||||||
return self._user_name
|
return self._user_name
|
||||||
|
|
||||||
|
self._site_user = p.toolkit.get_action('get_site_user')({'model': model, 'ignore_auth': True}, {})
|
||||||
|
|
||||||
config_user_name = config.get('ckanext.spatial.harvest.user_name')
|
config_user_name = config.get('ckanext.spatial.harvest.user_name')
|
||||||
if config_user_name:
|
if config_user_name:
|
||||||
self._user_name = config_user_name
|
self._user_name = config_user_name
|
||||||
else:
|
else:
|
||||||
user = p.toolkit.get_action('get_site_user')({'model': model, 'ignore_auth': True}, {})
|
self._user_name = self._site_user['name']
|
||||||
self._user_name = user['name']
|
|
||||||
|
|
||||||
return self._user_name
|
return self._user_name
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,9 @@ class SpatialQueryTestBase(SpatialTestBase):
|
||||||
'session': model.Session,
|
'session': model.Session,
|
||||||
'user': user['name'],
|
'user': user['name'],
|
||||||
'extras_as_string': True,
|
'extras_as_string': True,
|
||||||
'api_version': 2}
|
'api_version': 2,
|
||||||
|
'ignore_auth': True,
|
||||||
|
}
|
||||||
package_dict = package_create(context, package_dict)
|
package_dict = package_create(context, package_dict)
|
||||||
return context.get('id')
|
return context.get('id')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue