From 43a6e64596262d596e8d217e4e9c8487ca69a137 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Tue, 18 Jul 2023 12:29:09 +0545 Subject: [PATCH 1/3] refactor use of webdavapiversion on public lock and bug demonstration --- .../apiWebdavLocks/publicLink.feature | 8 ++++++-- .../publicLinkOc10Issue40882.feature | 20 +++++++++++++++++++ .../bootstrap/WebDavLockingContext.php | 8 +++++--- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature diff --git a/tests/acceptance/features/apiWebdavLocks/publicLink.feature b/tests/acceptance/features/apiWebdavLocks/publicLink.feature index b2919eae8d87..de15bdcc842a 100644 --- a/tests/acceptance/features/apiWebdavLocks/publicLink.feature +++ b/tests/acceptance/features/apiWebdavLocks/publicLink.feature @@ -82,7 +82,7 @@ Feature: persistent-locking in case of a public link | new | shared | | new | exclusive | - @smokeTest + @smokeTest @issue-40882 Scenario Outline: Public locking is not supported Given user "Alice" has created a public link share of folder "PARENT" with change permission When the public locks "/CHILD" in the last public link shared folder using the public WebDAV API setting the following properties @@ -93,5 +93,9 @@ Feature: persistent-locking in case of a public link | public-webdav-api-version | lock-scope | | old | shared | | old | exclusive | + + @skipOnOcV10 + Examples: + | public-webdav-api-version | lock-scope | | new | shared | - | new | exclusive | + | new | exclusive | \ No newline at end of file diff --git a/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature b/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature new file mode 100644 index 000000000000..bb94b7e415a4 --- /dev/null +++ b/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature @@ -0,0 +1,20 @@ +@api @smokeTest @public_link_share-feature-required @files_sharing-app-required @issue-40882 +Feature: persistent-locking in case of a public link + + Background: + Given user "Alice" has been created with default attributes and without skeleton files + And user "Alice" has created folder "PARENT" + And user "Alice" has created folder "PARENT/CHILD" + And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt" + And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/CHILD/child.txt" + + + Scenario Outline: Public locking is not supported + Given user "Alice" has created a public link share of folder "PARENT" with change permission + When the public locks "/CHILD" in the last public link shared folder using the public WebDAV API setting the following properties + | lockscope | | + Then the HTTP status code should be "403" + Examples: + | public-webdav-api-version | lock-scope | + | new | shared | + | new | exclusive | diff --git a/tests/acceptance/features/bootstrap/WebDavLockingContext.php b/tests/acceptance/features/bootstrap/WebDavLockingContext.php index 34ba53547af9..a5c9fc68fdcb 100644 --- a/tests/acceptance/features/bootstrap/WebDavLockingContext.php +++ b/tests/acceptance/features/bootstrap/WebDavLockingContext.php @@ -60,12 +60,13 @@ private function lockFile( string $file, TableNode $properties, bool $public = false, - bool $expectToSucceed = true + bool $expectToSucceed = true, + string $publicWebDAVAPIVersion = "old" ) { $user = $this->featureContext->getActualUsername($user); $baseUrl = $this->featureContext->getBaseUrl(); if ($public === true) { - $type = "public-files"; + $type = "public-files-$publicWebDAVAPIVersion"; $password = null; } else { $type = "files"; @@ -211,7 +212,8 @@ public function publicLocksFileLastSharedFolder( $file, $properties, true, - false + false, + $publicWebDAVAPIVersion ); } From bdb2a02bb39d61f9d3d882e4c16ccb3fefe7f3a5 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Tue, 18 Jul 2023 12:59:15 +0545 Subject: [PATCH 2/3] php style fix --- tests/acceptance/features/bootstrap/WebDavLockingContext.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/features/bootstrap/WebDavLockingContext.php b/tests/acceptance/features/bootstrap/WebDavLockingContext.php index a5c9fc68fdcb..1884e229368b 100644 --- a/tests/acceptance/features/bootstrap/WebDavLockingContext.php +++ b/tests/acceptance/features/bootstrap/WebDavLockingContext.php @@ -52,6 +52,7 @@ class WebDavLockingContext implements Context { * @param TableNode $properties table with no heading with | property | value | * @param boolean $public if the file is in a public share or not * @param boolean $expectToSucceed + * @param string $publicWebDAVAPIVersion * * @return void */ From 8b390c77fef053178f29da44f4b509a4ca594974 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Wed, 19 Jul 2023 09:21:50 +0545 Subject: [PATCH 3/3] addressed reviews --- .../features/apiWebdavLocks/publicLink.feature | 2 +- .../apiWebdavLocks/publicLinkOc10Issue40882.feature | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/features/apiWebdavLocks/publicLink.feature b/tests/acceptance/features/apiWebdavLocks/publicLink.feature index de15bdcc842a..6f33efe5d294 100644 --- a/tests/acceptance/features/apiWebdavLocks/publicLink.feature +++ b/tests/acceptance/features/apiWebdavLocks/publicLink.feature @@ -94,7 +94,7 @@ Feature: persistent-locking in case of a public link | old | shared | | old | exclusive | - @skipOnOcV10 + @skipOnOcV10 Examples: | public-webdav-api-version | lock-scope | | new | shared | diff --git a/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature b/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature index bb94b7e415a4..15aa3e9fcb32 100644 --- a/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature +++ b/tests/acceptance/features/apiWebdavLocks/publicLinkOc10Issue40882.feature @@ -1,16 +1,14 @@ -@api @smokeTest @public_link_share-feature-required @files_sharing-app-required @issue-40882 +@api @smokeTest @public_link_share-feature-required @files_sharing-app-required Feature: persistent-locking in case of a public link - Background: + + Scenario Outline: Public locking is not supported Given user "Alice" has been created with default attributes and without skeleton files And user "Alice" has created folder "PARENT" And user "Alice" has created folder "PARENT/CHILD" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/CHILD/child.txt" - - - Scenario Outline: Public locking is not supported - Given user "Alice" has created a public link share of folder "PARENT" with change permission + And user "Alice" has created a public link share of folder "PARENT" with change permission When the public locks "/CHILD" in the last public link shared folder using the public WebDAV API setting the following properties | lockscope | | Then the HTTP status code should be "403"