Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable forbidding tus-replace when document is locked by another user. #7697

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/CA-5107.other
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Re-enable forbidding tus-replace when document is locked by another user. [njohner]
7 changes: 0 additions & 7 deletions opengever/api/tests/test_tus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from base64 import b64encode
from datetime import datetime
from ftw.builder import Builder
from ftw.builder import create
from ftw.testbrowser import browsing
Expand All @@ -11,7 +10,6 @@
from Products.CMFCore.utils import getToolByName
from Products.MimetypesRegistry.MimeTypeItem import MimeTypeItem
from six import BytesIO
from unittest import skipIf


UPLOAD_DATA = b"abcdefgh"
Expand Down Expand Up @@ -168,11 +166,6 @@ def test_cannot_replace_document_if_checked_out_by_other(self, browser):
self.login(self.regular_user, browser)
self.assert_tus_replace_fails(self.document, browser)

@skipIf(
datetime.now() < datetime(2023, 4, 1),
"Lock verification temporary disabled, because it's not yet works correctly. "
"Will be fixed with https://4teamwork.atlassian.net/browse/CA-5107",
)
@browsing
def test_cannot_replace_document_if_lock_token_not_provided(self, browser):
self.login(self.regular_user, browser)
Expand Down
5 changes: 2 additions & 3 deletions opengever/api/tus.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ def check_add_modify_permission(self, mode):
if self.context.has_file() and not manager.is_checked_out_by_current_user():
raise Forbidden("Document not checked out.")

# Check will be fixed with https://4teamwork.atlassian.net/browse/CA-5107
# if manager.is_locked_by_other():
# raise Forbidden("Document is locked.")
if manager.is_locked_by_other():
raise Forbidden("Document is locked.")

if self.is_proposal_document_upload() or self.is_proposal_template_upload():
tus_upload = self.tus_upload()
Expand Down