Move new document version blocking logic to the checkouts app. Remove PERMISSION_DOCUMENT_RESTRICTIONS_OVERRIDE, overriding checkout restrictions even for admin users has the potential to confuse or corrupt data, removing it. Even admins must now checkin a document before trying to perform a restricted operation.

This commit is contained in:
Roberto Rosario
2015-06-16 20:38:45 -04:00
parent dc35ed6948
commit c8268b1a5b
9 changed files with 60 additions and 55 deletions

View File

@@ -71,6 +71,9 @@ def task_upload_new_version(document_id, shared_uploaded_file_id, user_id, comme
user = None
with File(file=shared_file.file) as file_object:
document.new_version(comment=comment, file_object=file_object, user=user)
shared_file.delete()
try:
document.new_version(comment=comment, file_object=file_object, user=user)
except Warning as warning:
logger.info('Warning during attempt to create new document version for document:%s ; %s', document, warning)
finally:
shared_file.delete()