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:
@@ -3,16 +3,38 @@ from __future__ import unicode_literals
|
||||
from django.utils.translation import ugettext
|
||||
|
||||
|
||||
class DocumentNotCheckedOut(Exception):
|
||||
class DocumentCheckoutError(Exception):
|
||||
"""
|
||||
Base checkout exception
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class DocumentCheckoutWarning(Warning):
|
||||
"""
|
||||
Base checkout warning
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class DocumentNotCheckedOut(DocumentCheckoutError):
|
||||
"""
|
||||
Raised when trying to checkin a document that is not checkedout
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class DocumentAlreadyCheckedOut(Exception):
|
||||
class DocumentAlreadyCheckedOut(DocumentCheckoutError):
|
||||
"""
|
||||
Raised when trying to checkout an already checkedout document
|
||||
"""
|
||||
def __unicode__(self):
|
||||
return ugettext('Document already checked out.')
|
||||
|
||||
|
||||
class NewDocumentVersionNotAllowed(DocumentCheckoutWarning):
|
||||
"""
|
||||
Uploading new versions for this document is not allowed
|
||||
Current reasons: Document is in checked out state
|
||||
"""
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user