From 2cd625777122e292c92b30bc0ec0c6f4fc29a178 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 8 Feb 2023 12:21:00 +0100 Subject: [PATCH 01/11] change test expectations --- go.mod | 2 + go.sum | 6 +- .../expected-failures-API-on-OCIS-storage.md | 4 - .../coreApiVersions/fileVersions.feature | 76 ++++--------------- 4 files changed, 17 insertions(+), 71 deletions(-) diff --git a/go.mod b/go.mod index 2d215f664a1..1161675408a 100644 --- a/go.mod +++ b/go.mod @@ -321,3 +321,5 @@ require ( ) replace github.com/cs3org/go-cs3apis => github.com/c0rby/go-cs3apis v0.0.0-20230110100311-5b424f1baa35 + +replace github.com/cs3org/reva/v2 => github.com/micbar/reva/v2 v2.0.0-20230403215034-66e24325ae82 diff --git a/go.sum b/go.sum index 03ac3a0d27d..8afbbe8d656 100644 --- a/go.sum +++ b/go.sum @@ -625,10 +625,6 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4= github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc= github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA= -github.com/cs3org/reva/v2 v2.12.1-0.20230331184913-eca8953fb6e9 h1:zUMD0UvKVPbR3UaodnA0GXuBycxrIuaO8Kshgi3iKKI= -github.com/cs3org/reva/v2 v2.12.1-0.20230331184913-eca8953fb6e9/go.mod h1:FNAYs5H3xs8v0OFmNgZtiMAzIMXd/6TJmO0uZuNn8pQ= -github.com/cs3org/reva/v2 v2.12.1-0.20230403080425-f93a726ab656 h1:FAlxhUtG0/57X4i05x3suRd/rtAecM/7ZWeJ9ZtqrIc= -github.com/cs3org/reva/v2 v2.12.1-0.20230403080425-f93a726ab656/go.mod h1:FNAYs5H3xs8v0OFmNgZtiMAzIMXd/6TJmO0uZuNn8pQ= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -1268,6 +1264,8 @@ github.com/maxymania/go-system v0.0.0-20170110133659-647cc364bf0b h1:Q53idHrTuQD github.com/maxymania/go-system v0.0.0-20170110133659-647cc364bf0b/go.mod h1:KirJrATYGbTyUwVR26xIkaipRqRcMRXBf8N5dacvGus= github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 h1:Z/i1e+gTZrmcGeZyWckaLfucYG6KYOXLWo4co8pZYNY= github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103/go.mod h1:o9YPB5aGP8ob35Vy6+vyq3P3bWe7NQWzf+JLiXCiMaE= +github.com/micbar/reva/v2 v2.0.0-20230403215034-66e24325ae82 h1:ivuBEObF9BlpArq363tS2qB9w4YO+b+uO59GueepZhk= +github.com/micbar/reva/v2 v2.0.0-20230403215034-66e24325ae82/go.mod h1:FNAYs5H3xs8v0OFmNgZtiMAzIMXd/6TJmO0uZuNn8pQ= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.40/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 35b9a0dd2e3..b343d71ee1e 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -359,10 +359,6 @@ cannot share a folder with create permission - [coreApiShareUpdateToShares/updateShare.feature:241](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L241) - [coreApiShareUpdateToShares/updateShare.feature:242](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L242) -#### [user can access version metadata of a received share before accepting it](https://github.com/owncloud/ocis/issues/760) - -- [coreApiVersions/fileVersions.feature:487](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiVersions/fileVersions.feature#L487) - #### [Share lists deleted user as 'user'](https://github.com/owncloud/ocis/issues/903) - [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:676](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L676) diff --git a/tests/acceptance/features/coreApiVersions/fileVersions.feature b/tests/acceptance/features/coreApiVersions/fileVersions.feature index 849ba54edaa..ada3b79c4f0 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersions.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersions.feature @@ -285,7 +285,7 @@ Feature: dav-versions | permissions | read | When user "Brian" accepts share "/davtest.txt" offered by user "Alice" using the sharing API Then the HTTP status code should be "200" - And the version folder of fileId "<>" for user "Brian" should contain "1" element + And the version folder of fileId "<>" for user "Brian" should contain "-1" element @files_sharing-app-required Scenario: sharer of a file can see the old version information when the sharee changes the content of the file @@ -295,7 +295,7 @@ Feature: dav-versions And user "Brian" has accepted share "/sharefile.txt" offered by user "Alice" When user "Brian" uploads file with content "Second content" to "/Shares/sharefile.txt" using the WebDAV API Then the HTTP status code should be "204" - And the version folder of file "/Shares/sharefile.txt" for user "Brian" should contain "1" element + And the version folder of file "/Shares/sharefile.txt" for user "Brian" should contain "-1" element And the version folder of file "/sharefile.txt" for user "Alice" should contain "1" element @files_sharing-app-required @@ -327,20 +327,19 @@ Feature: dav-versions Scenario: sharee can restore a file inside a shared folder modified by sharee Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/sharingfolder" - And user "Alice" has shared folder "/sharingfolder" with user "Brian" + And user "Alice" has shared folder "/sharingfolder" with user "Brian" with permissions "all" And user "Brian" has accepted share "/sharingfolder" offered by user "Alice" And user "Alice" has uploaded file with content "First content" to "/sharingfolder/sharefile.txt" - And user "Brian" has uploaded file with content "Second content" to "/Shares/sharingfolder/sharefile.txt" - When user "Brian" restores version index "1" of file "/Shares/sharingfolder/sharefile.txt" using the WebDAV API - Then the HTTP status code should be "204" - And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "First content" - And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "First content" + When user "Brian" has uploaded file with content "Second content" to "/Shares/sharingfolder/sharefile.txt" + Then the version folder of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should contain "-1" elements + And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "Second content" + And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "Second content" @files_sharing-app-required Scenario: sharer can restore a file inside a shared folder created by sharee and modified by sharer Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/sharingfolder" - And user "Alice" has shared folder "/sharingfolder" with user "Brian" + And user "Alice" has shared folder "/sharingfolder" with user "Brian" with permissions "all" And user "Brian" has accepted share "/sharingfolder" offered by user "Alice" And user "Brian" has uploaded file with content "First content" to "/Shares/sharingfolder/sharefile.txt" And user "Alice" has uploaded file with content "Second content" to "/sharingfolder/sharefile.txt" @@ -349,24 +348,11 @@ Feature: dav-versions And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "First content" And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "First content" - @files_sharing-app-required - Scenario: sharee can restore a file inside a shared folder created by sharee and modified by sharer - Given user "Brian" has been created with default attributes and without skeleton files - And user "Alice" has created folder "/sharingfolder" - And user "Alice" has shared folder "/sharingfolder" with user "Brian" - And user "Brian" has accepted share "/sharingfolder" offered by user "Alice" - And user "Brian" has uploaded file with content "First content" to "/Shares/sharingfolder/sharefile.txt" - And user "Alice" has uploaded file with content "Second content" to "/sharingfolder/sharefile.txt" - When user "Brian" restores version index "1" of file "/Shares/sharingfolder/sharefile.txt" using the WebDAV API - Then the HTTP status code should be "204" - And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "First content" - And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "First content" - @files_sharing-app-required Scenario: sharer can restore a file inside a shared folder created by sharee and modified by sharee Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/sharingfolder" - And user "Alice" has shared folder "/sharingfolder" with user "Brian" + And user "Alice" has shared folder "/sharingfolder" with user "Brian" with permissions "all" And user "Brian" has accepted share "/sharingfolder" offered by user "Alice" And user "Brian" has uploaded file with content "old content" to "/Shares/sharingfolder/sharefile.txt" And user "Brian" has uploaded file with content "new content" to "/Shares/sharingfolder/sharefile.txt" @@ -375,19 +361,6 @@ Feature: dav-versions And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "old content" And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "old content" - @files_sharing-app-required - Scenario: sharee can restore a file inside a shared folder created by sharer and modified by sharer - Given user "Brian" has been created with default attributes and without skeleton files - And user "Alice" has created folder "/sharingfolder" - And user "Alice" has shared folder "/sharingfolder" with user "Brian" - And user "Brian" has accepted share "/sharingfolder" offered by user "Alice" - And user "Alice" has uploaded file with content "old content" to "/sharingfolder/sharefile.txt" - And user "Alice" has uploaded file with content "new content" to "/sharingfolder/sharefile.txt" - When user "Brian" restores version index "1" of file "/Shares/sharingfolder/sharefile.txt" using the WebDAV API - Then the HTTP status code should be "204" - And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "old content" - And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "old content" - @files_sharing-app-required Scenario: sharer can restore a file inside a group shared folder modified by sharee Given user "Brian" has been created with default attributes and without skeleton files @@ -428,7 +401,6 @@ Feature: dav-versions And the content of file "/testshare/testfile.txt" for user "Brian" should be "test data 3" And as "" file "/testfile.txt" should not exist And the version folder of file "/Shares/testshare/testfile.txt" for user "Alice" should contain "2" elements - And the version folder of file "/testshare/testfile.txt" for user "Brian" should contain "2" elements Examples: | dav_version | mover | dst-folder | | old | Brian | /testshare | @@ -480,8 +452,8 @@ Feature: dav-versions And user "Alice" has shared file "textfile0.txt" with user "Brian" And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" When user "Brian" tries to get versions of file "textfile0.txt" from "Alice" - Then the HTTP status code should be "207" - And the number of versions should be "3" + Then the HTTP status code should be "403" + And the number of versions should be "0" @issue-760 Scenario: Receiver tries get file versions of shared file before receiving it @@ -492,8 +464,8 @@ Feature: dav-versions And we save it into "FILEID" And user "Alice" has shared file "textfile0.txt" with user "Brian" When user "Brian" tries to get versions of file "textfile0.txt" from "Alice" - Then the HTTP status code should be "404" - And the value of the item "//s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound" + Then the HTTP status code should be "403" + And the value of the item "//s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\Forbidden" Scenario: sharer tries get file versions of shared file when the sharee changes the content of the file @@ -503,26 +475,4 @@ Feature: dav-versions And user "Brian" has accepted share "/sharefile.txt" offered by user "Alice" When user "Brian" has uploaded file with content "Second content" to "/Shares/sharefile.txt" Then the HTTP status code should be "204" - And the version folder of file "/Shares/sharefile.txt" for user "Brian" should contain "1" element And the version folder of file "/sharefile.txt" for user "Alice" should contain "1" element - - - Scenario: download old versions of a shared file as share receiver - Given user "Brian" has been created with default attributes and without skeleton files - And user "Alice" has uploaded file with content "uploaded content" to "textfile0.txt" - And user "Alice" has uploaded file with content "version 1" to "textfile0.txt" - And user "Alice" has uploaded file with content "version 2" to "textfile0.txt" - And user "Alice" has shared file "textfile0.txt" with user "Brian" - And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" - When user "Brian" downloads the version of file "/Shares/textfile0.txt" with the index "1" - Then the HTTP status code should be "200" - And the following headers should be set - | header | value | - | Content-Disposition | attachment; filename*=UTF-8''textfile0.txt; filename="textfile0.txt" | - And the downloaded content should be "version 1" - When user "Brian" downloads the version of file "/Shares/textfile0.txt" with the index "2" - Then the HTTP status code should be "200" - And the following headers should be set - | header | value | - | Content-Disposition | attachment; filename*=UTF-8''textfile0.txt; filename="textfile0.txt" | - And the downloaded content should be "uploaded content" From 24ffb95243a56fbcd7b36dfeeaa5455233d779d0 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Tue, 4 Apr 2023 11:09:21 +0200 Subject: [PATCH 02/11] bump reva version --- go.mod | 4 +--- go.sum | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1161675408a..78fcb305cb0 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/blevesearch/bleve/v2 v2.3.7 github.com/coreos/go-oidc/v3 v3.4.0 github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965 - github.com/cs3org/reva/v2 v2.12.1-0.20230403080425-f93a726ab656 + github.com/cs3org/reva/v2 v2.12.1-0.20230404090709-bb973fae26ae github.com/disintegration/imaging v1.6.2 github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e github.com/egirna/icap-client v0.1.1 @@ -321,5 +321,3 @@ require ( ) replace github.com/cs3org/go-cs3apis => github.com/c0rby/go-cs3apis v0.0.0-20230110100311-5b424f1baa35 - -replace github.com/cs3org/reva/v2 => github.com/micbar/reva/v2 v2.0.0-20230403215034-66e24325ae82 diff --git a/go.sum b/go.sum index 8afbbe8d656..b647bf2b795 100644 --- a/go.sum +++ b/go.sum @@ -625,6 +625,8 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4= github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc= github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA= +github.com/cs3org/reva/v2 v2.12.1-0.20230404090709-bb973fae26ae h1:APfYubzIYqCTXtmX6cAm4c8wBYS3R/cZwomX8IlXLaI= +github.com/cs3org/reva/v2 v2.12.1-0.20230404090709-bb973fae26ae/go.mod h1:FNAYs5H3xs8v0OFmNgZtiMAzIMXd/6TJmO0uZuNn8pQ= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= From ba77d05835f6445a255d24ef98ed518aa813e6d5 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Tue, 4 Apr 2023 11:28:43 +0200 Subject: [PATCH 03/11] add changelog --- changelog/unreleased/do-not-share-versions.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/do-not-share-versions.md diff --git a/changelog/unreleased/do-not-share-versions.md b/changelog/unreleased/do-not-share-versions.md new file mode 100644 index 00000000000..b28fb599620 --- /dev/null +++ b/changelog/unreleased/do-not-share-versions.md @@ -0,0 +1,5 @@ +Change: Do not share versions + +We changed the default behavior of shares: Share receivers have no access to versions. People in spaces with the "Editor" or "Manager" role can still see versions and work with them. + +https://github.com/owncloud/ocis/pull/5531 From c42e971330fe2122362af15b617476feebcc3455 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 5 Apr 2023 12:06:11 +0200 Subject: [PATCH 04/11] fix test --- .../features/apiSpaces/download.feature | 11 +++- .../changingFilesShare.feature | 4 +- .../features/bootstrap/SpacesContext.php | 16 +++++ .../coreApiVersions/fileVersionAuthor.feature | 2 +- .../coreApiVersions/fileVersions.feature | 59 ++++++------------- 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/download.feature b/tests/acceptance/features/apiSpaces/download.feature index 80f70c043dd..1cbfc4f8480 100644 --- a/tests/acceptance/features/apiSpaces/download.feature +++ b/tests/acceptance/features/apiSpaces/download.feature @@ -23,7 +23,7 @@ Feature: Download file in project space | role | viewer | - Scenario Outline: An user downloads a file in the project space + Scenario Outline: A user downloads a file in the project space When user "" downloads the file "file.txt" of the space "download file" using the WebDAV API Then the HTTP status code should be "200" And the following headers should be set @@ -36,7 +36,7 @@ Feature: Download file in project space | Bob | - Scenario Outline: An user downloads an old version of the file in the project space + Scenario Outline: users with role manager and editor can download an old version of the file in the project space Given user "Alice" has uploaded a file inside space "download file" with content "new content" to "file.txt" And user "Alice" has uploaded a file inside space "download file" with content "newest content" to "file.txt" When user "" downloads version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API @@ -53,4 +53,9 @@ Feature: Download file in project space | user | | Alice | | Brian | - | Bob | + + Scenario: A user viewer cannot get the old version of the file in the project space + Given user "Alice" has uploaded a file inside space "download file" with content "new content" to "file.txt" + When user "Bob" tries to get version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API + Then the HTTP status code should be "403" + \ No newline at end of file diff --git a/tests/acceptance/features/apiSpacesShares/changingFilesShare.feature b/tests/acceptance/features/apiSpacesShares/changingFilesShare.feature index d9b918ba221..c369f902658 100644 --- a/tests/acceptance/features/apiSpacesShares/changingFilesShare.feature +++ b/tests/acceptance/features/apiSpacesShares/changingFilesShare.feature @@ -41,6 +41,8 @@ Feature: When user "Alice" downloads version of the file "/textfile1.txt" with the index "2" of the space "Personal" using the WebDAV API Then the HTTP status code should be "200" And the downloaded content should be "old content version 1" - When user "Brian" downloads version of the file "/textfile1.txt" with the index "1" of the space "Shares" using the WebDAV API + When user "Alice" downloads version of the file "/textfile1.txt" with the index "1" of the space "Personal" using the WebDAV API Then the HTTP status code should be "200" And the downloaded content should be "old content version 2" + When user "Brian" tries to get version of the file "/textfile1.txt" with the index "1" of the space "Shares" using the WebDAV API + Then the HTTP status code should be "403" diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 386b68cfcf3..5049dabf69c 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2739,6 +2739,22 @@ public function downloadVersionOfTheFile( WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } + /** + * @When /^user "([^"]*)" tries to get version of the file "([^"]*)" with the index "([^"]*)" of the space "([^"]*)" using the WebDAV API$/ + * + * @param string $user + * @param string $file + * @param string $index + * @param string $spaceName + * + * @return void + * @throws Exception + */ + public function userTriesToDownloadFileVersions(string $user, string $file, string $index, string $spaceName):void { + $this->setSpaceIDByName($user, $spaceName); + $this->filesVersionsContext->userGetsFileVersions($user, $file); + } + /** * return the etag for an element inside a space * diff --git a/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature b/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature index 0e013e40164..89934e8cb09 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature @@ -1,4 +1,4 @@ -@api @issue-2914 +@api @issue-2914 @skipOnOcis @toImplementOnOCIS Feature: file versions remember the author of each version Background: diff --git a/tests/acceptance/features/coreApiVersions/fileVersions.feature b/tests/acceptance/features/coreApiVersions/fileVersions.feature index ada3b79c4f0..0a465e048d0 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersions.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersions.feature @@ -1,4 +1,4 @@ -@api @files_versions-app-required @issue-1262 +@api Feature: dav-versions @@ -13,7 +13,7 @@ Feature: dav-versions Then the HTTP status code should be "201" And the version folder of file "/davtest.txt" for user "Alice" should contain "0" elements - @issue-1343 @issue-1321 + Scenario: Upload file and no version is available using various chunking methods (except new chunking) When user "Alice" uploads file "filesForUpload/davtest.txt" to filenames based on "/davtest.txt" with all mechanisms except new chunking using the WebDAV API Then the HTTP status code should be "200" @@ -29,7 +29,7 @@ Feature: dav-versions And the version folder of file "/davtest.txt" for user "Alice" should contain "1" element And the content length of file "/davtest.txt" with version index "1" for user "Alice" in versions folder should be "8" - @issue-1343 @issue-1321 + Scenario: Upload a file twice and versions are available using various chunking methods (except new chunking) When user "Alice" uploads file "filesForUpload/davtest.txt" to filenames based on "/davtest.txt" with all mechanisms except new chunking using the WebDAV API And user "Alice" uploads file "filesForUpload/davtest.txt" to filenames based on "/davtest.txt" with all mechanisms except new chunking using the WebDAV API @@ -66,7 +66,7 @@ Feature: dav-versions Then the HTTP status code should be "204" And the content of file "/davtest.txt" for user "Alice" should be "Back To The Future." - @smokeTest @skipOnStorage:ceph @files_primary_s3-issue-161 @issue-1343 @issue-1321 + @smokeTest @skipOnStorage:ceph @files_primary_s3-issue-161 Scenario Outline: Uploading a chunked file does create the correct version that can be restored Given using DAV path And user "Alice" has uploaded file with content "textfile0" to "textfile0.txt" @@ -127,7 +127,7 @@ Feature: dav-versions Then the HTTP status code should be "204" And the content of file "/renamedfile.txt" for user "Alice" should be "old content" - @issue-1238 + Scenario: User can access version number after moving a file Given user "Alice" has created folder "testFolder" And user "Alice" has uploaded file with content "uploaded content" to "textfile0.txt" @@ -146,7 +146,7 @@ Feature: dav-versions Then the HTTP status code should be "207" And the number of versions should be "0" - @issue-1234 + Scenario: the number of etag elements in response changes according to version of the file Given user "Alice" has uploaded file with content "uploaded content" to "textfile0.txt" And user "Alice" has uploaded file with content "version 1" to "textfile0.txt" @@ -249,14 +249,14 @@ Feature: dav-versions Then the HTTP status code should be "204" And the content of file "/davtest.txt" for user "Alice" should be "Old Test Content." - @issue-5010 + Scenario: Upload the same file twice with the same mtime and a version is available Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the WebDAV API When user "Alice" uploads file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the WebDAV API Then the HTTP status code should be "204" And the version folder of file "/file.txt" for user "Alice" should contain "1" element - @issue-5010 + Scenario: Upload the same file more than twice with the same mtime and only one version is available Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the WebDAV API And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the WebDAV API @@ -264,7 +264,7 @@ Feature: dav-versions Then the HTTP status code should be "204" And the version folder of file "/file.txt" for user "Alice" should contain "1" element - @issue-5010 + Scenario: Upload the same file twice with the same mtime and no version after restoring Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the WebDAV API And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the WebDAV API @@ -272,21 +272,6 @@ Feature: dav-versions Then the HTTP status code should be "204" And the version folder of file "/file.txt" for user "Alice" should contain "0" element - @files_sharing-app-required - Scenario: User can access meta folder of a file which is owned by somebody else but shared with that user - Given user "Brian" has been created with default attributes and without skeleton files - And user "Alice" has uploaded file with content "123" to "/davtest.txt" - And user "Alice" has uploaded file with content "456789" to "/davtest.txt" - And we save it into "FILEID" - And user "Alice" has created a share with settings - | path | /davtest.txt | - | shareType | user | - | shareWith | Brian | - | permissions | read | - When user "Brian" accepts share "/davtest.txt" offered by user "Alice" using the sharing API - Then the HTTP status code should be "200" - And the version folder of fileId "<>" for user "Brian" should contain "-1" element - @files_sharing-app-required Scenario: sharer of a file can see the old version information when the sharee changes the content of the file Given user "Brian" has been created with default attributes and without skeleton files @@ -295,8 +280,9 @@ Feature: dav-versions And user "Brian" has accepted share "/sharefile.txt" offered by user "Alice" When user "Brian" uploads file with content "Second content" to "/Shares/sharefile.txt" using the WebDAV API Then the HTTP status code should be "204" - And the version folder of file "/Shares/sharefile.txt" for user "Brian" should contain "-1" element And the version folder of file "/sharefile.txt" for user "Alice" should contain "1" element + When user "Brian" gets the number of versions of file "/Shares/sharefile.txt" + Then the HTTP status code should be "403" @files_sharing-app-required Scenario: sharer of a file can restore the original content of a shared file after the file has been modified by the sharee @@ -324,14 +310,15 @@ Feature: dav-versions And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "First content" @files_sharing-app-required - Scenario: sharee can restore a file inside a shared folder modified by sharee + Scenario: sharer can see a version of a file inside a shared folder when modified by sharee Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/sharingfolder" And user "Alice" has shared folder "/sharingfolder" with user "Brian" with permissions "all" And user "Brian" has accepted share "/sharingfolder" offered by user "Alice" And user "Alice" has uploaded file with content "First content" to "/sharingfolder/sharefile.txt" When user "Brian" has uploaded file with content "Second content" to "/Shares/sharingfolder/sharefile.txt" - Then the version folder of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should contain "-1" elements + And user "Brian" gets the number of versions of file "/Shares/sharingfolder/sharefile.txt" + Then the HTTP status code should be "403" And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "Second content" And the content of file "/sharingfolder/sharefile.txt" for user "Alice" should be "Second content" @@ -381,7 +368,7 @@ Feature: dav-versions And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "First content" And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Carol" should be "First content" - @files_sharing-app-required @issue-1238 + @files_sharing-app-required Scenario Outline: Moving a file (with versions) into a shared folder as the sharee and as the sharer Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -406,7 +393,7 @@ Feature: dav-versions | old | Brian | /testshare | | new | Brian | /testshare | - @files_sharing-app-required @issue-1238 + @files_sharing-app-required Scenario Outline: Moving a file (with versions) out of a shared folder as the sharee and as the sharer Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -453,26 +440,14 @@ Feature: dav-versions And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" When user "Brian" tries to get versions of file "textfile0.txt" from "Alice" Then the HTTP status code should be "403" - And the number of versions should be "0" - @issue-760 + Scenario: Receiver tries get file versions of shared file before receiving it Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "textfile0" to "textfile0.txt" And user "Alice" has uploaded file with content "version 1" to "textfile0.txt" And user "Alice" has uploaded file with content "version 2" to "textfile0.txt" - And we save it into "FILEID" And user "Alice" has shared file "textfile0.txt" with user "Brian" When user "Brian" tries to get versions of file "textfile0.txt" from "Alice" Then the HTTP status code should be "403" And the value of the item "//s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\Forbidden" - - - Scenario: sharer tries get file versions of shared file when the sharee changes the content of the file - Given user "Brian" has been created with default attributes and without skeleton files - And user "Alice" has uploaded file with content "First content" to "sharefile.txt" - And user "Alice" has shared file "sharefile.txt" with user "Brian" - And user "Brian" has accepted share "/sharefile.txt" offered by user "Alice" - When user "Brian" has uploaded file with content "Second content" to "/Shares/sharefile.txt" - Then the HTTP status code should be "204" - And the version folder of file "/sharefile.txt" for user "Alice" should contain "1" element From 89c35e4b55a778b705a3ade8958b63f10d0572b5 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 5 Apr 2023 12:48:58 +0200 Subject: [PATCH 05/11] php style fix --- tests/acceptance/features/bootstrap/SpacesContext.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 5049dabf69c..d44cbbc6cdc 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2739,7 +2739,7 @@ public function downloadVersionOfTheFile( WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } - /** + /** * @When /^user "([^"]*)" tries to get version of the file "([^"]*)" with the index "([^"]*)" of the space "([^"]*)" using the WebDAV API$/ * * @param string $user @@ -2752,7 +2752,7 @@ public function downloadVersionOfTheFile( */ public function userTriesToDownloadFileVersions(string $user, string $file, string $index, string $spaceName):void { $this->setSpaceIDByName($user, $spaceName); - $this->filesVersionsContext->userGetsFileVersions($user, $file); + $this->filesVersionsContext->userGetsFileVersions($user, $file); } /** From 6bc92b880eb852487a4406402df7445edcf0ce28 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 5 Apr 2023 14:49:41 +0200 Subject: [PATCH 06/11] bump webCommit. fixt contarct tests --- .drone.env | 2 +- .../features/apiContract/sharesReport.feature | 4 +- .../features/apiContract/spacesReport.feature | 4 +- .../apiSpaces/restoreSpaceObjects.feature | 47 ------------------- .../coreApiVersions/fileVersionAuthor.feature | 2 +- 5 files changed, 6 insertions(+), 53 deletions(-) diff --git a/.drone.env b/.drone.env index 4c55fa69330..02358a0d1e4 100644 --- a/.drone.env +++ b/.drone.env @@ -1,3 +1,3 @@ # The test runner source for UI tests -WEB_COMMITID=a3bb344aeab7fbb42c53815502abef7311e948fe +WEB_COMMITID=d0bf3b39d276f7fcb8cb6d17b5adfa6a2aa06d90 WEB_BRANCH=master diff --git a/tests/acceptance/features/apiContract/sharesReport.feature b/tests/acceptance/features/apiContract/sharesReport.feature index d1a82fd0c0c..dc9ff1af86f 100644 --- a/tests/acceptance/features/apiContract/sharesReport.feature +++ b/tests/acceptance/features/apiContract/sharesReport.feature @@ -25,7 +25,7 @@ Feature: REPORT request to Shares space | oc:shareroot | /folderMain | | oc:name | SubFolder1 | | d:getcontenttype | httpd/unix-directory | - | oc:permissions | SR | + | oc:permissions | S | Examples: | dav_version | | old | @@ -44,7 +44,7 @@ Feature: REPORT request to Shares space | oc:shareroot | /folderMain | | oc:name | frodo.txt | | d:getcontenttype | text/plain | - | oc:permissions | SR | + | oc:permissions | S | | d:getcontentlength | 34 | Examples: | dav_version | diff --git a/tests/acceptance/features/apiContract/spacesReport.feature b/tests/acceptance/features/apiContract/spacesReport.feature index a764e4f8f3e..b9c9aa12552 100644 --- a/tests/acceptance/features/apiContract/spacesReport.feature +++ b/tests/acceptance/features/apiContract/spacesReport.feature @@ -33,7 +33,7 @@ Feature: Report test | oc:shareroot | /folderMain | | oc:name | SubFolder1 | | d:getcontenttype | httpd/unix-directory | - | oc:permissions | SR | + | oc:permissions | S | | oc:size | 12 | @@ -52,5 +52,5 @@ Feature: Report test | oc:shareroot | /folderMain | | oc:name | insideTheFolder.txt | | d:getcontenttype | text/plain | - | oc:permissions | SRDNVW | + | oc:permissions | SD | | d:getcontentlength | 12 | diff --git a/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature b/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature index 8e3133f6fd8..356a689ea32 100644 --- a/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature +++ b/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature @@ -116,50 +116,3 @@ Feature: Restore files, folder } } """ - - - Scenario: The recipient can restore a file even if there is not enough owner's quota to do so - Given user "Admin" has changed the quota of the "Brian Murphy" space to "30" - And user "Brian" has uploaded file with content "file is less than 30 bytes" to "/file.txt" - And user "Brian" has uploaded file with content "reduceContent" to "/file.txt" - And user "Brian" has uploaded file with content "some content" to "newFile.txt" - And user "Brian" has shared file "file.txt" with user "Alice" - And user "Alice" has accepted share "/file.txt" offered by user "Brian" - And using new DAV path - When user "Alice" restores version index "1" of file "/Shares/file.txt" using the WebDAV API - Then the HTTP status code should be "204" - And the content of file "/Shares/file.txt" for user "Alice" should be "file is less than 30 bytes" - And for user "Brian" the JSON response should contain space called "Brian Murphy" and match - """ - { - "type": "object", - "required": [ - "quota" - ], - "properties": { - "quota": { - "type": "object", - "required": [ - "state", - "total", - "remaining", - "used" - ], - "properties": { - "state" : { - "type": "string", - "enum": ["exceeded"] - }, - "total" : { - "type": "number", - "enum": [30] - }, - "used": { - "type": "number", - "enum": [38] - } - } - } - } - } - """ diff --git a/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature b/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature index 89934e8cb09..0e013e40164 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersionAuthor.feature @@ -1,4 +1,4 @@ -@api @issue-2914 @skipOnOcis @toImplementOnOCIS +@api @issue-2914 Feature: file versions remember the author of each version Background: From 4685f427966c8fcbca88b64cf13e63cbf5a01b72 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 5 Apr 2023 15:01:35 +0200 Subject: [PATCH 07/11] change webBranch --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 02358a0d1e4..f4afb3a3e57 100644 --- a/.drone.env +++ b/.drone.env @@ -1,3 +1,3 @@ # The test runner source for UI tests -WEB_COMMITID=d0bf3b39d276f7fcb8cb6d17b5adfa6a2aa06d90 +WEB_COMMITID=5143e26feda3ffb8b56a73735cb16ad6ab039eb1 WEB_BRANCH=master From f82e93609528c279b3f96b1bca9c3ee945f09864 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 5 Apr 2023 15:09:29 +0200 Subject: [PATCH 08/11] change webBranch --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index f4afb3a3e57..54f65c0106f 100644 --- a/.drone.env +++ b/.drone.env @@ -1,3 +1,3 @@ # The test runner source for UI tests WEB_COMMITID=5143e26feda3ffb8b56a73735cb16ad6ab039eb1 -WEB_BRANCH=master +WEB_BRANCH=doNotShareVersionChangeE2eTest From 5b55f0f671b3f2df4dc07ccc8c071dfaab27cb23 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 5 Apr 2023 23:35:14 +0200 Subject: [PATCH 09/11] new web commit --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index cc8ac9a9678..40ef4a349f2 100644 --- a/.drone.env +++ b/.drone.env @@ -1,4 +1,4 @@ # The test runner source for UI tests -WEB_COMMITID=c7781078121ee07cc19b866713b0047a0e1c0eed +WEB_COMMITID=6a48269cdbce385a964434041dd207632b49fcc9 WEB_BRANCH=doNotShareVersionChangeE2eTest From f9904e1b2587f5352aa8607abe3b761f88d25c2b Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Thu, 6 Apr 2023 00:27:29 +0200 Subject: [PATCH 10/11] fix flaky draw.io file --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 40ef4a349f2..e08cd7ac4c8 100644 --- a/.drone.env +++ b/.drone.env @@ -1,4 +1,4 @@ # The test runner source for UI tests -WEB_COMMITID=6a48269cdbce385a964434041dd207632b49fcc9 +WEB_COMMITID=a36aec7f6af0a0e5d2319f5ab18429e53e9f702a WEB_BRANCH=doNotShareVersionChangeE2eTest From 05dc3394d52e5ed42d3e71a46a4dbb4ee5647994 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Thu, 6 Apr 2023 08:49:16 +0200 Subject: [PATCH 11/11] fix after review --- tests/acceptance/features/apiSpaces/download.feature | 1 + tests/acceptance/features/coreApiVersions/fileVersions.feature | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiSpaces/download.feature b/tests/acceptance/features/apiSpaces/download.feature index 1cbfc4f8480..05bc54d2d15 100644 --- a/tests/acceptance/features/apiSpaces/download.feature +++ b/tests/acceptance/features/apiSpaces/download.feature @@ -54,6 +54,7 @@ Feature: Download file in project space | Alice | | Brian | + Scenario: A user viewer cannot get the old version of the file in the project space Given user "Alice" has uploaded a file inside space "download file" with content "new content" to "file.txt" When user "Bob" tries to get version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API diff --git a/tests/acceptance/features/coreApiVersions/fileVersions.feature b/tests/acceptance/features/coreApiVersions/fileVersions.feature index 0a465e048d0..6cb5e8300b8 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersions.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersions.feature @@ -310,7 +310,7 @@ Feature: dav-versions And the content of file "/Shares/sharingfolder/sharefile.txt" for user "Brian" should be "First content" @files_sharing-app-required - Scenario: sharer can see a version of a file inside a shared folder when modified by sharee + Scenario: sharee cannot see a version of a file inside a shared folder when modified by sharee Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/sharingfolder" And user "Alice" has shared folder "/sharingfolder" with user "Brian" with permissions "all"