Commit 72037e97 authored by Marko Kuder's avatar Marko Kuder
Browse files

fix content editors uploading to active datasets

parent e5b0b90f
......@@ -171,6 +171,7 @@ def opsi_package_update(context, data_dict):
# "Vsebinski urednik", member of organization that is the owner of this package
if dgu_helpers.is_content_editor():
# reject saving active state unless it was already active and it is being saved as unpublished
# Note: resource_create initial auth checking skips this check due to state not being in data_dict of resource
if data_dict and data_dict.get('state') == 'active' and (package.state != 'active' or data_dict.get('unpublished', 'False') != 'True'):
return {'success': False,
'msg': _('Uporabnik %s nima pravic za objavo zbirke %s') %
......@@ -195,6 +195,7 @@ def opsi_action_resource_create(context, data_dict):
context['defer_commit'] = True
context['use_cache'] = False
context['ignore_auth'] = True #content editor will otherwise not be able to upload to active datasets
_get_action('package_update')(context, pkg_dict)
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