Commit c7ea99fe authored by Marko Kuder's avatar Marko Kuder
Browse files

apply uploading fix for resource_delete too (was only for resource_create and resource_update)

parent 5178d076
......@@ -175,7 +175,14 @@ def opsi_resource_delete(context, data_dict):
pkg_dict = {'id': pkg.id}
# package update needs package id, not resource id
return opsi_package_update(context, pkg_dict)
authorized = opsi_package_update(context, pkg_dict)
if not authorized:
return {'success': False,
'msg': _('User %s not authorized to delete resources on dataset %s') %
(str(user), pkg.id)}
else:
return {'success': True}
def opsi_package_update(context, data_dict):
model = context['model']
......
......@@ -50,8 +50,13 @@ def opsi_action_resource_delete(context, data_dict):
r['id'] == id and r['resource_type'] == 'documentation']
try:
context['ignore_auth'] = True #content editor will otherwise not be able to delete from active datasets
pkg_dict = _get_action('package_update')(context, pkg_dict)
except ValidationError, e:
if 'resources' not in e.error_dict:
raise Exception('resource_delete error: %r' %
e.error_dict)
errors = e.error_dict['resources'][-1]
raise ValidationError(errors)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment