From eb086128c6402b52c1cc549f401ec2d33b04331e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Jul 2022 06:33:25 +0000 Subject: [PATCH 01/21] Bump eslint-plugin-n from 15.2.3 to 15.2.4 in /services/settings Bumps [eslint-plugin-n](https://github.com/weiran-zsd/eslint-plugin-node) from 15.2.3 to 15.2.4. - [Release notes](https://github.com/weiran-zsd/eslint-plugin-node/releases) - [Commits](https://github.com/weiran-zsd/eslint-plugin-node/compare/15.2.3...15.2.4) --- updated-dependencies: - dependency-name: eslint-plugin-n dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- services/settings/package.json | 2 +- services/settings/yarn.lock | 36 +++++++--------------------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/services/settings/package.json b/services/settings/package.json index 87f091b610c..36fa8a74dc5 100644 --- a/services/settings/package.json +++ b/services/settings/package.json @@ -64,7 +64,7 @@ "eslint": "^8.19.0", "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.2.3", + "eslint-plugin-n": "^15.2.4", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-unused-imports": "^2.0.0", diff --git a/services/settings/yarn.lock b/services/settings/yarn.lock index 54b8cca07ce..8035664e65c 100644 --- a/services/settings/yarn.lock +++ b/services/settings/yarn.lock @@ -3349,10 +3349,10 @@ eslint-plugin-import@^2.26.0: resolve "^1.22.0" tsconfig-paths "^3.14.1" -eslint-plugin-n@^15.2.3: - version "15.2.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz#b8850b90a8c27d3d880521ad90dbf537ac0a9830" - integrity sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw== +eslint-plugin-n@^15.2.4: + version "15.2.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz#d62021a0821ae650701ed459756aaf478a9b6056" + integrity sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w== dependencies: builtins "^5.0.1" eslint-plugin-es "^4.1.0" @@ -4513,21 +4513,7 @@ is-callable@^1.1.4, is-callable@^1.2.3, is-callable@^1.2.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== -is-core-module@^2.2.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19" - integrity sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ== - dependencies: - has "^1.0.3" - -is-core-module@^2.5.0: - version "2.8.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211" - integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== - dependencies: - has "^1.0.3" - -is-core-module@^2.8.1, is-core-module@^2.9.0: +is-core-module@^2.5.0, is-core-module@^2.8.1, is-core-module@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -6163,7 +6149,7 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6, path-parse@^1.0.7: +path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -6914,15 +6900,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.1, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0: - version "1.20.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== - dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" - -resolve@^1.22.0: +resolve@^1.10.1, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22.0: version "1.22.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== From 19e44f263b79be18c4405301752e655bcb35f90a Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Tue, 12 Jul 2022 16:07:57 +0545 Subject: [PATCH 02/21] Added scenarios for copy operations --- .../features/apiSpaces/copySpaces.feature | 299 ++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 tests/acceptance/features/apiSpaces/copySpaces.feature diff --git a/tests/acceptance/features/apiSpaces/copySpaces.feature b/tests/acceptance/features/apiSpaces/copySpaces.feature new file mode 100644 index 00000000000..b19c0f9525d --- /dev/null +++ b/tests/acceptance/features/apiSpaces/copySpaces.feature @@ -0,0 +1,299 @@ +@api @skipOnOcV10 +Feature: copy file + As a user + I want to be able to copy files + So that I can manage my files + + Background: + Given these users have been created with default attributes and without skeleton files: + | username | + | Alice | + | Brian | + + + Scenario Outline: Copying a file within a same space project with role manager and editor + Given the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "Project" with the default quota using the GraphApi + And user "Alice" has created a folder "newfolder" in space "Project" + And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt" + And user "Alice" has shared a space "Project" to user "Brian" with role "" + When user "Brian" copies file "insideSpace.txt" to "/newfolder/insideSpace.txt" in space "Project" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Brian" the space "Project" should contain these entries: + | newfolder/insideSpace.txt | + And for user "Alice" the content of the file "newfolder/insideSpace.txt" of the space "Project" should be "some content" + Examples: + | role | + | manager | + | editor | + + + Scenario: Copying a file within a same space project with role viewer + Given the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "Project" with the default quota using the GraphApi + And user "Alice" has created a folder "newfolder" in space "Project" + And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt" + And user "Alice" has shared a space "Project" to user "Brian" with role "viewer" + When user "Brian" copies file "insideSpace.txt" to "newfolder/insideSpace.txt" in space "Project" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Brian" the space "Project" should not contain these entries: + | newfolder/insideSpace.txt | + + + Scenario Outline: User copy a file from a space project with different role to a space project with manager role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project1" with the default quota using the GraphApi + And user "Brian" has created a space "Project2" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" + And user "Brian" has shared a space "Project2" to user "Alice" with role "manager" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" + When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project2" should contain these entries: + | project1.txt | + And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copy a file from a space project with different role to a space project with editor role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project1" with the default quota using the GraphApi + And user "Brian" has created a space "Project2" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" + And user "Brian" has shared a space "Project2" to user "Alice" with role "editor" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" + When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project2" should contain these entries: + | project1.txt | + And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copy a file from a space project with different role to a space project with viewer role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project1" with the default quota using the GraphApi + And user "Brian" has created a space "Project2" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" + And user "Brian" has shared a space "Project2" to user "Alice" with role "viewer" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" + When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Project2" should not contain these entries: + | project1.txt | + Examples: + | role | + | manager | + | editor | + + + Scenario Outline: User copy a file from space project with different role to space personal + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" + And user "Brian" has shared a space "Project" to user "Alice" with role "" + When user "Alice" copies file "project.txt" from space "Project" to "project.txt" inside space "Personal" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Personal" should contain these entries: + | project.txt | + And for user "Alice" the content of the file "project.txt" of the space "Personal" should be "Project content" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copy a file from space project with different role to space shares jail with editor role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "31" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "project.txt" from space "Project" to "/testshare/project.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Shares Jail" should contain these entries: + | /testshare/project.txt | + And for user "Alice" the content of the file "/testshare/project.txt" of the space "Shares Jail" should be "Project content" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copy a file from space project with different role to shares jail with viewer role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "17" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "project.txt" from space "Project" to "/testshare/project.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Shares Jail" should not contain these entries: + | /testshare/project.txt | + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copy a file from space personal to space project with different role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Alice" has uploaded file with content "personal space content" to "/personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "personal.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project" should contain these entries: + | personal.txt | + And for user "Alice" the content of the file "personal.txt" of the space "Project" should be "personal space content" + Examples: + | role | + | manager | + | editor | + + + Scenario: User copy a file from space personal to space project with role viewer + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "viewer" + And user "Alice" has uploaded file with content "personal space content" to "/personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "personal.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Project" should not contain these entries: + | personal.txt | + + + Scenario: User copy a file from space personal to space shares jail with role editor + Given user "Brian" has created folder "/testshare" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "31" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + And user "Alice" has uploaded file with content "personal content" to "personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "/testshare/personal.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Shares Jail" should contain these entries: + | /testshare/personal.txt | + And for user "Alice" the content of the file "/testshare/personal.txt" of the space "Shares Jail" should be "personal content" + + + Scenario: User copy a file from space personal to space shares jail with role viewer + Given user "Brian" has created folder "/testshare" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "17" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + And user "Alice" has uploaded file with content "personal content" to "personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "/testshare/personal.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Shares Jail" should not contain these entries: + | /testshare/personal.txt | + + + Scenario Outline: User copy a file from space shares jail with different role to space personal + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/testshare/testshare.txt" from space "Shares Jail" to "testshare.txt" inside space "Personal" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Personal" should contain these entries: + | /testshare.txt | + And for user "Alice" the content of the file "/testshare.txt" of the space "Personal" should be "testshare content" + Examples: + | permissions | + | 31 | + | 17 | + + + Scenario Outline: User copy a file from space shares jail with different role to space project with different role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/testshare/testshare.txt" from space "Shares Jail" to "testshare.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project" should contain these entries: + | /testshare.txt | + And for user "Alice" the content of the file "testshare.txt" of the space "Project" should be "testshare content" + Examples: + | role | permissions | + | manager | 31 | + | manager | 17 | + | editor | 31 | + | editor | 17 | + + + Scenario Outline: User copy a file from space shares jail with different role to space project with role viewer + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "viewer" + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/testshare/testshare.txt" from space "Shares Jail" to "testshare.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Project" should not contain these entries: + | /testshare.txt | + Examples: + | permissions | + | 31 | + | 17 | + + + Scenario Outline: User copy a file from space shares jail with different role to space shares jail with role editor + Given user "Brian" has created folder "/testshare1" + And user "Brian" has created folder "/testshare2" + And user "Brian" has uploaded file with content "testshare1 content" to "/testshare1/testshare1.txt" + And user "Brian" has shared folder "/testshare1" with user "Alice" with permissions "" + And user "Brian" has shared folder "/testshare2" with user "Alice" with permissions "31" + And user "Alice" has accepted share "/testshare1" offered by user "Brian" + And user "Alice" has accepted share "/testshare2" offered by user "Brian" + When user "Alice" copies file "/testshare1/testshare1.txt" from space "Shares Jail" to "/testshare2/testshare1.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Shares Jail" should contain these entries: + | /testshare2/testshare1.txt | + And for user "Brian" the space "Personal" should contain these entries: + | /testshare2/testshare1.txt | + And for user "Alice" the content of the file "/testshare2/testshare1.txt" of the space "Shares Jail" should be "testshare1 content" + And for user "Brian" the content of the file "/testshare1/testshare1.txt" of the space "Personal" should be "testshare1 content" + Examples: + | permissions | + | 31 | + | 17 | + + + Scenario Outline: User copy a file from space shares jail with different role to space shares jail with role editor + Given user "Brian" has created folder "/testshare1" + And user "Brian" has created folder "/testshare2" + And user "Brian" has uploaded file with content "testshare1 content" to "/testshare1/testshare1.txt" + And user "Brian" has shared folder "/testshare1" with user "Alice" with permissions "" + And user "Brian" has shared folder "/testshare2" with user "Alice" with permissions "17" + And user "Alice" has accepted share "/testshare1" offered by user "Brian" + And user "Alice" has accepted share "/testshare2" offered by user "Brian" + When user "Alice" copies file "/testshare1/testshare1.txt" from space "Shares Jail" to "/testshare2/testshare1.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Shares Jail" should not contain these entries: + | /testshare2/testshare1.txt | + And for user "Brian" the space "Personal" should not contain these entries: + | /testshare2/testshare1.txt | + Examples: + | permissions | + | 31 | + | 17 | From db471818a2404c6eb978f676944d97f842c381fa Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Tue, 12 Jul 2022 16:08:20 +0545 Subject: [PATCH 03/21] Added implementation for copy operations --- .../features/apiSpaces/copySpaces.feature | 38 ++++++------------- .../features/bootstrap/SpacesContext.php | 3 +- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/copySpaces.feature b/tests/acceptance/features/apiSpaces/copySpaces.feature index b19c0f9525d..1f07308835d 100644 --- a/tests/acceptance/features/apiSpaces/copySpaces.feature +++ b/tests/acceptance/features/apiSpaces/copySpaces.feature @@ -17,7 +17,7 @@ Feature: copy file And user "Alice" has created a folder "newfolder" in space "Project" And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt" And user "Alice" has shared a space "Project" to user "Brian" with role "" - When user "Brian" copies file "insideSpace.txt" to "/newfolder/insideSpace.txt" in space "Project" using the WebDAV API + When user "Brian" copies file "insideSpace.txt" to "/newfolder/insideSpace.txt" inside space "Project" using the WebDAV API Then the HTTP status code should be "201" And for user "Brian" the space "Project" should contain these entries: | newfolder/insideSpace.txt | @@ -34,7 +34,7 @@ Feature: copy file And user "Alice" has created a folder "newfolder" in space "Project" And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt" And user "Alice" has shared a space "Project" to user "Brian" with role "viewer" - When user "Brian" copies file "insideSpace.txt" to "newfolder/insideSpace.txt" in space "Project" using the WebDAV API + When user "Brian" copies file "insideSpace.txt" to "newfolder/insideSpace.txt" inside space "Project" using the WebDAV API Then the HTTP status code should be "403" And for user "Brian" the space "Project" should not contain these entries: | newfolder/insideSpace.txt | @@ -45,37 +45,21 @@ Feature: copy file And user "Brian" has created a space "Project1" with the default quota using the GraphApi And user "Brian" has created a space "Project2" with the default quota using the GraphApi And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" - And user "Brian" has shared a space "Project2" to user "Alice" with role "manager" - And user "Brian" has shared a space "Project1" to user "Alice" with role "" + And user "Brian" has shared a space "Project2" to user "Alice" with role "" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API Then the HTTP status code should be "201" And for user "Alice" the space "Project2" should contain these entries: | project1.txt | And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content" Examples: - | role | - | manager | - | editor | - | viewer | - - - Scenario Outline: User copy a file from a space project with different role to a space project with editor role - Given the administrator has given "Brian" the role "Space Admin" using the settings api - And user "Brian" has created a space "Project1" with the default quota using the GraphApi - And user "Brian" has created a space "Project2" with the default quota using the GraphApi - And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" - And user "Brian" has shared a space "Project2" to user "Alice" with role "editor" - And user "Brian" has shared a space "Project1" to user "Alice" with role "" - When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API - Then the HTTP status code should be "201" - And for user "Alice" the space "Project2" should contain these entries: - | project1.txt | - And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content" - Examples: - | role | - | manager | - | editor | - | viewer | + | from_role | to_role | + | manager | manager | + | manager | editor | + | manager | viewer | + | editor | manager | + | editor | editor | + | editor | viewer | Scenario Outline: User copy a file from a space project with different role to a space project with viewer role diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index de2cb86074f..31eaa26d8b5 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -781,13 +781,14 @@ class SpacesContext implements Context { Assert::assertIsArray($space); Assert::assertNotEmpty($spaceId = $space["id"]); Assert::assertNotEmpty($spaceWebDavUrl = $space["root"]["webDavUrl"]); + $headers['Depth'] = 'infinity'; $this->featureContext->setResponse( $this->sendPropfindRequestToUrl( $spaceWebDavUrl . '/' . $foldersPath, $user, $this->featureContext->getPasswordForUser($user), "", - [], + $headers, ) ); $this->setResponseSpaceId($spaceId); From f29b7c1744007ae10c4496711ea75bc6551807b6 Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Mon, 18 Jul 2022 12:54:39 +0545 Subject: [PATCH 04/21] Update expected to failure due to Shares Jail --- ...ected-failures-localAPI-on-OCIS-storage.md | 8 +++++ .../features/apiSpaces/copySpaces.feature | 34 +++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 585034e0048..f1c77d3cdb7 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -25,3 +25,11 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [Space Admin still has access to the project despite being removed from it](https://github.com/owncloud/ocis/issues/4127) - [apiSpaces/shareSpaces.feature:77](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L77) - [apiSpaces/shareSpaces.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L78) + +### [Depth infinity not supported for space Shares Jail](https://github.com/owncloud/ocis/issues/4188) +- [apiSpaces/copySpaces.feature:112](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L112) +- [apiSpaces/copySpaces.feature:113](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L113) +- [apiSpaces/copySpaces.feature:114](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L114) +- [apiSpaces/copySpaces.feature:163](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L163) +- [apiSpaces/copySpaces.feature:260](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L260) +- [apiSpaces/copySpaces.feature:261](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L261) diff --git a/tests/acceptance/features/apiSpaces/copySpaces.feature b/tests/acceptance/features/apiSpaces/copySpaces.feature index 1f07308835d..03711d0f0a2 100644 --- a/tests/acceptance/features/apiSpaces/copySpaces.feature +++ b/tests/acceptance/features/apiSpaces/copySpaces.feature @@ -40,13 +40,13 @@ Feature: copy file | newfolder/insideSpace.txt | - Scenario Outline: User copy a file from a space project with different role to a space project with manager role + Scenario Outline: User copies a file from a space project with a different role to a space project with the manager role Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project1" with the default quota using the GraphApi And user "Brian" has created a space "Project2" with the default quota using the GraphApi And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" - And user "Brian" has shared a space "Project2" to user "Alice" with role "" - And user "Brian" has shared a space "Project1" to user "Alice" with role "" + And user "Brian" has shared a space "Project2" to user "Alice" with role "" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API Then the HTTP status code should be "201" And for user "Alice" the space "Project2" should contain these entries: @@ -56,13 +56,11 @@ Feature: copy file | from_role | to_role | | manager | manager | | manager | editor | - | manager | viewer | | editor | manager | | editor | editor | - | editor | viewer | - Scenario Outline: User copy a file from a space project with different role to a space project with viewer role + Scenario Outline: User copies a file from a space project with a different role to a space project with a viewer role Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project1" with the default quota using the GraphApi And user "Brian" has created a space "Project2" with the default quota using the GraphApi @@ -79,7 +77,7 @@ Feature: copy file | editor | - Scenario Outline: User copy a file from space project with different role to space personal + Scenario Outline: User copies a file from space project with different role to space personal Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" @@ -96,7 +94,7 @@ Feature: copy file | viewer | - Scenario Outline: User copy a file from space project with different role to space shares jail with editor role + Scenario Outline: User copies a file from space project with different role to space shares jail with editor role Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has created folder "/testshare" @@ -116,7 +114,7 @@ Feature: copy file | viewer | - Scenario Outline: User copy a file from space project with different role to shares jail with viewer role + Scenario Outline: User copies a file from space project with different role to shares jail with viewer role Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has created folder "/testshare" @@ -135,7 +133,7 @@ Feature: copy file | viewer | - Scenario Outline: User copy a file from space personal to space project with different role + Scenario Outline: User copies a file from space personal to space project with different role Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has shared a space "Project" to user "Alice" with role "" @@ -151,7 +149,7 @@ Feature: copy file | editor | - Scenario: User copy a file from space personal to space project with role viewer + Scenario: User copies a file from space personal to space project with role viewer Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has shared a space "Project" to user "Alice" with role "viewer" @@ -162,7 +160,7 @@ Feature: copy file | personal.txt | - Scenario: User copy a file from space personal to space shares jail with role editor + Scenario: User copies a file from space personal to space shares jail with role editor Given user "Brian" has created folder "/testshare" And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "31" And user "Alice" has accepted share "/testshare" offered by user "Brian" @@ -174,7 +172,7 @@ Feature: copy file And for user "Alice" the content of the file "/testshare/personal.txt" of the space "Shares Jail" should be "personal content" - Scenario: User copy a file from space personal to space shares jail with role viewer + Scenario: User copies a file from space personal to space shares jail with role viewer Given user "Brian" has created folder "/testshare" And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "17" And user "Alice" has accepted share "/testshare" offered by user "Brian" @@ -185,7 +183,7 @@ Feature: copy file | /testshare/personal.txt | - Scenario Outline: User copy a file from space shares jail with different role to space personal + Scenario Outline: User copies a file from space shares jail with different role to space personal Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created folder "/testshare" And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" @@ -202,7 +200,7 @@ Feature: copy file | 17 | - Scenario Outline: User copy a file from space shares jail with different role to space project with different role + Scenario Outline: User copies a file from space shares jail with different role to space project with different role Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has shared a space "Project" to user "Alice" with role "" @@ -223,7 +221,7 @@ Feature: copy file | editor | 17 | - Scenario Outline: User copy a file from space shares jail with different role to space project with role viewer + Scenario Outline: User copies a file from space shares jail with different role to space project with role viewer Given the administrator has given "Brian" the role "Space Admin" using the settings api And user "Brian" has created a space "Project" with the default quota using the GraphApi And user "Brian" has shared a space "Project" to user "Alice" with role "viewer" @@ -241,7 +239,7 @@ Feature: copy file | 17 | - Scenario Outline: User copy a file from space shares jail with different role to space shares jail with role editor + Scenario Outline: User copies a file from space shares jail with different role to space shares jail with role editor Given user "Brian" has created folder "/testshare1" And user "Brian" has created folder "/testshare2" And user "Brian" has uploaded file with content "testshare1 content" to "/testshare1/testshare1.txt" @@ -263,7 +261,7 @@ Feature: copy file | 17 | - Scenario Outline: User copy a file from space shares jail with different role to space shares jail with role editor + Scenario Outline: User copies a file from space shares jail with different role to space shares jail with role editor Given user "Brian" has created folder "/testshare1" And user "Brian" has created folder "/testshare2" And user "Brian" has uploaded file with content "testshare1 content" to "/testshare1/testshare1.txt" From 6dc8047f3219ce7b4921effdca05426791ec90c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Jul 2022 09:13:54 +0000 Subject: [PATCH 05/21] Bump terser from 5.7.2 to 5.14.2 in /services/settings Bumps [terser](https://github.com/terser/terser) from 5.7.2 to 5.14.2. - [Release notes](https://github.com/terser/terser/releases) - [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md) - [Commits](https://github.com/terser/terser/commits) --- updated-dependencies: - dependency-name: terser dependency-type: indirect ... Signed-off-by: dependabot[bot] --- services/settings/yarn.lock | 46 +++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/services/settings/yarn.lock b/services/settings/yarn.lock index 54b8cca07ce..b0450bf486e 100644 --- a/services/settings/yarn.lock +++ b/services/settings/yarn.lock @@ -1139,7 +1139,7 @@ "@jridgewell/set-array" "^1.0.0" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/gen-mapping@^0.3.2": +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== @@ -1149,15 +1149,23 @@ "@jridgewell/trace-mapping" "^0.3.9" "@jridgewell/resolve-uri@^3.0.3": - version "3.0.8" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.8.tgz#687cc2bbf243f4e9a868ecf2262318e2658873a1" - integrity sha512-YK5G9LaddzGbcucK4c8h5tWFmMPBvRZ/uyWmN1/SbBdIvqGUdWGkJ5BAaccgs6XbzVLsqbPJrBSFwKv3kT9i7w== + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== "@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== +"@jridgewell/source-map@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" + integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + "@jridgewell/sourcemap-codec@^1.4.10": version "1.4.14" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" @@ -1538,12 +1546,7 @@ acorn@^7.1.1, acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.7.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" - integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== - -acorn@^8.7.1: +acorn@^8.5.0, acorn@^8.7.0, acorn@^8.7.1: version "8.7.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== @@ -7277,7 +7280,7 @@ source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@0.5.19, source-map-support@^0.5.16, source-map-support@~0.5.19: +source-map-support@0.5.19: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== @@ -7285,6 +7288,14 @@ source-map-support@0.5.19, source-map-support@^0.5.16, source-map-support@~0.5.1 buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@^0.5.16, source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" @@ -7300,7 +7311,7 @@ source-map@0.6.*, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, sourc resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@0.7.3, source-map@^0.7.3, source-map@~0.7.2: +source-map@0.7.3, source-map@^0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== @@ -7705,13 +7716,14 @@ tcp-port-used@^1.0.1: is2 "^2.0.6" terser@^5.0.0, terser@^5.6.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.2.tgz#d4d95ed4f8bf735cb933e802f2a1829abf545e3f" - integrity sha512-0Omye+RD4X7X69O0eql3lC4Heh/5iLj3ggxR/B5ketZLOtLiOqukUgjw3q4PDnNQbsrkKr3UMypqStQG3XKRvw== + version "5.14.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.14.2.tgz#9ac9f22b06994d736174f4091aa368db896f1c10" + integrity sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA== dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" commander "^2.20.0" - source-map "~0.7.2" - source-map-support "~0.5.19" + source-map-support "~0.5.20" text-table@^0.2.0: version "0.2.0" From 41cfd6cb2364552a42e5f0f25e3d9e438e320f48 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 13:03:18 +0200 Subject: [PATCH 06/21] Bump libregraph/idm to latest master This includes a fix for case-insensitive substring filtering Partial-Fix: #547 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0af7730c4e9..0734203b513 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 github.com/justinas/alice v1.2.0 - github.com/libregraph/idm v0.3.1-0.20220714094919-c0f30ff05beb + github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63 github.com/mitchellh/mapstructure v1.5.0 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 diff --git a/go.sum b/go.sum index 2ff5a357551..1a3c08bc49d 100644 --- a/go.sum +++ b/go.sum @@ -831,8 +831,8 @@ github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/libregraph/idm v0.3.1-0.20220714094919-c0f30ff05beb h1:kY+TjOyeXQ5kTzp66+c5C0sf5o9eLkYbxBPbB3iRQVk= -github.com/libregraph/idm v0.3.1-0.20220714094919-c0f30ff05beb/go.mod h1:ggVmYkaK5fu680QOnxkuyCRW5Wl5qzaYXgIiieNBOJE= +github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b h1:/BNTnfP6lqixKUP2kP9gKWiPRaBWvE5BJcFcIVd2Ekg= +github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b/go.mod h1:ggVmYkaK5fu680QOnxkuyCRW5Wl5qzaYXgIiieNBOJE= github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63 h1:oPqyRePmq+59YF1tAur7WXuM/z/epRd+HGGyPPx2Vv8= github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63/go.mod h1:KZ4X+bEbOQMSV6iPysZEqVO/Pa5Mvo7xhhcLwUNPjmw= github.com/linode/linodego v0.25.3/go.mod h1:GSBKPpjoQfxEfryoCRcgkuUOCuVtGHWhzI8OMdycNTE= From 6d47ee16c9483131246b4b396fa50711275de5bc Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 13:07:10 +0200 Subject: [PATCH 07/21] Allow configuration of substring search for searching sharees This introduces new settings for the users and groups services. "group_substring_filter_type" for the group services and "user_substring_filter_type" for the users service. They allow to set the type of LDAP filter that is used for substring user searches. Possible values are: "initial", "final" and "any" to do either prefix, suffix or full substring searches. Fixes #547 --- services/groups/pkg/config/config.go | 33 ++++++++++--------- .../pkg/config/defaults/defaultconfig.go | 27 +++++++-------- services/groups/pkg/revaconfig/config.go | 29 ++++++++-------- services/users/pkg/config/config.go | 33 ++++++++++--------- .../pkg/config/defaults/defaultconfig.go | 27 +++++++-------- services/users/pkg/revaconfig/config.go | 29 ++++++++-------- 6 files changed, 92 insertions(+), 86 deletions(-) diff --git a/services/groups/pkg/config/config.go b/services/groups/pkg/config/config.go index e792a17f2b8..fb8e9ed13bc 100644 --- a/services/groups/pkg/config/config.go +++ b/services/groups/pkg/config/config.go @@ -66,22 +66,23 @@ type Drivers struct { } type LDAPDriver struct { - URI string `yaml:"uri" env:"LDAP_URI;GROUPS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` - CACert string `yaml:"ca_cert" env:"LDAP_CACERT;GROUPS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty the system default CA bundle will be used."` - Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;GROUPS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` - BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;GROUPS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` - BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;GROUPS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` - UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;GROUPS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` - GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;GROUPS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` - UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;GROUPS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported scopes are 'base', 'one' and 'sub'."` - GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;GROUPS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported scopes are 'base', 'one' and 'sub'."` - UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;GROUPS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` - GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;GROUPS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` - UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;GROUPS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter ('inetOrgPerson')."` - GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;GROUPS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter ('groupOfNames')."` - IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;GROUPS_IDP_URL" desc:"The identity provider value to set in the group IDs of the CS3 group objects for groups returned by this group provider."` - UserSchema LDAPUserSchema `yaml:"user_schema"` - GroupSchema LDAPGroupSchema `yaml:"group_schema"` + URI string `yaml:"uri" env:"LDAP_URI;GROUPS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` + CACert string `yaml:"ca_cert" env:"LDAP_CACERT;GROUPS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty, the system default CA bundle will be used."` + Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;GROUPS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` + BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;GROUPS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` + BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;GROUPS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` + UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;GROUPS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` + GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;GROUPS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` + UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;GROUPS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported scopes are 'base', 'one' and 'sub'."` + GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;GROUPS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported scopes are 'base', 'one' and 'sub'."` + GroupSubstringFilterType string `yaml:"group_substring_filter_type" env:"LDAP_GROUP_SUBSTRING_FILTER_TYPE;GROUP_LDAP_GROUP_SUBSTRING_FILTER_TYPE" desc:"Type of substring search filter to use for substring searches for groups. Possible values: 'initial' for doing prefix only searches, 'final' for doing suffix only searches or 'any' for doing full substring searches"` + UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;GROUPS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` + GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;GROUPS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` + UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;GROUPS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter ('inetOrgPerson')."` + GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;GROUPS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter ('groupOfNames')."` + IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;GROUPS_IDP_URL" desc:"The identity provider value to set in the group IDs of the CS3 group objects for groups returned by this group provider."` + UserSchema LDAPUserSchema `yaml:"user_schema"` + GroupSchema LDAPGroupSchema `yaml:"group_schema"` } type LDAPUserSchema struct { diff --git a/services/groups/pkg/config/defaults/defaultconfig.go b/services/groups/pkg/config/defaults/defaultconfig.go index 4f65742b895..ec5cedf544e 100644 --- a/services/groups/pkg/config/defaults/defaultconfig.go +++ b/services/groups/pkg/config/defaults/defaultconfig.go @@ -36,19 +36,20 @@ func DefaultConfig() *config.Config { Driver: "ldap", Drivers: config.Drivers{ LDAP: config.LDAPDriver{ - URI: "ldaps://localhost:9235", - CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), - Insecure: false, - UserBaseDN: "ou=users,o=libregraph-idm", - GroupBaseDN: "ou=groups,o=libregraph-idm", - UserScope: "sub", - GroupScope: "sub", - UserFilter: "", - GroupFilter: "", - UserObjectClass: "inetOrgPerson", - GroupObjectClass: "groupOfNames", - BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", - IDP: "https://localhost:9200", + URI: "ldaps://localhost:9235", + CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), + Insecure: false, + UserBaseDN: "ou=users,o=libregraph-idm", + GroupBaseDN: "ou=groups,o=libregraph-idm", + UserScope: "sub", + GroupScope: "sub", + GroupSubstringFilterType: "initial", + UserFilter: "", + GroupFilter: "", + UserObjectClass: "inetOrgPerson", + GroupObjectClass: "groupOfNames", + BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", + IDP: "https://localhost:9200", UserSchema: config.LDAPUserSchema{ ID: "ownclouduuid", Mail: "mail", diff --git a/services/groups/pkg/revaconfig/config.go b/services/groups/pkg/revaconfig/config.go index 7e6d7fc4306..e5d048abf22 100644 --- a/services/groups/pkg/revaconfig/config.go +++ b/services/groups/pkg/revaconfig/config.go @@ -50,20 +50,21 @@ func GroupsConfigFromStruct(cfg *config.Config) map[string]interface{} { func ldapConfigFromString(cfg config.LDAPDriver) map[string]interface{} { return map[string]interface{}{ - "uri": cfg.URI, - "cacert": cfg.CACert, - "insecure": cfg.Insecure, - "bind_username": cfg.BindDN, - "bind_password": cfg.BindPassword, - "user_base_dn": cfg.UserBaseDN, - "group_base_dn": cfg.GroupBaseDN, - "user_scope": cfg.UserScope, - "group_scope": cfg.GroupScope, - "user_filter": cfg.UserFilter, - "group_filter": cfg.GroupFilter, - "user_objectclass": cfg.UserObjectClass, - "group_objectclass": cfg.GroupObjectClass, - "idp": cfg.IDP, + "uri": cfg.URI, + "cacert": cfg.CACert, + "insecure": cfg.Insecure, + "bind_username": cfg.BindDN, + "bind_password": cfg.BindPassword, + "user_base_dn": cfg.UserBaseDN, + "group_base_dn": cfg.GroupBaseDN, + "user_scope": cfg.UserScope, + "group_scope": cfg.GroupScope, + "group_substring_filter_type": cfg.GroupSubstringFilterType, + "user_filter": cfg.UserFilter, + "group_filter": cfg.GroupFilter, + "user_objectclass": cfg.UserObjectClass, + "group_objectclass": cfg.GroupObjectClass, + "idp": cfg.IDP, "user_schema": map[string]interface{}{ "id": cfg.UserSchema.ID, "idIsOctetString": cfg.UserSchema.IDIsOctetString, diff --git a/services/users/pkg/config/config.go b/services/users/pkg/config/config.go index 38da71eccd3..269151597ba 100644 --- a/services/users/pkg/config/config.go +++ b/services/users/pkg/config/config.go @@ -69,22 +69,23 @@ type JSONDriver struct { File string `yaml:"file"` } type LDAPDriver struct { - URI string `yaml:"uri" env:"LDAP_URI;USERS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` - CACert string `yaml:"ca_cert" env:"LDAP_CACERT;USERS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty the system default CA bundle will be used."` - Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;USERS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` - BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;USERS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` - BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;USERS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` - UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;USERS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` - GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;USERS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` - UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;USERS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported values are 'base', 'one' and 'sub'."` - GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;USERS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported values are 'base', 'one' and 'sub'."` - UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;USERS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` - GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;USERS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` - UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;USERS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter like 'inetOrgPerson'."` - GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;USERS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter like 'groupOfNames'. "` - IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;USERS_IDP_URL" desc:"The identity provider value to set in the userids of the CS3 user objects for users returned by this user provider."` - UserSchema LDAPUserSchema `yaml:"user_schema"` - GroupSchema LDAPGroupSchema `yaml:"group_schema"` + URI string `yaml:"uri" env:"LDAP_URI;USERS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` + CACert string `yaml:"ca_cert" env:"LDAP_CACERT;USERS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty, the system default CA bundle will be used."` + Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;USERS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` + BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;USERS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` + BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;USERS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` + UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;USERS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` + GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;USERS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` + UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;USERS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported values are 'base', 'one' and 'sub'."` + GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;USERS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported values are 'base', 'one' and 'sub'."` + UserSubstringFilterType string `yaml:"user_substring_filter_type" env:"LDAP_USER_SUBSTRING_FILTER_TYPE;USERS_LDAP_USER_SUBSTRING_FILTER_TYPE" desc:"Type of substring search filter to use for substring searches for users. Possible values: 'initial' for doing prefix only searches, 'final' for doing suffix only searches or 'any' for doing full substring searches"` + UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;USERS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` + GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;USERS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` + UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;USERS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter like 'inetOrgPerson'."` + GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;USERS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter like 'groupOfNames'. "` + IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;USERS_IDP_URL" desc:"The identity provider value to set in the userids of the CS3 user objects for users returned by this user provider."` + UserSchema LDAPUserSchema `yaml:"user_schema"` + GroupSchema LDAPGroupSchema `yaml:"group_schema"` } type LDAPUserSchema struct { diff --git a/services/users/pkg/config/defaults/defaultconfig.go b/services/users/pkg/config/defaults/defaultconfig.go index 9353387d166..b6f43113d56 100644 --- a/services/users/pkg/config/defaults/defaultconfig.go +++ b/services/users/pkg/config/defaults/defaultconfig.go @@ -36,19 +36,20 @@ func DefaultConfig() *config.Config { Driver: "ldap", Drivers: config.Drivers{ LDAP: config.LDAPDriver{ - URI: "ldaps://localhost:9235", - CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), - Insecure: false, - UserBaseDN: "ou=users,o=libregraph-idm", - GroupBaseDN: "ou=groups,o=libregraph-idm", - UserScope: "sub", - GroupScope: "sub", - UserFilter: "", - GroupFilter: "", - UserObjectClass: "inetOrgPerson", - GroupObjectClass: "groupOfNames", - BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", - IDP: "https://localhost:9200", + URI: "ldaps://localhost:9235", + CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), + Insecure: false, + UserBaseDN: "ou=users,o=libregraph-idm", + GroupBaseDN: "ou=groups,o=libregraph-idm", + UserScope: "sub", + GroupScope: "sub", + UserSubstringFilterType: "initial", + UserFilter: "", + GroupFilter: "", + UserObjectClass: "inetOrgPerson", + GroupObjectClass: "groupOfNames", + BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", + IDP: "https://localhost:9200", UserSchema: config.LDAPUserSchema{ ID: "ownclouduuid", Mail: "mail", diff --git a/services/users/pkg/revaconfig/config.go b/services/users/pkg/revaconfig/config.go index 434daf23d37..187381c020f 100644 --- a/services/users/pkg/revaconfig/config.go +++ b/services/users/pkg/revaconfig/config.go @@ -52,20 +52,21 @@ func UsersConfigFromStruct(cfg *config.Config) map[string]interface{} { func ldapConfigFromString(cfg config.LDAPDriver) map[string]interface{} { return map[string]interface{}{ - "uri": cfg.URI, - "cacert": cfg.CACert, - "insecure": cfg.Insecure, - "bind_username": cfg.BindDN, - "bind_password": cfg.BindPassword, - "user_base_dn": cfg.UserBaseDN, - "group_base_dn": cfg.GroupBaseDN, - "user_scope": cfg.UserScope, - "group_scope": cfg.GroupScope, - "user_filter": cfg.UserFilter, - "group_filter": cfg.GroupFilter, - "user_objectclass": cfg.UserObjectClass, - "group_objectclass": cfg.GroupObjectClass, - "idp": cfg.IDP, + "uri": cfg.URI, + "cacert": cfg.CACert, + "insecure": cfg.Insecure, + "bind_username": cfg.BindDN, + "bind_password": cfg.BindPassword, + "user_base_dn": cfg.UserBaseDN, + "group_base_dn": cfg.GroupBaseDN, + "user_scope": cfg.UserScope, + "group_scope": cfg.GroupScope, + "user_substring_filter_type": cfg.UserSubstringFilterType, + "user_filter": cfg.UserFilter, + "group_filter": cfg.GroupFilter, + "user_objectclass": cfg.UserObjectClass, + "group_objectclass": cfg.GroupObjectClass, + "idp": cfg.IDP, "user_schema": map[string]interface{}{ "id": cfg.UserSchema.ID, "idIsOctetString": cfg.UserSchema.IDIsOctetString, From 8d454cfd3dbf6714bbf9635c37517091439cb2da Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 15:52:57 +0200 Subject: [PATCH 08/21] Bump reva To get https://github.com/cs3org/reva/pull/3087 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0734203b513..79c32c5cba9 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/blevesearch/bleve_index_api v1.0.2 github.com/coreos/go-oidc/v3 v3.2.0 github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3 - github.com/cs3org/reva/v2 v2.7.2 + github.com/cs3org/reva/v2 v2.7.3-0.20220719130634-b3d353ec9594 github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index 1a3c08bc49d..c975b8235f9 100644 --- a/go.sum +++ b/go.sum @@ -300,8 +300,8 @@ github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD9 github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4= github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3 h1:QSQ2DGKPMChB4vHSs1Os9TnOJl21BrzKX9D5EtQfDog= github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.7.2 h1:R6+tlAYDZz2ylUvq3KWBDMmsyLOD7yJpe51GzIZpWr0= -github.com/cs3org/reva/v2 v2.7.2/go.mod h1:gbbAUK+8gmyTJ8J+JWwbKbKRlpNRcoMuAXNFN0HbfIE= +github.com/cs3org/reva/v2 v2.7.3-0.20220719130634-b3d353ec9594 h1:ulamcgEI9QTJHlJHDT71Bn4281OgPf0AvKXYAUJtFtM= +github.com/cs3org/reva/v2 v2.7.3-0.20220719130634-b3d353ec9594/go.mod h1:gbbAUK+8gmyTJ8J+JWwbKbKRlpNRcoMuAXNFN0HbfIE= 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 288b76d955a506e14b201c6ee3d856b4b98f3868 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 16:15:24 +0200 Subject: [PATCH 09/21] Add config for setting search_min_length capability This adds the "search_min_length" setting to the frontend service which allows to set the search_min_length capabilty which is e.g. used by web. Partial: #547 --- services/frontend/pkg/config/config.go | 1 + services/frontend/pkg/config/defaults/defaultconfig.go | 1 + services/frontend/pkg/revaconfig/config.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 3d8cef6b100..136d11d0945 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -32,6 +32,7 @@ type Config struct { UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests."` DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in the frontend (e.g. tus)."` EnableResharing bool `yaml:"enable_resharing" env:"FRONTEND_ENABLE_RESHARING" desc:"Enables the support for resharing in the frontend."` + SearchMinLength int `yaml:"search_min_length" env:"FRONTEND_SEARCH_MIN_LENGTH" desc:"Minimum number of characters to enter before starting a search for Sharees."` PublicURL string `yaml:"public_url" env:"OCIS_URL;FRONTEND_PUBLIC_URL" desc:"The public facing URL of the oCIS frontend."` diff --git a/services/frontend/pkg/config/defaults/defaultconfig.go b/services/frontend/pkg/config/defaults/defaultconfig.go index f23891d14d3..4cd1ea94dea 100644 --- a/services/frontend/pkg/config/defaults/defaultconfig.go +++ b/services/frontend/pkg/config/defaults/defaultconfig.go @@ -39,6 +39,7 @@ func DefaultConfig() *config.Config { UploadHTTPMethodOverride: "", DefaultUploadProtocol: "tus", EnableResharing: true, + SearchMinLength: 3, Checksums: config.Checksums{ SupportedTypes: []string{"sha1", "md5", "adler32"}, PreferredUploadType: "", diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 7b13c3bfb32..16a94e06f91 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -165,7 +165,7 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} { "share_with_group_members_only": true, "share_with_membership_groups_only": true, "default_permissions": 22, - "search_min_length": 3, + "search_min_length": cfg.SearchMinLength, "public": map[string]interface{}{ "alias": true, "enabled": true, From 71a4cd91f6896741e7a61f93888a982b1b9c35f5 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 16:03:27 +0200 Subject: [PATCH 10/21] Add changelog entry --- .../unreleased/fix-sharee-substring-search.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 changelog/unreleased/fix-sharee-substring-search.md diff --git a/changelog/unreleased/fix-sharee-substring-search.md b/changelog/unreleased/fix-sharee-substring-search.md new file mode 100644 index 00000000000..40f492c76b4 --- /dev/null +++ b/changelog/unreleased/fix-sharee-substring-search.md @@ -0,0 +1,16 @@ +Bugfix: Substring search for sharees + +We fixed searching for sharees to be no longer case-sensitive. +With this we introduced two new settings for the users and groups services: +"group_substring_filter_type" for the group services and +"user_substring_filter_type" for the users service. +They allow to set the type of LDAP filter that is used for substring user +searches. Possible values are: "initial", "final" and "any" to do either +prefix, suffix or full substring searches. Both settings default to "initial". + +Also a new option "search_min_length" was added for the "frontend" service. It +allows to configure the minimum number of characters to enter before a search +for Sharees is started. This setting is e.g. evaluated by the web ui via the +capabilities endpoint. + +https://github.com/owncloud/ocis/issues/547 From bf19bf89e35891535a5c86c1b1e67b47e0d21913 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 16:30:18 +0200 Subject: [PATCH 11/21] Adjust sharee search setting for compatibility with oc10 --- .drone.star | 6 ++++++ .../expected-failures-API-on-OCIS-storage.md | 12 ------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.drone.star b/.drone.star index 9aa37640155..2d0e90b6302 100644 --- a/.drone.star +++ b/.drone.star @@ -1643,6 +1643,8 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = environment = { "OCIS_URL": OCIS_URL, "OCIS_CONFIG_DIR": "/root/.ocis/config", + "LDAP_GROUP_SUBSTRING_FILTER_TYPE": "any", + "LDAP_USER_SUBSTRING_FILTER_TYPE": "any", "GATEWAY_GRPC_ADDR": "0.0.0.0:9142", # cs3api-validator needs the cs3api gatway exposed "STORAGE_USERS_DRIVER": "%s" % (storage), "STORAGE_USERS_DRIVER_LOCAL_ROOT": "/srv/app/tmp/ocis/local/root", @@ -1655,6 +1657,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "SETTINGS_DATA_PATH": "/srv/app/tmp/ocis/settings", "IDM_CREATE_DEMO_USERS": True, "IDM_ADMIN_PASSWORD": "admin", # override the random admin password from `ocis init` + "FRONTEND_SEARCH_MIN_LENGTH": "2", } wait_for_ocis = { "name": "wait-for-ocis-server", @@ -1688,6 +1691,8 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "LDAP_USER_BASE_DN": "ou=TestUsers,dc=owncloud,dc=com", "LDAP_USER_SCHEMA_ID": "ownclouduuid", "LDAP_USER_FILTER": "(objectclass=owncloud)", + "LDAP_GROUP_SUBSTRING_FILTER_TYPE": "any", + "LDAP_USER_SUBSTRING_FILTER_TYPE": "any", # ownCloudSQL storage driver "STORAGE_USERS_DRIVER": "owncloudsql", "STORAGE_USERS_OWNCLOUDSQL_DATADIR": "/mnt/data/files", @@ -1713,6 +1718,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "OCIS_BASE_DATA_PATH": "/mnt/data/ocis", "OCIS_CONFIG_DIR": "/etc/ocis", "PROXY_ENABLE_BASIC_AUTH": "true", + "FRONTEND_SEARCH_MIN_LENGTH": "2", } wait_for_ocis = { "name": "wait-for-ocis-server", diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index aa076ab4363..bec2ae20419 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -408,12 +408,6 @@ File and sync features in a shared scenario #### [Searching sharee with displayname](https://github.com/owncloud/ocis/issues/547) -- [apiSharees/sharees.feature:32](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L32) -- [apiSharees/sharees.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L33) -- [apiSharees/sharees.feature:54](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L54) -- [apiSharees/sharees.feature:55](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L55) -- [apiSharees/sharees.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L100) -- [apiSharees/sharees.feature:101](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L101) - [apiSharees/sharees.feature:350](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L350) - [apiSharees/sharees.feature:351](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L351) - [apiSharees/sharees.feature:370](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L370) @@ -424,12 +418,6 @@ File and sync features in a shared scenario - [apiSharees/sharees.feature:411](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L411) - [apiSharees/sharees.feature:430](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L430) - [apiSharees/sharees.feature:431](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L431) -- [apiSharees/sharees.feature:583](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L583) -- [apiSharees/sharees.feature:584](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L584) -- [apiSharees/sharees.feature:655](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L655) -- [apiSharees/sharees.feature:656](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L656) -- [apiSharees/sharees.feature:680](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L680) -- [apiSharees/sharees.feature:681](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L681) #### User cannot create a folder named Share From 5d1cd6e73c8dcc5206f813d2cf6dffcfbc65327d Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 20 Jul 2022 09:55:27 +0000 Subject: [PATCH 12/21] Automated changelog update [skip ci] --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11c14d56fcc..a4c0073087d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,26 @@ The following sections list the changes for unreleased. ## Summary +* Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) ## Details +* Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) + + We fixed searching for sharees to be no longer case-sensitive. With this we introduced two new + settings for the users and groups services: "group_substring_filter_type" for the group + services and "user_substring_filter_type" for the users service. They allow to set the type + of LDAP filter that is used for substring user searches. Possible values are: "initial", + "final" and "any" to do either prefix, suffix or full substring searches. Both settings + default to "initial". + + Also a new option "search_min_length" was added for the "frontend" service. It allows to + configure the minimum number of characters to enter before a search for Sharees is started. + This setting is e.g. evaluated by the web ui via the capabilities endpoint. + + https://github.com/owncloud/ocis/issues/547 + * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) We've improved the error log for "could not get user by claim" error where previously only the From e1cb4e9c97657aad2fa1f56bd21b619168a6c017 Mon Sep 17 00:00:00 2001 From: Willy Kloucek <34452982+wkloucek@users.noreply.github.com> Date: Wed, 20 Jul 2022 13:10:54 +0200 Subject: [PATCH 13/21] Revert "Bump github.com/grpc-ecosystem/grpc-gateway/v2 from 2.10.3 to 2.11.0" --- go.mod | 10 +++++----- go.sum | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 79c32c5cba9..608239f852a 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gookit/config/v2 v2.1.2 github.com/gorilla/mux v1.8.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3 github.com/justinas/alice v1.2.0 github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63 @@ -70,9 +70,9 @@ require ( golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 golang.org/x/exp v0.0.0-20220518171630-0b5c67f07fdf golang.org/x/image v0.0.0-20220321031419-a8550c1d254a - golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e - golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92 - google.golang.org/genproto v0.0.0-20220719170305-83ca9fad585f + golang.org/x/net v0.0.0-20220516155154-20f960328961 + golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 + google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 gopkg.in/yaml.v2 v2.4.0 @@ -253,7 +253,7 @@ require ( go.uber.org/zap v1.19.1 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect golang.org/x/tools v0.1.10 // indirect diff --git a/go.sum b/go.sum index c975b8235f9..44170f51898 100644 --- a/go.sum +++ b/go.sum @@ -36,7 +36,6 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -670,8 +669,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 h1:Ghn7copILfeIg0y8sTGRppI1bd8I4l2VN3cob0Xeqwg= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0/go.mod h1:dnjr4snxnhRSn5GWqJUva2AoMbeaxyAcepvc0Tg8lXk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3 h1:BGNSrTRW4rwfhJiFwvwF4XQ0Y72Jj9YEgxVrtovbD5o= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3/go.mod h1:VHn7KgNsRriXa4mcgtkpR00OXyQY6g67JWMvn+R27A4= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.11.0 h1:Hw/G8TtRvOElqxVIhBzXciiSTbapq8hZ2XKZsXk5ZCE= @@ -1490,8 +1489,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220516155154-20f960328961 h1:+W/iTMPG0EL7aW+/atntZwZrvSRIj3m3yX414dSULUU= +golang.org/x/net v0.0.0-20220516155154-20f960328961/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1509,8 +1508,8 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92 h1:oVlhw3Oe+1reYsE2Nqu19PDJfLzwdU3QUUrG86rLK68= -golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 h1:OSnWWcOd/CtWQC2cYSBgbTSJv3ciqd8r54ySIW2y3RE= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1638,9 +1637,8 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220307203707-22a9840ba4d7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d h1:Zu/JngovGLVi6t2J3nmAf3AoTDwuzw85YZ3b9o4yU7s= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201113234701-d7a72108b828/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1856,8 +1854,8 @@ google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211016002631-37fc39342514/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220719170305-83ca9fad585f h1:P8EiVSxZwC6xH2niv2N66aqwMtYFg+D54gbjpcqKJtM= -google.golang.org/genproto v0.0.0-20220719170305-83ca9fad585f/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd h1:e0TwkXOdbnH/1x5rc5MZ/VYyiZ4v+RdVfrGMqEwT68I= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1889,6 +1887,7 @@ google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= From ad3b455742c7f047ab87ec42adab50b6354bad1a Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 20 Jul 2022 20:07:33 +0545 Subject: [PATCH 14/21] Bump CORE_COMMITID for API tests --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 24c029c028f..9ef0abd9c67 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=854ee4b08674d1932fb0b7910a9124148df36e4c +CORE_COMMITID=0214d4bca2d0bb39ea6b2ad67c2df463b2647b76 CORE_BRANCH=master # The test runner source for UI tests From 35f94365f75a4316396a17bfeb68ac8ec5c7636d Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 20 Jul 2022 22:38:00 +0545 Subject: [PATCH 15/21] Remove passing web tests from expected-failures --- tests/acceptance/expected-failures-webUI-on-OCIS-storage.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md index 32587f2d1ea..59d3cd7146b 100644 --- a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md @@ -68,11 +68,9 @@ Other free text and markdown formatting can be used elsewhere in the document if - [webUISharingAutocompletion/shareAutocompletion.feature:168](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletion.feature#L168) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:55](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L55) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:56](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L56) -- [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:57](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L57) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:73](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L73) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:74](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L74) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:75](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L75) -- [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:76](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L76) ### [Minimum of three characters required for autocompletion](https://github.com/owncloud/ocis/issues/1961) - [webUISharingAutocompletion/shareAutocompletion.feature:32](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletion.feature#L32) From f24a6e96a5e343707977dd3cf4e1a18f02a25001 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 20 Jul 2022 16:14:34 +0545 Subject: [PATCH 16/21] Cache web repo for tests --- .drone.star | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.drone.star b/.drone.star index 2d0e90b6302..1f9609602e3 100644 --- a/.drone.star +++ b/.drone.star @@ -195,6 +195,7 @@ def main(ctx): test_pipelines = \ cancelPreviousBuilds() + \ + buildCacheWeb(ctx) + \ yarnCache(ctx) + \ [buildOcisBinaryForTesting(ctx)] + \ cacheCoreReposForTesting(ctx) + \ @@ -257,13 +258,30 @@ def main(ctx): pipelineSanityChecks(ctx, pipelines) return pipelines +def buildCacheWeb(ctx): + return [{ + "kind": "pipeline", + "type": "docker", + "name": "cache-web", + "steps": skipIfUnchanged(ctx, "cache") + + installWebTestRunner() + + rebuildBuildArtifactCache(ctx, "web-dist", "webTestRunner"), + "trigger": { + "ref": [ + "refs/heads/master", + "refs/tags/**", + "refs/pull/**", + ], + }, + }] + def yarnCache(ctx): return [{ "kind": "pipeline", "type": "docker", "name": "cache-yarn", "steps": skipIfUnchanged(ctx, "cache") + - installWebTestRunner() + + restoreBuildArtifactCache(ctx, "web-dist", "webTestRunner") + yarnInstallUITests() + rebuildBuildArtifactCache(ctx, "tests-yarn", "webTestRunner/tests/acceptance/.yarn"), "trigger": { @@ -773,7 +791,7 @@ def uiTestPipeline(ctx, filterTags, early_fail, runPart = 1, numberOfParts = 1, "os": "linux", "arch": "amd64", }, - "steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + installWebTestRunner() + + "steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + restoreBuildArtifactCache(ctx, "web-dist", "webTestRunner") + restoreBuildArtifactCache(ctx, "tests-yarn", "webTestRunner/tests/acceptance/.yarn") + yarnInstallUITests() + ocisServer(storage, accounts_hash_difficulty) + waitForSeleniumService() + waitForMiddlewareService() + restoreBuildArtifactCache(ctx, "testing_app", dirs["testing_app"]) + From a6069760ef10fa8a26f59c4b4f0218778ad0260c Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 20 Jul 2022 16:26:15 +0545 Subject: [PATCH 17/21] skip piplines --- .drone.star | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.drone.star b/.drone.star index 1f9609602e3..8adfd828a82 100644 --- a/.drone.star +++ b/.drone.star @@ -134,7 +134,7 @@ config = { "dockerReleases": { "architectures": ["arm", "arm64", "amd64"], }, - "litmus": True, + "litmus": False, } # volume for steps to cache Go dependencies between steps of a pipeline @@ -196,11 +196,11 @@ def main(ctx): test_pipelines = \ cancelPreviousBuilds() + \ buildCacheWeb(ctx) + \ - yarnCache(ctx) + \ - [buildOcisBinaryForTesting(ctx)] + \ - cacheCoreReposForTesting(ctx) + \ - testOcisModules(ctx) + \ - testPipelines(ctx) + yarnCache(ctx) + # [buildOcisBinaryForTesting(ctx)] + \ + # cacheCoreReposForTesting(ctx) + \ + # testOcisModules(ctx) + \ + # testPipelines(ctx) build_release_pipelines = \ [licenseCheck(ctx)] + \ @@ -213,26 +213,26 @@ def main(ctx): docs(), ] - test_pipelines.append( - pipelineDependsOn( - purgeBuildArtifactCache(ctx, "ocis-binary-amd64"), - testPipelines(ctx), - ), - ) - test_pipelines.append( - pipelineDependsOn( - purgeBuildArtifactCache(ctx, "testrunner"), - testPipelines(ctx), - ), - ) - test_pipelines.append( - pipelineDependsOn( - purgeBuildArtifactCache(ctx, "testing_app"), - testPipelines(ctx), - ), - ) + # test_pipelines.append( + # pipelineDependsOn( + # purgeBuildArtifactCache(ctx, "ocis-binary-amd64"), + # testPipelines(ctx), + # ), + # ) + # test_pipelines.append( + # pipelineDependsOn( + # purgeBuildArtifactCache(ctx, "testrunner"), + # testPipelines(ctx), + # ), + # ) + # test_pipelines.append( + # pipelineDependsOn( + # purgeBuildArtifactCache(ctx, "testing_app"), + # testPipelines(ctx), + # ), + # ) - pipelines = test_pipelines + build_release_pipelines + build_release_helpers + pipelines = test_pipelines if ctx.build.event == "cron": pipelines = \ @@ -309,6 +309,7 @@ def yarnInstallUITests(): "commands": [ "curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry", ". /drone/src/.drone.env", + "ls", "cd webTestRunner", "git checkout $WEB_COMMITID", "cd tests/acceptance/", From a0ec85dc16571d5c8fa374b83e26ce890071b7e7 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 20 Jul 2022 16:29:27 +0545 Subject: [PATCH 18/21] add depends on --- .drone.star | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.star b/.drone.star index 8adfd828a82..a50bdf71f2e 100644 --- a/.drone.star +++ b/.drone.star @@ -284,6 +284,7 @@ def yarnCache(ctx): restoreBuildArtifactCache(ctx, "web-dist", "webTestRunner") + yarnInstallUITests() + rebuildBuildArtifactCache(ctx, "tests-yarn", "webTestRunner/tests/acceptance/.yarn"), + "depends_on": getPipelineNames(buildCacheWeb(ctx)), "trigger": { "ref": [ "refs/heads/master", From 7b51c16f6eba81b8d4b748c7f22cadc9abb9aa36 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 20 Jul 2022 16:39:02 +0545 Subject: [PATCH 19/21] Allow all the tests --- .drone.star | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/.drone.star b/.drone.star index a50bdf71f2e..4c58dcc3381 100644 --- a/.drone.star +++ b/.drone.star @@ -134,7 +134,7 @@ config = { "dockerReleases": { "architectures": ["arm", "arm64", "amd64"], }, - "litmus": False, + "litmus": True, } # volume for steps to cache Go dependencies between steps of a pipeline @@ -196,11 +196,11 @@ def main(ctx): test_pipelines = \ cancelPreviousBuilds() + \ buildCacheWeb(ctx) + \ - yarnCache(ctx) - # [buildOcisBinaryForTesting(ctx)] + \ - # cacheCoreReposForTesting(ctx) + \ - # testOcisModules(ctx) + \ - # testPipelines(ctx) + yarnCache(ctx) + \ + [buildOcisBinaryForTesting(ctx)] + \ + cacheCoreReposForTesting(ctx) + \ + testOcisModules(ctx) + \ + testPipelines(ctx) build_release_pipelines = \ [licenseCheck(ctx)] + \ @@ -213,26 +213,26 @@ def main(ctx): docs(), ] - # test_pipelines.append( - # pipelineDependsOn( - # purgeBuildArtifactCache(ctx, "ocis-binary-amd64"), - # testPipelines(ctx), - # ), - # ) - # test_pipelines.append( - # pipelineDependsOn( - # purgeBuildArtifactCache(ctx, "testrunner"), - # testPipelines(ctx), - # ), - # ) - # test_pipelines.append( - # pipelineDependsOn( - # purgeBuildArtifactCache(ctx, "testing_app"), - # testPipelines(ctx), - # ), - # ) + test_pipelines.append( + pipelineDependsOn( + purgeBuildArtifactCache(ctx, "ocis-binary-amd64"), + testPipelines(ctx), + ), + ) + test_pipelines.append( + pipelineDependsOn( + purgeBuildArtifactCache(ctx, "testrunner"), + testPipelines(ctx), + ), + ) + test_pipelines.append( + pipelineDependsOn( + purgeBuildArtifactCache(ctx, "testing_app"), + testPipelines(ctx), + ), + ) - pipelines = test_pipelines + pipelines = test_pipelines + build_release_pipelines + build_release_helpers if ctx.build.event == "cron": pipelines = \ @@ -310,7 +310,6 @@ def yarnInstallUITests(): "commands": [ "curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry", ". /drone/src/.drone.env", - "ls", "cd webTestRunner", "git checkout $WEB_COMMITID", "cd tests/acceptance/", From fbfae89638d35e0e4bd80464546bf4fc3a72ab3b Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 21 Jul 2022 11:42:37 +0545 Subject: [PATCH 20/21] Do not fetch the retry script in CI --- .drone.star | 2 -- 1 file changed, 2 deletions(-) diff --git a/.drone.star b/.drone.star index 2d0e90b6302..e01ab8ebe34 100644 --- a/.drone.star +++ b/.drone.star @@ -289,7 +289,6 @@ def yarnInstallUITests(): "name": "yarn-install", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ - "curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry", ". /drone/src/.drone.env", "cd webTestRunner", "git checkout $WEB_COMMITID", @@ -846,7 +845,6 @@ def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4): "MIDDLEWARE_HOST": "http://middleware:3000", }, "commands": [ - "curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry", ". /drone/src/.drone.env", # we need to have Web around for some general step definitions (eg. how to log in) "git clone -b $WEB_BRANCH --single-branch --no-tags https://github.com/owncloud/web.git /srv/app/web", From c3ff4261b45a0876f2b86172e066c8cd3bff1a77 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Thu, 21 Jul 2022 11:20:09 +0545 Subject: [PATCH 21/21] Add retry option --- .drone.star | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.star b/.drone.star index 23722cf1f69..e6fc3e393cb 100644 --- a/.drone.star +++ b/.drone.star @@ -1599,7 +1599,7 @@ def makeNodeGenerate(module): "CHROMEDRIVER_SKIP_DOWNLOAD": "true", # install fails on arm and chromedriver is a test only dependency }, "commands": [ - "%s ci-node-generate" % (make), + "retry -t 3 '%s ci-node-generate'" % (make), ], "volumes": [stepVolumeGo], }, @@ -1615,7 +1615,7 @@ def makeGoGenerate(module): "name": "generate go", "image": OC_CI_GOLANG, "commands": [ - "%s ci-go-generate" % (make), + "retry -t 3 '%s ci-go-generate'" % (make), ], "volumes": [stepVolumeGo], }, @@ -1861,7 +1861,7 @@ def build(): "name": "build", "image": OC_CI_GOLANG, "commands": [ - "make -C ocis build", + "retry -t 3 'make -C ocis build'", ], "volumes": [stepVolumeGo], },