diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 921817e61b0..24953cd5d43 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ -services/settings/ @kulmann -services/web/ @kulmann -.drone.star @wkloucek @micbar @phil-davis @individual-it -assets/End-User-License-Agreement-for-ownCloud-Infinite-Scale.pdf @micbar @dragotin @tbsbdr +services/settings/ @lukashirt +services/web/ @lukashirt +.drone.star @kobergj @phil-davis @individual-it +assets/End-User-License-Agreement-for-ownCloud-Infinite-Scale.pdf @kobergj @hodyroff diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e976ce47b7f..bbff084028d 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -12,6 +12,20 @@ $finder = PhpCsFixer\Finder::create() ->exclude($excludeDirs) ->in(__DIR__); -$config = new OC\CodingStandard\Config(); +$ocRule = (new OC\CodingStandard\Config())->getRules(); +$config = new PhpCsFixer\Config(); +$config->setFinder($finder) + ->setIndent("\t") + ->setRules( + array_merge( + $ocRule, + [ + "return_type_declaration" => [ + "space_before" => "none", + ], + 'single_space_around_construct' => true + ] + ) + ); $config->setFinder($finder); return $config; diff --git a/CHANGELOG.md b/CHANGELOG.md index 760580913d2..b8f691c49ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Table of Contents +* [Changelog for unreleased](#changelog-for-unreleased-unreleased) * [Changelog for 7.0.0](#changelog-for-700-2024-12-17) * [Changelog for 5.0.9](#changelog-for-509-2024-11-14) * [Changelog for 6.6.1](#changelog-for-661-2024-10-24) @@ -52,6 +53,72 @@ * [Changelog for 1.1.0](#changelog-for-110-2021-01-22) * [Changelog for 1.0.0](#changelog-for-100-2020-12-17) +# Changelog for [unreleased] (UNRELEASED) + +The following sections list the changes for unreleased. + +[unreleased]: https://github.com/owncloud/ocis/compare/v7.0.0...master + +## Summary + +* Bugfix - Share creation date is missing in invite response: [#10780](https://github.com/owncloud/ocis/pull/10780) +* Bugfix - Bump some golang dependencies: [#10795](https://github.com/owncloud/ocis/pull/10795) +* Enhancement - Part I: The user settings are extended by notifications preferences: [#10706](https://github.com/owncloud/ocis/pull/10706) +* Enhancement - Part II: Filtering of in-app notifications: [#10779](https://github.com/owncloud/ocis/pull/10779) +* Enhancement - Part III: Filtering of mail notifications: [#10792](https://github.com/owncloud/ocis/pull/10792) +* Enhancement - Translate Notification Settings: [#10812](https://github.com/owncloud/ocis/pull/10812) +* Enhancement - Bump Reva: [#10830](https://github.com/owncloud/ocis/pull/10830) + +## Details + +* Bugfix - Share creation date is missing in invite response: [#10780](https://github.com/owncloud/ocis/pull/10780) + + The graph drives invite response now includes the `createdDateTime` field. + + https://github.com/owncloud/ocis/issues/10739 + https://github.com/owncloud/ocis/pull/10780 + +* Bugfix - Bump some golang dependencies: [#10795](https://github.com/owncloud/ocis/pull/10795) + + Bump dependencies "golang.org/x/crypto" and "golang.org/x/net" + + https://github.com/owncloud/ocis/pull/10795 + +* Enhancement - Part I: The user settings are extended by notifications preferences: [#10706](https://github.com/owncloud/ocis/pull/10706) + + Part I: Users can now store their notifications preferences in the user settings + + https://github.com/owncloud/ocis/issues/10669 + https://github.com/owncloud/ocis/pull/10706 + +* Enhancement - Part II: Filtering of in-app notifications: [#10779](https://github.com/owncloud/ocis/pull/10779) + + Part II: In-app notifications are now filtered based on the notification + preferences in the user settings + + https://github.com/owncloud/ocis/issues/10769 + https://github.com/owncloud/ocis/pull/10779 + +* Enhancement - Part III: Filtering of mail notifications: [#10792](https://github.com/owncloud/ocis/pull/10792) + + Part III: Mail notifications are now filtered based on the notification + preferences in the user settings + + https://github.com/owncloud/ocis/issues/10790 + https://github.com/owncloud/ocis/pull/10792 + +* Enhancement - Translate Notification Settings: [#10812](https://github.com/owncloud/ocis/pull/10812) + + Translates the notification settings according to the users language preference. + + https://github.com/owncloud/ocis/pull/10812 + +* Enhancement - Bump Reva: [#10830](https://github.com/owncloud/ocis/pull/10830) + + Bumps the reva version + + https://github.com/owncloud/ocis/pull/10830 + # Changelog for [7.0.0] (2024-12-17) The following sections list the changes for 7.0.0. diff --git a/Makefile b/Makefile index 07becb4948e..3d7a62c6cf0 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ L10N_MODULES := \ services/activitylog \ services/graph \ services/notifications \ - services/userlog + services/userlog \ + services/settings # if you add a module here please also add it to the .drone.star file OCIS_MODULES = \ diff --git a/changelog/unreleased/bump-dependencies.md b/changelog/unreleased/bump-dependencies.md new file mode 100644 index 00000000000..3a9ae1e700a --- /dev/null +++ b/changelog/unreleased/bump-dependencies.md @@ -0,0 +1,5 @@ +Bugfix: Bump some golang dependencies + +Bump dependencies "golang.org/x/crypto" and "golang.org/x/net" + +https://github.com/owncloud/ocis/pull/10795 diff --git a/changelog/unreleased/bump-reva.md b/changelog/unreleased/bump-reva.md new file mode 100644 index 00000000000..66115d4d198 --- /dev/null +++ b/changelog/unreleased/bump-reva.md @@ -0,0 +1,5 @@ +Enhancement: Bump Reva + +Bumps the reva version + +https://github.com/owncloud/ocis/pull/10830 diff --git a/changelog/unreleased/enhancement-add-events-setting.md b/changelog/unreleased/enhancement-add-events-setting.md new file mode 100644 index 00000000000..22173f7334a --- /dev/null +++ b/changelog/unreleased/enhancement-add-events-setting.md @@ -0,0 +1,6 @@ +Enhancement: Part I: The user settings are extended by notifications preferences + +Part I: Users can now store their notifications preferences in the user settings + +https://github.com/owncloud/ocis/pull/10706 +https://github.com/owncloud/ocis/issues/10669 diff --git a/changelog/unreleased/enhancement-in-app-notifications-filtering.md b/changelog/unreleased/enhancement-in-app-notifications-filtering.md new file mode 100644 index 00000000000..54660daa413 --- /dev/null +++ b/changelog/unreleased/enhancement-in-app-notifications-filtering.md @@ -0,0 +1,6 @@ +Enhancement: Part II: Filtering of in-app notifications + +Part II: In-app notifications are now filtered based on the notification preferences in the user settings + +https://github.com/owncloud/ocis/pull/10779 +https://github.com/owncloud/ocis/issues/10769 diff --git a/changelog/unreleased/enhancement-mail-notifications-filtering.md b/changelog/unreleased/enhancement-mail-notifications-filtering.md new file mode 100644 index 00000000000..c1585000f99 --- /dev/null +++ b/changelog/unreleased/enhancement-mail-notifications-filtering.md @@ -0,0 +1,6 @@ +Enhancement: Part III: Filtering of mail notifications + +Part III: Mail notifications are now filtered based on the notification preferences in the user settings + +https://github.com/owncloud/ocis/pull/10792 +https://github.com/owncloud/ocis/issues/10790 diff --git a/changelog/unreleased/fix-graph-invite-createddatetime.md b/changelog/unreleased/fix-graph-invite-createddatetime.md new file mode 100644 index 00000000000..d29d2b44e56 --- /dev/null +++ b/changelog/unreleased/fix-graph-invite-createddatetime.md @@ -0,0 +1,6 @@ +Bugfix: Share creation date is missing in invite response + +The graph drives invite response now includes the `createdDateTime` field. + +https://github.com/owncloud/ocis/pull/10780 +https://github.com/owncloud/ocis/issues/10739 diff --git a/changelog/unreleased/notification-settings-translations.md b/changelog/unreleased/notification-settings-translations.md new file mode 100644 index 00000000000..ef52a15687b --- /dev/null +++ b/changelog/unreleased/notification-settings-translations.md @@ -0,0 +1,5 @@ +Enhancement: Translate Notification Settings + +Translates the notification settings according to the users language preference. + +https://github.com/owncloud/ocis/pull/10812 diff --git a/deployments/continuous-deployment-config/ocis_full/master.yml b/deployments/continuous-deployment-config/ocis_full/master.yml index db92f98326e..99a52c2498e 100644 --- a/deployments/continuous-deployment-config/ocis_full/master.yml +++ b/deployments/continuous-deployment-config/ocis_full/master.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_full env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: master OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis.master.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_full/onlyoffice-master.yml b/deployments/continuous-deployment-config/ocis_full/onlyoffice-master.yml index 9a48b3b428d..164f5949d2b 100644 --- a/deployments/continuous-deployment-config/ocis_full/onlyoffice-master.yml +++ b/deployments/continuous-deployment-config/ocis_full/onlyoffice-master.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_full env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: master OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis-onlyoffice.master.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_full/onlyoffice-rolling.yml b/deployments/continuous-deployment-config/ocis_full/onlyoffice-rolling.yml index fb4c1ab5622..a886e4787f6 100644 --- a/deployments/continuous-deployment-config/ocis_full/onlyoffice-rolling.yml +++ b/deployments/continuous-deployment-config/ocis_full/onlyoffice-rolling.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_full env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: 6.6.1 OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis-onlyoffice.rolling.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_full/production.yml b/deployments/continuous-deployment-config/ocis_full/production.yml index 508efd432e1..a0dde882351 100644 --- a/deployments/continuous-deployment-config/ocis_full/production.yml +++ b/deployments/continuous-deployment-config/ocis_full/production.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_full env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: 7.0.0 OCIS_DOMAIN: ocis.ocis.production.owncloud.works COMPANION_DOMAIN: companion.ocis.production.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_full/rolling.yml b/deployments/continuous-deployment-config/ocis_full/rolling.yml index c7e3dd480bd..d08b02e69f3 100644 --- a/deployments/continuous-deployment-config/ocis_full/rolling.yml +++ b/deployments/continuous-deployment-config/ocis_full/rolling.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_full env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: 6.6.1 OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis.rolling.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_full/s3-rolling.yml b/deployments/continuous-deployment-config/ocis_full/s3-rolling.yml index c4db2bf540c..fb32524fc51 100644 --- a/deployments/continuous-deployment-config/ocis_full/s3-rolling.yml +++ b/deployments/continuous-deployment-config/ocis_full/s3-rolling.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_full env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: 6.6.1 OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis-s3.rolling.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_keycloak/rolling.yml b/deployments/continuous-deployment-config/ocis_keycloak/rolling.yml index 20bcccc7354..b79742d312c 100644 --- a/deployments/continuous-deployment-config/ocis_keycloak/rolling.yml +++ b/deployments/continuous-deployment-config/ocis_keycloak/rolling.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_keycloak env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: 6.6.1 OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis-keycloak.rolling.owncloud.works diff --git a/deployments/continuous-deployment-config/ocis_ldap/rolling.yml b/deployments/continuous-deployment-config/ocis_ldap/rolling.yml index 9727b73fab5..4ef6e0a2a0d 100644 --- a/deployments/continuous-deployment-config/ocis_ldap/rolling.yml +++ b/deployments/continuous-deployment-config/ocis_ldap/rolling.yml @@ -18,10 +18,9 @@ vars: ssh_authorized_keys: - - https://github.com/butonic.keys - - https://github.com/fschade.keys - - https://github.com/kulmann.keys - - https://github.com/micbar.keys + - https://github.com/kobergj.keys + - https://github.com/2403905.keys + - https://github.com/d7oc.keys - https://github.com/wkloucek.keys docker_compose_projects: - name: ocis @@ -30,7 +29,7 @@ docker_compose_path: deployments/examples/ocis_ldap env: INSECURE: "false" - TRAEFIK_ACME_MAIL: mbarz@owncloud.com + TRAEFIK_ACME_MAIL: julian.koberg@kiteworks.com OCIS_DOCKER_TAG: 6.6.1 OCIS_DOCKER_IMAGE: owncloud/ocis-rolling OCIS_DOMAIN: ocis.ocis-ldap.rolling.owncloud.works diff --git a/docs/services/general-info/add-translations.md b/docs/services/general-info/add-translations.md index 46065f64288..48130227046 100644 --- a/docs/services/general-info/add-translations.md +++ b/docs/services/general-info/add-translations.md @@ -29,7 +29,13 @@ Translations have a `context` and a `translatable string`. The context is shown * Add the `OCIS_DEFAULT_LANGUAGE` envvar in `services//pkg/config/config.go`.\ For details see the userlog or notifications service code. -* Use `"github.com/owncloud/ocis/v2/ocis-pkg/l10n"` for the translation. +* Add the `_TRANSLATION_PATH` envvar in `services//pkg/config/config.go`.\ + For details see the userlog or notifications service code. + +* Use `"github.com/owncloud/ocis/v2/ocis-pkg/l10n"` for the translation.\ + Use `l10n.Template` to define the translation string.\ + Use `l10n.NewTranslator` or `l10n.NewTranslatorFromCommonConfig` to get the translator.\ + Use `t.Get` to translate the string. See package for more advanced usage. * Create a config in `services//pkg/service/l10n/.tx/config` with the following content. Note that it is important to stick with `ocis-` to easily identify all ocis translations on Transifex: ``` @@ -46,9 +52,11 @@ Translations have a `context` and a `translatable string`. The context is shown ``` Note: o: organization, p: project, r: resource -* Create a go file like `templates.go` in `ocis/services//pkg/service` that will define your translation sources like the following: +* Create an empty file `services//pkg/service/l10n/locale/en/LC_MESSAGES/.po`. This is required for ocis to build. This file will be replaced nightly with the latest translations from Transifex. + +* Create a go file like `templates.go` in e.g. `ocis/services//pkg/service` that will define your translation sources like the following: ``` - // context string + // this comment will appear in transifex as context var yourString = l10n.Template("Translation String") ``` @@ -85,7 +93,7 @@ Translations have a `context` and a `translatable string`. The context is shown l10n-read: $(GO_XGETTEXT) go-xgettext -o $(OUTPUT_DIR)/.pot \ --keyword=l10n.Template --add-comments -s \ - ocis/services//pkg/service/templates.go + pkg/service/templates.go .PHONY: l10n-write l10n-write: diff --git a/go.mod b/go.mod index 3371b3ce829..563cac135ec 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/cenkalti/backoff v2.2.1+incompatible github.com/coreos/go-oidc/v3 v3.11.0 github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1 - github.com/cs3org/reva/v2 v2.27.0 + github.com/cs3org/reva/v2 v2.27.1-0.20250107124628-bd76241aa776 github.com/davidbyttow/govips/v2 v2.15.0 github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e @@ -98,10 +98,10 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 go.opentelemetry.io/otel/sdk v1.32.0 go.opentelemetry.io/otel/trace v1.32.0 - golang.org/x/crypto v0.30.0 + golang.org/x/crypto v0.31.0 golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c golang.org/x/image v0.22.0 - golang.org/x/net v0.32.0 + golang.org/x/net v0.33.0 golang.org/x/oauth2 v0.24.0 golang.org/x/sync v0.10.0 golang.org/x/term v0.27.0 @@ -340,7 +340,7 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -replace github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6 +replace github.com/studio-b12/gowebdav => github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202 replace github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-20240802074440-aade4a234387 diff --git a/go.sum b/go.sum index 9a3af4c629c..a1374610622 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,6 @@ github.com/RoaringBitmap/roaring v1.9.3 h1:t4EbC5qQwnisr5PrP9nt0IRhRTb9gMUgQF4t4 github.com/RoaringBitmap/roaring v1.9.3/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6 h1:ws0yvsikTQdmheKINP16tBzAHdttrHwbz/q3Fgl9X1Y= -github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE= github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY= github.com/agnivade/levenshtein v1.2.0/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= @@ -255,8 +253,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c= github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME= github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1 h1:RU6LT6mkD16xZs011+8foU7T3LrPvTTSWeTQ9OgfhkA= github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1/go.mod h1:DedpcqXl193qF/08Y04IO0PpxyyMu8+GrkD6kWK2MEQ= -github.com/cs3org/reva/v2 v2.27.0 h1:Lq8VBRjQmyCfCO6+wC80Z4vH2Q1MfgORggg1e6mEcdM= -github.com/cs3org/reva/v2 v2.27.0/go.mod h1:fJWmn7EkttWOWphZfiKdFOcHuthcUsU55aSN1VeTOhU= +github.com/cs3org/reva/v2 v2.27.1-0.20250107124628-bd76241aa776 h1:tNLN9UCR9OHhZUHftWKfJyNPPaS0HaT0QOH4zGln/UE= +github.com/cs3org/reva/v2 v2.27.1-0.20250107124628-bd76241aa776/go.mod h1:OrCNgIFkp3ROHiEjNCj8eZHACmYCD4owtFRuYFlYZkU= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= @@ -704,6 +702,8 @@ github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90 github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202 h1:A1xJ2NKgiYFiaHiLl9B5yw/gUBACSs9crDykTS3GuQI= +github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE= github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90 h1:pfI8Z5yavO6fU6vDGlWhZ4BgDlvj8c6xB7J57HfTPwA= github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ= @@ -1229,8 +1229,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= -golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1327,8 +1327,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= 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= diff --git a/ocis-pkg/l10n/l10n.go b/ocis-pkg/l10n/l10n.go index 58680666f85..0908c187f37 100644 --- a/ocis-pkg/l10n/l10n.go +++ b/ocis-pkg/l10n/l10n.go @@ -11,7 +11,6 @@ import ( "github.com/leonelquinteros/gotext" "github.com/owncloud/ocis/v2/ocis-pkg/middleware" settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" - "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults" micrometadata "go-micro.dev/v4/metadata" ) @@ -140,7 +139,8 @@ func GetUserLocale(ctx context.Context, userID string, vc settingssvc.ValueServi micrometadata.Set(ctx, middleware.AccountID, userID), &settingssvc.GetValueByUniqueIdentifiersRequest{ AccountUuid: userID, - SettingId: defaults.SettingUUIDProfileLanguage, + // this defaults.SettingUUIDProfileLanguage. Copied here to avoid import cycles. + SettingId: "aa8cfbe5-95d4-4f7e-a032-c3c01f5f062f", }, ) if err != nil { diff --git a/phpcs.xml b/phpcs.xml index a3b644170c2..925d2c72937 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -19,10 +19,6 @@ - - - - @@ -77,4 +73,18 @@ */lib/storagewrapper.php + + Please review this TODO comment: %s + error + + + + + + + error + + + + diff --git a/protogen/gen/ocis/messages/settings/v0/settings.pb.go b/protogen/gen/ocis/messages/settings/v0/settings.pb.go index 2a5c40b8606..563436da5a5 100644 --- a/protogen/gen/ocis/messages/settings/v0/settings.pb.go +++ b/protogen/gen/ocis/messages/settings/v0/settings.pb.go @@ -240,7 +240,7 @@ func (x Permission_Operation) Number() protoreflect.EnumNumber { // Deprecated: Use Permission_Operation.Descriptor instead. func (Permission_Operation) EnumDescriptor() ([]byte, []int) { - return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13, 0} + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{16, 0} } type Permission_Constraint int32 @@ -292,7 +292,7 @@ func (x Permission_Constraint) Number() protoreflect.EnumNumber { // Deprecated: Use Permission_Constraint.Descriptor instead. func (Permission_Constraint) EnumDescriptor() ([]byte, []int) { - return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13, 1} + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{16, 1} } type ValueWithIdentifier struct { @@ -627,13 +627,13 @@ type Bundle struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` // @gotags: yaml:"id" - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" yaml:"name"` // @gotags: yaml:"name" - Type Bundle_Type `protobuf:"varint,3,opt,name=type,proto3,enum=ocis.messages.settings.v0.Bundle_Type" json:"type,omitempty" yaml:"type"` // @gotags: yaml:"type" - Extension string `protobuf:"bytes,4,opt,name=extension,proto3" json:"extension,omitempty" yaml:"extension"` // @gotags: yaml:"extension" - DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty" yaml:"display_name"` // @gotags: yaml:"display_name" - Settings []*Setting `protobuf:"bytes,6,rep,name=settings,proto3" json:"settings,omitempty" yaml:"settings"` // @gotags: yaml:"settings" - Resource *Resource `protobuf:"bytes,7,opt,name=resource,proto3" json:"resource,omitempty" yaml:"resource"` // @gotags: yaml:"resource" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // @gotags: yaml:"id" + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // @gotags: yaml:"name" + Type Bundle_Type `protobuf:"varint,3,opt,name=type,proto3,enum=ocis.messages.settings.v0.Bundle_Type" json:"type,omitempty"` // @gotags: yaml:"type" + Extension string `protobuf:"bytes,4,opt,name=extension,proto3" json:"extension,omitempty"` // @gotags: yaml:"extension" + DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // @gotags: yaml:"display_name" + Settings []*Setting `protobuf:"bytes,6,rep,name=settings,proto3" json:"settings,omitempty"` // @gotags: yaml:"settings" + Resource *Resource `protobuf:"bytes,7,opt,name=resource,proto3" json:"resource,omitempty"` // @gotags: yaml:"resource" } func (x *Bundle) Reset() { @@ -722,10 +722,10 @@ type Setting struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` // @gotags: yaml:"id" - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" yaml:"name"` // @gotags: yaml:"name" - DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty" yaml:"display_name"` // @gotags: yaml:"display_name" - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` // @gotags: yaml:"description" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // @gotags: yaml:"id" + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // @gotags: yaml:"name" + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // @gotags: yaml:"display_name" + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // @gotags: yaml:"description" // Types that are assignable to Value: // // *Setting_IntValue @@ -734,8 +734,9 @@ type Setting struct { // *Setting_SingleChoiceValue // *Setting_MultiChoiceValue // *Setting_PermissionValue + // *Setting_MultiChoiceCollectionValue Value isSetting_Value `protobuf_oneof:"value"` - Resource *Resource `protobuf:"bytes,11,opt,name=resource,proto3" json:"resource,omitempty" yaml:"resource"` // @gotags: yaml:"resource" + Resource *Resource `protobuf:"bytes,11,opt,name=resource,proto3" json:"resource,omitempty"` // @gotags: yaml:"resource" } func (x *Setting) Reset() { @@ -847,6 +848,13 @@ func (x *Setting) GetPermissionValue() *Permission { return nil } +func (x *Setting) GetMultiChoiceCollectionValue() *MultiChoiceCollection { + if x, ok := x.GetValue().(*Setting_MultiChoiceCollectionValue); ok { + return x.MultiChoiceCollectionValue + } + return nil +} + func (x *Setting) GetResource() *Resource { if x != nil { return x.Resource @@ -859,27 +867,31 @@ type isSetting_Value interface { } type Setting_IntValue struct { - IntValue *Int `protobuf:"bytes,5,opt,name=int_value,json=intValue,proto3,oneof" yaml:"int_value"` // @gotags: yaml:"int_value" + IntValue *Int `protobuf:"bytes,5,opt,name=int_value,json=intValue,proto3,oneof"` // @gotags: yaml:"int_value" } type Setting_StringValue struct { - StringValue *String `protobuf:"bytes,6,opt,name=string_value,json=stringValue,proto3,oneof" yaml:"string_value"` // @gotags: yaml:"string_value" + StringValue *String `protobuf:"bytes,6,opt,name=string_value,json=stringValue,proto3,oneof"` // @gotags: yaml:"string_value" } type Setting_BoolValue struct { - BoolValue *Bool `protobuf:"bytes,7,opt,name=bool_value,json=boolValue,proto3,oneof" yaml:"bool_value"` // @gotags: yaml:"bool_value" + BoolValue *Bool `protobuf:"bytes,7,opt,name=bool_value,json=boolValue,proto3,oneof"` // @gotags: yaml:"bool_value" } type Setting_SingleChoiceValue struct { - SingleChoiceValue *SingleChoiceList `protobuf:"bytes,8,opt,name=single_choice_value,json=singleChoiceValue,proto3,oneof" yaml:"single_choice_value"` // @gotags: yaml:"single_choice_value" + SingleChoiceValue *SingleChoiceList `protobuf:"bytes,8,opt,name=single_choice_value,json=singleChoiceValue,proto3,oneof"` // @gotags: yaml:"single_choice_value" } type Setting_MultiChoiceValue struct { - MultiChoiceValue *MultiChoiceList `protobuf:"bytes,9,opt,name=multi_choice_value,json=multiChoiceValue,proto3,oneof" yaml:"multi_choice_value"` // @gotags: yaml:"multi_choice_value" + MultiChoiceValue *MultiChoiceList `protobuf:"bytes,9,opt,name=multi_choice_value,json=multiChoiceValue,proto3,oneof"` // @gotags: yaml:"multi_choice_value" } type Setting_PermissionValue struct { - PermissionValue *Permission `protobuf:"bytes,10,opt,name=permission_value,json=permissionValue,proto3,oneof" yaml:"permission_value"` // @gotags: yaml:"permission_value" + PermissionValue *Permission `protobuf:"bytes,10,opt,name=permission_value,json=permissionValue,proto3,oneof"` // @gotags: yaml:"permission_value" +} + +type Setting_MultiChoiceCollectionValue struct { + MultiChoiceCollectionValue *MultiChoiceCollection `protobuf:"bytes,12,opt,name=multi_choice_collection_value,json=multiChoiceCollectionValue,proto3,oneof"` // @gotags: yaml:"multi_choice_collection_value" } func (*Setting_IntValue) isSetting_Value() {} @@ -894,16 +906,18 @@ func (*Setting_MultiChoiceValue) isSetting_Value() {} func (*Setting_PermissionValue) isSetting_Value() {} +func (*Setting_MultiChoiceCollectionValue) isSetting_Value() {} + type Int struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Default int64 `protobuf:"varint,1,opt,name=default,proto3" json:"default,omitempty" yaml:"default"` // @gotags: yaml:"default" - Min int64 `protobuf:"varint,2,opt,name=min,proto3" json:"min,omitempty" yaml:"min"` // @gotags: yaml:"min" - Max int64 `protobuf:"varint,3,opt,name=max,proto3" json:"max,omitempty" yaml:"max"` // @gotags: yaml:"max" - Step int64 `protobuf:"varint,4,opt,name=step,proto3" json:"step,omitempty" yaml:"step"` // @gotags: yaml:"step" - Placeholder string `protobuf:"bytes,5,opt,name=placeholder,proto3" json:"placeholder,omitempty" yaml:"placeholder"` // @gotags: yaml:"placeholder" + Default int64 `protobuf:"varint,1,opt,name=default,proto3" json:"default,omitempty"` // @gotags: yaml:"default" + Min int64 `protobuf:"varint,2,opt,name=min,proto3" json:"min,omitempty"` // @gotags: yaml:"min" + Max int64 `protobuf:"varint,3,opt,name=max,proto3" json:"max,omitempty"` // @gotags: yaml:"max" + Step int64 `protobuf:"varint,4,opt,name=step,proto3" json:"step,omitempty"` // @gotags: yaml:"step" + Placeholder string `protobuf:"bytes,5,opt,name=placeholder,proto3" json:"placeholder,omitempty"` // @gotags: yaml:"placeholder" } func (x *Int) Reset() { @@ -978,11 +992,11 @@ type String struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Default string `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty" yaml:"default"` // @gotags: yaml:"default" - Required bool `protobuf:"varint,2,opt,name=required,proto3" json:"required,omitempty" yaml:"required"` // @gotags: yaml:"required" - MinLength int32 `protobuf:"varint,3,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty" yaml:"min_length"` // @gotags: yaml:"min_length" - MaxLength int32 `protobuf:"varint,4,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty" yaml:"max_length"` // @gotags: yaml:"max_length" - Placeholder string `protobuf:"bytes,5,opt,name=placeholder,proto3" json:"placeholder,omitempty" yaml:"placeholder"` // @gotags: yaml:"placeholder" + Default string `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"` // @gotags: yaml:"default" + Required bool `protobuf:"varint,2,opt,name=required,proto3" json:"required,omitempty"` // @gotags: yaml:"required" + MinLength int32 `protobuf:"varint,3,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` // @gotags: yaml:"min_length" + MaxLength int32 `protobuf:"varint,4,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` // @gotags: yaml:"max_length" + Placeholder string `protobuf:"bytes,5,opt,name=placeholder,proto3" json:"placeholder,omitempty"` // @gotags: yaml:"placeholder" } func (x *String) Reset() { @@ -1057,8 +1071,8 @@ type Bool struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Default bool `protobuf:"varint,1,opt,name=default,proto3" json:"default,omitempty" yaml:"default"` // @gotags: yaml:"default" - Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty" yaml:"label"` // @gotags: yaml:"label" + Default bool `protobuf:"varint,1,opt,name=default,proto3" json:"default,omitempty"` // @gotags: yaml:"default" + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` // @gotags: yaml:"label" } func (x *Bool) Reset() { @@ -1112,7 +1126,7 @@ type SingleChoiceList struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Options []*ListOption `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty" yaml:"options"` // @gotags: yaml:"options" + Options []*ListOption `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty"` // @gotags: yaml:"options" } func (x *SingleChoiceList) Reset() { @@ -1159,7 +1173,7 @@ type MultiChoiceList struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Options []*ListOption `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty" yaml:"options"` // @gotags: yaml:"options" + Options []*ListOption `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty"` // @gotags: yaml:"options" } func (x *MultiChoiceList) Reset() { @@ -1206,9 +1220,9 @@ type ListOption struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Value *ListOptionValue `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` // @gotags: yaml:"value" - Default bool `protobuf:"varint,2,opt,name=default,proto3" json:"default,omitempty" yaml:"default"` // @gotags: yaml:"default" - DisplayValue string `protobuf:"bytes,3,opt,name=display_value,json=displayValue,proto3" json:"display_value,omitempty" yaml:"display_value"` // @gotags: yaml:"display_value" + Value *ListOptionValue `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // @gotags: yaml:"value" + Default bool `protobuf:"varint,2,opt,name=default,proto3" json:"default,omitempty"` // @gotags: yaml:"default" + DisplayValue string `protobuf:"bytes,3,opt,name=display_value,json=displayValue,proto3" json:"display_value,omitempty"` // @gotags: yaml:"display_value" } func (x *ListOption) Reset() { @@ -1264,19 +1278,232 @@ func (x *ListOption) GetDisplayValue() string { return "" } +type MultiChoiceCollection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Options []*MultiChoiceCollectionOption `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty"` // @gotags: yaml:"options" +} + +func (x *MultiChoiceCollection) Reset() { + *x = MultiChoiceCollection{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MultiChoiceCollection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultiChoiceCollection) ProtoMessage() {} + +func (x *MultiChoiceCollection) ProtoReflect() protoreflect.Message { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MultiChoiceCollection.ProtoReflect.Descriptor instead. +func (*MultiChoiceCollection) Descriptor() ([]byte, []int) { + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13} +} + +func (x *MultiChoiceCollection) GetOptions() []*MultiChoiceCollectionOption { + if x != nil { + return x.Options + } + return nil +} + +type MultiChoiceCollectionOption struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value *MultiChoiceCollectionOptionValue `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // @gotags: yaml:"value" + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // @gotags: yaml:"key" + Attribute string `protobuf:"bytes,3,opt,name=attribute,proto3" json:"attribute,omitempty"` // @gotags: yaml:"attribute" + DisplayValue string `protobuf:"bytes,4,opt,name=display_value,json=displayValue,proto3" json:"display_value,omitempty"` // @gotags: yaml:"display_value" +} + +func (x *MultiChoiceCollectionOption) Reset() { + *x = MultiChoiceCollectionOption{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MultiChoiceCollectionOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultiChoiceCollectionOption) ProtoMessage() {} + +func (x *MultiChoiceCollectionOption) ProtoReflect() protoreflect.Message { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MultiChoiceCollectionOption.ProtoReflect.Descriptor instead. +func (*MultiChoiceCollectionOption) Descriptor() ([]byte, []int) { + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{14} +} + +func (x *MultiChoiceCollectionOption) GetValue() *MultiChoiceCollectionOptionValue { + if x != nil { + return x.Value + } + return nil +} + +func (x *MultiChoiceCollectionOption) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *MultiChoiceCollectionOption) GetAttribute() string { + if x != nil { + return x.Attribute + } + return "" +} + +func (x *MultiChoiceCollectionOption) GetDisplayValue() string { + if x != nil { + return x.DisplayValue + } + return "" +} + +type MultiChoiceCollectionOptionValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Option: + // + // *MultiChoiceCollectionOptionValue_IntValue + // *MultiChoiceCollectionOptionValue_StringValue + // *MultiChoiceCollectionOptionValue_BoolValue + Option isMultiChoiceCollectionOptionValue_Option `protobuf_oneof:"option"` +} + +func (x *MultiChoiceCollectionOptionValue) Reset() { + *x = MultiChoiceCollectionOptionValue{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MultiChoiceCollectionOptionValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultiChoiceCollectionOptionValue) ProtoMessage() {} + +func (x *MultiChoiceCollectionOptionValue) ProtoReflect() protoreflect.Message { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MultiChoiceCollectionOptionValue.ProtoReflect.Descriptor instead. +func (*MultiChoiceCollectionOptionValue) Descriptor() ([]byte, []int) { + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{15} +} + +func (m *MultiChoiceCollectionOptionValue) GetOption() isMultiChoiceCollectionOptionValue_Option { + if m != nil { + return m.Option + } + return nil +} + +func (x *MultiChoiceCollectionOptionValue) GetIntValue() *Int { + if x, ok := x.GetOption().(*MultiChoiceCollectionOptionValue_IntValue); ok { + return x.IntValue + } + return nil +} + +func (x *MultiChoiceCollectionOptionValue) GetStringValue() *String { + if x, ok := x.GetOption().(*MultiChoiceCollectionOptionValue_StringValue); ok { + return x.StringValue + } + return nil +} + +func (x *MultiChoiceCollectionOptionValue) GetBoolValue() *Bool { + if x, ok := x.GetOption().(*MultiChoiceCollectionOptionValue_BoolValue); ok { + return x.BoolValue + } + return nil +} + +type isMultiChoiceCollectionOptionValue_Option interface { + isMultiChoiceCollectionOptionValue_Option() +} + +type MultiChoiceCollectionOptionValue_IntValue struct { + IntValue *Int `protobuf:"bytes,1,opt,name=int_value,json=intValue,proto3,oneof"` // @gotags: yaml:"int_value" +} + +type MultiChoiceCollectionOptionValue_StringValue struct { + StringValue *String `protobuf:"bytes,2,opt,name=string_value,json=stringValue,proto3,oneof"` // @gotags: yaml:"string_value" +} + +type MultiChoiceCollectionOptionValue_BoolValue struct { + BoolValue *Bool `protobuf:"bytes,3,opt,name=bool_value,json=boolValue,proto3,oneof"` // @gotags: yaml:"bool_value" +} + +func (*MultiChoiceCollectionOptionValue_IntValue) isMultiChoiceCollectionOptionValue_Option() {} + +func (*MultiChoiceCollectionOptionValue_StringValue) isMultiChoiceCollectionOptionValue_Option() {} + +func (*MultiChoiceCollectionOptionValue_BoolValue) isMultiChoiceCollectionOptionValue_Option() {} + type Permission struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Operation Permission_Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=ocis.messages.settings.v0.Permission_Operation" json:"operation,omitempty" yaml:"operation"` // @gotags: yaml:"operation" - Constraint Permission_Constraint `protobuf:"varint,2,opt,name=constraint,proto3,enum=ocis.messages.settings.v0.Permission_Constraint" json:"constraint,omitempty" yaml:"constraint"` // @gotags: yaml:"constraint" + Operation Permission_Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=ocis.messages.settings.v0.Permission_Operation" json:"operation,omitempty"` // @gotags: yaml:"operation" + Constraint Permission_Constraint `protobuf:"varint,2,opt,name=constraint,proto3,enum=ocis.messages.settings.v0.Permission_Constraint" json:"constraint,omitempty"` // @gotags: yaml:"constraint" } func (x *Permission) Reset() { *x = Permission{} if protoimpl.UnsafeEnabled { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[13] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1289,7 +1516,7 @@ func (x *Permission) String() string { func (*Permission) ProtoMessage() {} func (x *Permission) ProtoReflect() protoreflect.Message { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[13] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1302,7 +1529,7 @@ func (x *Permission) ProtoReflect() protoreflect.Message { // Deprecated: Use Permission.ProtoReflect.Descriptor instead. func (*Permission) Descriptor() ([]byte, []int) { - return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{13} + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{16} } func (x *Permission) GetOperation() Permission_Operation { @@ -1325,25 +1552,26 @@ type Value struct { unknownFields protoimpl.UnknownFields // id is the id of the Value. It is generated on saving it. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` // @gotags: yaml:"id" - BundleId string `protobuf:"bytes,2,opt,name=bundle_id,json=bundleId,proto3" json:"bundle_id,omitempty" yaml:"bundle_id"` // @gotags: yaml:"bundle_id" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // @gotags: yaml:"id" + BundleId string `protobuf:"bytes,2,opt,name=bundle_id,json=bundleId,proto3" json:"bundle_id,omitempty"` // @gotags: yaml:"bundle_id" // setting_id is the id of the setting from within its bundle. - SettingId string `protobuf:"bytes,3,opt,name=setting_id,json=settingId,proto3" json:"setting_id,omitempty" yaml:"setting_id"` // @gotags: yaml:"setting_id" - AccountUuid string `protobuf:"bytes,4,opt,name=account_uuid,json=accountUuid,proto3" json:"account_uuid,omitempty" yaml:"account_uuid"` // @gotags: yaml:"account_uuid" - Resource *Resource `protobuf:"bytes,5,opt,name=resource,proto3" json:"resource,omitempty" yaml:"resource"` // @gotags: yaml:"resource" + SettingId string `protobuf:"bytes,3,opt,name=setting_id,json=settingId,proto3" json:"setting_id,omitempty"` // @gotags: yaml:"setting_id" + AccountUuid string `protobuf:"bytes,4,opt,name=account_uuid,json=accountUuid,proto3" json:"account_uuid,omitempty"` // @gotags: yaml:"account_uuid" + Resource *Resource `protobuf:"bytes,5,opt,name=resource,proto3" json:"resource,omitempty"` // @gotags: yaml:"resource" // Types that are assignable to Value: // // *Value_BoolValue // *Value_IntValue // *Value_StringValue // *Value_ListValue + // *Value_CollectionValue Value isValue_Value `protobuf_oneof:"value"` } func (x *Value) Reset() { *x = Value{} if protoimpl.UnsafeEnabled { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[14] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1356,7 +1584,7 @@ func (x *Value) String() string { func (*Value) ProtoMessage() {} func (x *Value) ProtoReflect() protoreflect.Message { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[14] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1369,7 +1597,7 @@ func (x *Value) ProtoReflect() protoreflect.Message { // Deprecated: Use Value.ProtoReflect.Descriptor instead. func (*Value) Descriptor() ([]byte, []int) { - return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{14} + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{17} } func (x *Value) GetId() string { @@ -1442,24 +1670,35 @@ func (x *Value) GetListValue() *ListValue { return nil } +func (x *Value) GetCollectionValue() *CollectionValue { + if x, ok := x.GetValue().(*Value_CollectionValue); ok { + return x.CollectionValue + } + return nil +} + type isValue_Value interface { isValue_Value() } type Value_BoolValue struct { - BoolValue bool `protobuf:"varint,6,opt,name=bool_value,json=boolValue,proto3,oneof" yaml:"bool_value"` // @gotags: yaml:"bool_value" + BoolValue bool `protobuf:"varint,6,opt,name=bool_value,json=boolValue,proto3,oneof"` // @gotags: yaml:"bool_value" } type Value_IntValue struct { - IntValue int64 `protobuf:"varint,7,opt,name=int_value,json=intValue,proto3,oneof" yaml:"int_value"` // @gotags: yaml:"int_value" + IntValue int64 `protobuf:"varint,7,opt,name=int_value,json=intValue,proto3,oneof"` // @gotags: yaml:"int_value" } type Value_StringValue struct { - StringValue string `protobuf:"bytes,8,opt,name=string_value,json=stringValue,proto3,oneof" yaml:"string_value"` // @gotags: yaml:"string_value" + StringValue string `protobuf:"bytes,8,opt,name=string_value,json=stringValue,proto3,oneof"` // @gotags: yaml:"string_value" } type Value_ListValue struct { - ListValue *ListValue `protobuf:"bytes,9,opt,name=list_value,json=listValue,proto3,oneof" yaml:"list_value"` // @gotags: yaml:"list_value" + ListValue *ListValue `protobuf:"bytes,9,opt,name=list_value,json=listValue,proto3,oneof"` // @gotags: yaml:"list_value" +} + +type Value_CollectionValue struct { + CollectionValue *CollectionValue `protobuf:"bytes,10,opt,name=collection_value,json=collectionValue,proto3,oneof"` // @gotags: yaml:"collection_value" } func (*Value_BoolValue) isValue_Value() {} @@ -1470,18 +1709,20 @@ func (*Value_StringValue) isValue_Value() {} func (*Value_ListValue) isValue_Value() {} +func (*Value_CollectionValue) isValue_Value() {} + type ListValue struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Values []*ListOptionValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty" yaml:"values"` // @gotags: yaml:"values" + Values []*ListOptionValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` // @gotags: yaml:"values" } func (x *ListValue) Reset() { *x = ListValue{} if protoimpl.UnsafeEnabled { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[15] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1494,7 +1735,7 @@ func (x *ListValue) String() string { func (*ListValue) ProtoMessage() {} func (x *ListValue) ProtoReflect() protoreflect.Message { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[15] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1507,7 +1748,7 @@ func (x *ListValue) ProtoReflect() protoreflect.Message { // Deprecated: Use ListValue.ProtoReflect.Descriptor instead. func (*ListValue) Descriptor() ([]byte, []int) { - return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{15} + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{18} } func (x *ListValue) GetValues() []*ListOptionValue { @@ -1526,13 +1767,14 @@ type ListOptionValue struct { // // *ListOptionValue_StringValue // *ListOptionValue_IntValue + // *ListOptionValue_BoolValue Option isListOptionValue_Option `protobuf_oneof:"option"` } func (x *ListOptionValue) Reset() { *x = ListOptionValue{} if protoimpl.UnsafeEnabled { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[16] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1545,7 +1787,7 @@ func (x *ListOptionValue) String() string { func (*ListOptionValue) ProtoMessage() {} func (x *ListOptionValue) ProtoReflect() protoreflect.Message { - mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[16] + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1558,7 +1800,7 @@ func (x *ListOptionValue) ProtoReflect() protoreflect.Message { // Deprecated: Use ListOptionValue.ProtoReflect.Descriptor instead. func (*ListOptionValue) Descriptor() ([]byte, []int) { - return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{16} + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{19} } func (m *ListOptionValue) GetOption() isListOptionValue_Option { @@ -1582,22 +1824,186 @@ func (x *ListOptionValue) GetIntValue() int64 { return 0 } +func (x *ListOptionValue) GetBoolValue() bool { + if x, ok := x.GetOption().(*ListOptionValue_BoolValue); ok { + return x.BoolValue + } + return false +} + type isListOptionValue_Option interface { isListOptionValue_Option() } type ListOptionValue_StringValue struct { - StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof" yaml:"string_value"` // @gotags: yaml:"string_value" + StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof"` // @gotags: yaml:"string_value" } type ListOptionValue_IntValue struct { - IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof" yaml:"int_value"` // @gotags: yaml:"int_value" + IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof"` // @gotags: yaml:"int_value" +} + +type ListOptionValue_BoolValue struct { + BoolValue bool `protobuf:"varint,3,opt,name=bool_value,json=boolValue,proto3,oneof"` // @gotags: yaml:"bool_value" } func (*ListOptionValue_StringValue) isListOptionValue_Option() {} func (*ListOptionValue_IntValue) isListOptionValue_Option() {} +func (*ListOptionValue_BoolValue) isListOptionValue_Option() {} + +type CollectionValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Values []*CollectionOption `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` // @gotags: yaml:"values" +} + +func (x *CollectionValue) Reset() { + *x = CollectionValue{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollectionValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionValue) ProtoMessage() {} + +func (x *CollectionValue) ProtoReflect() protoreflect.Message { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionValue.ProtoReflect.Descriptor instead. +func (*CollectionValue) Descriptor() ([]byte, []int) { + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{20} +} + +func (x *CollectionValue) GetValues() []*CollectionOption { + if x != nil { + return x.Values + } + return nil +} + +type CollectionOption struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // required + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // @gotags: yaml:"key" + // Types that are assignable to Option: + // + // *CollectionOption_IntValue + // *CollectionOption_StringValue + // *CollectionOption_BoolValue + Option isCollectionOption_Option `protobuf_oneof:"option"` +} + +func (x *CollectionOption) Reset() { + *x = CollectionOption{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollectionOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionOption) ProtoMessage() {} + +func (x *CollectionOption) ProtoReflect() protoreflect.Message { + mi := &file_ocis_messages_settings_v0_settings_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionOption.ProtoReflect.Descriptor instead. +func (*CollectionOption) Descriptor() ([]byte, []int) { + return file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{21} +} + +func (x *CollectionOption) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (m *CollectionOption) GetOption() isCollectionOption_Option { + if m != nil { + return m.Option + } + return nil +} + +func (x *CollectionOption) GetIntValue() int64 { + if x, ok := x.GetOption().(*CollectionOption_IntValue); ok { + return x.IntValue + } + return 0 +} + +func (x *CollectionOption) GetStringValue() string { + if x, ok := x.GetOption().(*CollectionOption_StringValue); ok { + return x.StringValue + } + return "" +} + +func (x *CollectionOption) GetBoolValue() bool { + if x, ok := x.GetOption().(*CollectionOption_BoolValue); ok { + return x.BoolValue + } + return false +} + +type isCollectionOption_Option interface { + isCollectionOption_Option() +} + +type CollectionOption_IntValue struct { + IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof"` // @gotags: yaml:"int_value" +} + +type CollectionOption_StringValue struct { + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` // @gotags: yaml:"string_value" +} + +type CollectionOption_BoolValue struct { + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` // @gotags: yaml:"bool_value" +} + +func (*CollectionOption_IntValue) isCollectionOption_Option() {} + +func (*CollectionOption_StringValue) isCollectionOption_Option() {} + +func (*CollectionOption_BoolValue) isCollectionOption_Option() {} + var File_ocis_messages_settings_v0_settings_proto protoreflect.FileDescriptor var file_ocis_messages_settings_v0_settings_proto_rawDesc = []byte{ @@ -1678,7 +2084,7 @@ var file_ocis_messages_settings_v0_settings_proto_rawDesc = []byte{ 0x39, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x22, 0x94, 0x05, 0x0a, 0x07, 0x53, + 0x59, 0x50, 0x45, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x22, 0x8b, 0x06, 0x0a, 0x07, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, @@ -1715,119 +2121,184 @@ var file_ocis_messages_settings_v0_settings_proto_rawDesc = []byte{ 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x75, 0x0a, 0x1d, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, + 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x00, 0x52, 0x1a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x43, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, + 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, + 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x79, 0x0a, 0x03, 0x49, 0x6e, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, + 0x61, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x22, 0x9e, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x18, + 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, + 0x6c, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x53, 0x0a, 0x10, + 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, + 0x12, 0x3f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0x52, 0x0a, 0x0f, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, + 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x69, 0x0a, 0x15, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x36, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0xc5, 0x01, 0x0a, 0x1b, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x51, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x70, + 0x6c, 0x61, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xf5, 0x01, 0x0a, 0x20, 0x4d, 0x75, 0x6c, + 0x74, 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, + 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x49, 0x6e, 0x74, + 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0c, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x40, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, + 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0xbb, 0x03, 0x0a, 0x0a, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x4d, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, + 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, + 0x61, 0x69, 0x6e, 0x74, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, + 0x22, 0xa6, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, + 0x0a, 0x11, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4f, + 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, + 0x14, 0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x50, 0x44, + 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x4f, + 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x05, + 0x12, 0x17, 0x0a, 0x13, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, + 0x41, 0x44, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x06, 0x22, 0x63, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, + 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4e, 0x53, 0x54, + 0x52, 0x41, 0x49, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x12, 0x0a, 0x0e, 0x43, 0x4f, 0x4e, 0x53, 0x54, 0x52, 0x41, 0x49, 0x4e, 0x54, 0x5f, 0x4f, 0x57, + 0x4e, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x53, 0x54, 0x52, 0x41, 0x49, 0x4e, + 0x54, 0x5f, 0x53, 0x48, 0x41, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x4f, + 0x4e, 0x53, 0x54, 0x52, 0x41, 0x49, 0x4e, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x03, 0x22, 0xc5, + 0x03, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x75, 0x6e, 0x64, + 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x75, 0x6e, + 0x64, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, + 0x75, 0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x55, 0x75, 0x69, 0x64, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x79, 0x0a, 0x03, 0x49, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x22, 0x9e, 0x01, 0x0a, - 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, 0x0a, - 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, - 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x20, 0x0a, 0x0b, 0x70, - 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, - 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x53, 0x0a, 0x10, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x63, 0x69, - 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x52, 0x0a, 0x0f, 0x4d, 0x75, - 0x6c, 0x74, 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3f, 0x0a, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, + 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, + 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x45, 0x0a, + 0x0a, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x8d, - 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, - 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x69, 0x73, - 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbb, - 0x03, 0x0a, 0x0a, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4d, 0x0a, - 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2f, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x50, 0x65, 0x72, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x0a, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x30, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x50, 0x65, 0x72, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, - 0x6e, 0x74, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x22, 0xa6, - 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, - 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x45, - 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x14, 0x0a, - 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, - 0x45, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x4f, 0x50, 0x45, - 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x05, 0x12, 0x17, - 0x0a, 0x13, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x44, - 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x06, 0x22, 0x63, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x61, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4e, 0x53, 0x54, 0x52, 0x41, - 0x49, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, - 0x0e, 0x43, 0x4f, 0x4e, 0x53, 0x54, 0x52, 0x41, 0x49, 0x4e, 0x54, 0x5f, 0x4f, 0x57, 0x4e, 0x10, - 0x01, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x53, 0x54, 0x52, 0x41, 0x49, 0x4e, 0x54, 0x5f, - 0x53, 0x48, 0x41, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x4f, 0x4e, 0x53, - 0x54, 0x52, 0x41, 0x49, 0x4e, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x03, 0x22, 0xec, 0x02, 0x0a, - 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x75, 0x6e, 0x64, 0x6c, - 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x75, - 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x55, 0x75, 0x69, 0x64, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, - 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, - 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x6c, - 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x09, 0x4c, - 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x5f, 0x0a, 0x0f, - 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x44, 0x5a, - 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x2f, 0x76, 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x42, 0x08, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x56, 0x0a, 0x0f, 0x43, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x43, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, + 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x22, 0x93, 0x01, 0x0a, 0x10, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, + 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, + 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, + 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x30, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1843,34 +2314,39 @@ func file_ocis_messages_settings_v0_settings_proto_rawDescGZIP() []byte { } var file_ocis_messages_settings_v0_settings_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_ocis_messages_settings_v0_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_ocis_messages_settings_v0_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_ocis_messages_settings_v0_settings_proto_goTypes = []interface{}{ - (UserRoleAssignmentFilter_Type)(0), // 0: ocis.messages.settings.v0.UserRoleAssignmentFilter.Type - (Resource_Type)(0), // 1: ocis.messages.settings.v0.Resource.Type - (Bundle_Type)(0), // 2: ocis.messages.settings.v0.Bundle.Type - (Permission_Operation)(0), // 3: ocis.messages.settings.v0.Permission.Operation - (Permission_Constraint)(0), // 4: ocis.messages.settings.v0.Permission.Constraint - (*ValueWithIdentifier)(nil), // 5: ocis.messages.settings.v0.ValueWithIdentifier - (*Identifier)(nil), // 6: ocis.messages.settings.v0.Identifier - (*UserRoleAssignment)(nil), // 7: ocis.messages.settings.v0.UserRoleAssignment - (*UserRoleAssignmentFilter)(nil), // 8: ocis.messages.settings.v0.UserRoleAssignmentFilter - (*Resource)(nil), // 9: ocis.messages.settings.v0.Resource - (*Bundle)(nil), // 10: ocis.messages.settings.v0.Bundle - (*Setting)(nil), // 11: ocis.messages.settings.v0.Setting - (*Int)(nil), // 12: ocis.messages.settings.v0.Int - (*String)(nil), // 13: ocis.messages.settings.v0.String - (*Bool)(nil), // 14: ocis.messages.settings.v0.Bool - (*SingleChoiceList)(nil), // 15: ocis.messages.settings.v0.SingleChoiceList - (*MultiChoiceList)(nil), // 16: ocis.messages.settings.v0.MultiChoiceList - (*ListOption)(nil), // 17: ocis.messages.settings.v0.ListOption - (*Permission)(nil), // 18: ocis.messages.settings.v0.Permission - (*Value)(nil), // 19: ocis.messages.settings.v0.Value - (*ListValue)(nil), // 20: ocis.messages.settings.v0.ListValue - (*ListOptionValue)(nil), // 21: ocis.messages.settings.v0.ListOptionValue + (UserRoleAssignmentFilter_Type)(0), // 0: ocis.messages.settings.v0.UserRoleAssignmentFilter.Type + (Resource_Type)(0), // 1: ocis.messages.settings.v0.Resource.Type + (Bundle_Type)(0), // 2: ocis.messages.settings.v0.Bundle.Type + (Permission_Operation)(0), // 3: ocis.messages.settings.v0.Permission.Operation + (Permission_Constraint)(0), // 4: ocis.messages.settings.v0.Permission.Constraint + (*ValueWithIdentifier)(nil), // 5: ocis.messages.settings.v0.ValueWithIdentifier + (*Identifier)(nil), // 6: ocis.messages.settings.v0.Identifier + (*UserRoleAssignment)(nil), // 7: ocis.messages.settings.v0.UserRoleAssignment + (*UserRoleAssignmentFilter)(nil), // 8: ocis.messages.settings.v0.UserRoleAssignmentFilter + (*Resource)(nil), // 9: ocis.messages.settings.v0.Resource + (*Bundle)(nil), // 10: ocis.messages.settings.v0.Bundle + (*Setting)(nil), // 11: ocis.messages.settings.v0.Setting + (*Int)(nil), // 12: ocis.messages.settings.v0.Int + (*String)(nil), // 13: ocis.messages.settings.v0.String + (*Bool)(nil), // 14: ocis.messages.settings.v0.Bool + (*SingleChoiceList)(nil), // 15: ocis.messages.settings.v0.SingleChoiceList + (*MultiChoiceList)(nil), // 16: ocis.messages.settings.v0.MultiChoiceList + (*ListOption)(nil), // 17: ocis.messages.settings.v0.ListOption + (*MultiChoiceCollection)(nil), // 18: ocis.messages.settings.v0.MultiChoiceCollection + (*MultiChoiceCollectionOption)(nil), // 19: ocis.messages.settings.v0.MultiChoiceCollectionOption + (*MultiChoiceCollectionOptionValue)(nil), // 20: ocis.messages.settings.v0.MultiChoiceCollectionOptionValue + (*Permission)(nil), // 21: ocis.messages.settings.v0.Permission + (*Value)(nil), // 22: ocis.messages.settings.v0.Value + (*ListValue)(nil), // 23: ocis.messages.settings.v0.ListValue + (*ListOptionValue)(nil), // 24: ocis.messages.settings.v0.ListOptionValue + (*CollectionValue)(nil), // 25: ocis.messages.settings.v0.CollectionValue + (*CollectionOption)(nil), // 26: ocis.messages.settings.v0.CollectionOption } var file_ocis_messages_settings_v0_settings_proto_depIdxs = []int32{ 6, // 0: ocis.messages.settings.v0.ValueWithIdentifier.identifier:type_name -> ocis.messages.settings.v0.Identifier - 19, // 1: ocis.messages.settings.v0.ValueWithIdentifier.value:type_name -> ocis.messages.settings.v0.Value + 22, // 1: ocis.messages.settings.v0.ValueWithIdentifier.value:type_name -> ocis.messages.settings.v0.Value 0, // 2: ocis.messages.settings.v0.UserRoleAssignmentFilter.type:type_name -> ocis.messages.settings.v0.UserRoleAssignmentFilter.Type 1, // 3: ocis.messages.settings.v0.Resource.type:type_name -> ocis.messages.settings.v0.Resource.Type 2, // 4: ocis.messages.settings.v0.Bundle.type:type_name -> ocis.messages.settings.v0.Bundle.Type @@ -1881,21 +2357,29 @@ var file_ocis_messages_settings_v0_settings_proto_depIdxs = []int32{ 14, // 9: ocis.messages.settings.v0.Setting.bool_value:type_name -> ocis.messages.settings.v0.Bool 15, // 10: ocis.messages.settings.v0.Setting.single_choice_value:type_name -> ocis.messages.settings.v0.SingleChoiceList 16, // 11: ocis.messages.settings.v0.Setting.multi_choice_value:type_name -> ocis.messages.settings.v0.MultiChoiceList - 18, // 12: ocis.messages.settings.v0.Setting.permission_value:type_name -> ocis.messages.settings.v0.Permission - 9, // 13: ocis.messages.settings.v0.Setting.resource:type_name -> ocis.messages.settings.v0.Resource - 17, // 14: ocis.messages.settings.v0.SingleChoiceList.options:type_name -> ocis.messages.settings.v0.ListOption - 17, // 15: ocis.messages.settings.v0.MultiChoiceList.options:type_name -> ocis.messages.settings.v0.ListOption - 21, // 16: ocis.messages.settings.v0.ListOption.value:type_name -> ocis.messages.settings.v0.ListOptionValue - 3, // 17: ocis.messages.settings.v0.Permission.operation:type_name -> ocis.messages.settings.v0.Permission.Operation - 4, // 18: ocis.messages.settings.v0.Permission.constraint:type_name -> ocis.messages.settings.v0.Permission.Constraint - 9, // 19: ocis.messages.settings.v0.Value.resource:type_name -> ocis.messages.settings.v0.Resource - 20, // 20: ocis.messages.settings.v0.Value.list_value:type_name -> ocis.messages.settings.v0.ListValue - 21, // 21: ocis.messages.settings.v0.ListValue.values:type_name -> ocis.messages.settings.v0.ListOptionValue - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 21, // 12: ocis.messages.settings.v0.Setting.permission_value:type_name -> ocis.messages.settings.v0.Permission + 18, // 13: ocis.messages.settings.v0.Setting.multi_choice_collection_value:type_name -> ocis.messages.settings.v0.MultiChoiceCollection + 9, // 14: ocis.messages.settings.v0.Setting.resource:type_name -> ocis.messages.settings.v0.Resource + 17, // 15: ocis.messages.settings.v0.SingleChoiceList.options:type_name -> ocis.messages.settings.v0.ListOption + 17, // 16: ocis.messages.settings.v0.MultiChoiceList.options:type_name -> ocis.messages.settings.v0.ListOption + 24, // 17: ocis.messages.settings.v0.ListOption.value:type_name -> ocis.messages.settings.v0.ListOptionValue + 19, // 18: ocis.messages.settings.v0.MultiChoiceCollection.options:type_name -> ocis.messages.settings.v0.MultiChoiceCollectionOption + 20, // 19: ocis.messages.settings.v0.MultiChoiceCollectionOption.value:type_name -> ocis.messages.settings.v0.MultiChoiceCollectionOptionValue + 12, // 20: ocis.messages.settings.v0.MultiChoiceCollectionOptionValue.int_value:type_name -> ocis.messages.settings.v0.Int + 13, // 21: ocis.messages.settings.v0.MultiChoiceCollectionOptionValue.string_value:type_name -> ocis.messages.settings.v0.String + 14, // 22: ocis.messages.settings.v0.MultiChoiceCollectionOptionValue.bool_value:type_name -> ocis.messages.settings.v0.Bool + 3, // 23: ocis.messages.settings.v0.Permission.operation:type_name -> ocis.messages.settings.v0.Permission.Operation + 4, // 24: ocis.messages.settings.v0.Permission.constraint:type_name -> ocis.messages.settings.v0.Permission.Constraint + 9, // 25: ocis.messages.settings.v0.Value.resource:type_name -> ocis.messages.settings.v0.Resource + 23, // 26: ocis.messages.settings.v0.Value.list_value:type_name -> ocis.messages.settings.v0.ListValue + 25, // 27: ocis.messages.settings.v0.Value.collection_value:type_name -> ocis.messages.settings.v0.CollectionValue + 24, // 28: ocis.messages.settings.v0.ListValue.values:type_name -> ocis.messages.settings.v0.ListOptionValue + 26, // 29: ocis.messages.settings.v0.CollectionValue.values:type_name -> ocis.messages.settings.v0.CollectionOption + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name } func init() { file_ocis_messages_settings_v0_settings_proto_init() } @@ -2061,7 +2545,7 @@ func file_ocis_messages_settings_v0_settings_proto_init() { } } file_ocis_messages_settings_v0_settings_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Permission); i { + switch v := v.(*MultiChoiceCollection); i { case 0: return &v.state case 1: @@ -2073,7 +2557,7 @@ func file_ocis_messages_settings_v0_settings_proto_init() { } } file_ocis_messages_settings_v0_settings_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Value); i { + switch v := v.(*MultiChoiceCollectionOption); i { case 0: return &v.state case 1: @@ -2085,7 +2569,7 @@ func file_ocis_messages_settings_v0_settings_proto_init() { } } file_ocis_messages_settings_v0_settings_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListValue); i { + switch v := v.(*MultiChoiceCollectionOptionValue); i { case 0: return &v.state case 1: @@ -2097,6 +2581,42 @@ func file_ocis_messages_settings_v0_settings_proto_init() { } } file_ocis_messages_settings_v0_settings_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Permission); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_messages_settings_v0_settings_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Value); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_messages_settings_v0_settings_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_messages_settings_v0_settings_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListOptionValue); i { case 0: return &v.state @@ -2108,6 +2628,30 @@ func file_ocis_messages_settings_v0_settings_proto_init() { return nil } } + file_ocis_messages_settings_v0_settings_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollectionValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_messages_settings_v0_settings_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollectionOption); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_ocis_messages_settings_v0_settings_proto_msgTypes[3].OneofWrappers = []interface{}{ (*UserRoleAssignmentFilter_AccountUuid)(nil), @@ -2120,16 +2664,29 @@ func file_ocis_messages_settings_v0_settings_proto_init() { (*Setting_SingleChoiceValue)(nil), (*Setting_MultiChoiceValue)(nil), (*Setting_PermissionValue)(nil), + (*Setting_MultiChoiceCollectionValue)(nil), } - file_ocis_messages_settings_v0_settings_proto_msgTypes[14].OneofWrappers = []interface{}{ + file_ocis_messages_settings_v0_settings_proto_msgTypes[15].OneofWrappers = []interface{}{ + (*MultiChoiceCollectionOptionValue_IntValue)(nil), + (*MultiChoiceCollectionOptionValue_StringValue)(nil), + (*MultiChoiceCollectionOptionValue_BoolValue)(nil), + } + file_ocis_messages_settings_v0_settings_proto_msgTypes[17].OneofWrappers = []interface{}{ (*Value_BoolValue)(nil), (*Value_IntValue)(nil), (*Value_StringValue)(nil), (*Value_ListValue)(nil), + (*Value_CollectionValue)(nil), } - file_ocis_messages_settings_v0_settings_proto_msgTypes[16].OneofWrappers = []interface{}{ + file_ocis_messages_settings_v0_settings_proto_msgTypes[19].OneofWrappers = []interface{}{ (*ListOptionValue_StringValue)(nil), (*ListOptionValue_IntValue)(nil), + (*ListOptionValue_BoolValue)(nil), + } + file_ocis_messages_settings_v0_settings_proto_msgTypes[21].OneofWrappers = []interface{}{ + (*CollectionOption_IntValue)(nil), + (*CollectionOption_StringValue)(nil), + (*CollectionOption_BoolValue)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -2137,7 +2694,7 @@ func file_ocis_messages_settings_v0_settings_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ocis_messages_settings_v0_settings_proto_rawDesc, NumEnums: 5, - NumMessages: 17, + NumMessages: 22, NumExtensions: 0, NumServices: 0, }, diff --git a/protogen/gen/ocis/messages/settings/v0/settings.pb.web.go b/protogen/gen/ocis/messages/settings/v0/settings.pb.web.go index 73cce02d46f..9acb1f224ee 100644 --- a/protogen/gen/ocis/messages/settings/v0/settings.pb.web.go +++ b/protogen/gen/ocis/messages/settings/v0/settings.pb.web.go @@ -478,6 +478,114 @@ func (m *ListOption) UnmarshalJSON(b []byte) error { var _ json.Unmarshaler = (*ListOption)(nil) +// MultiChoiceCollectionJSONMarshaler describes the default jsonpb.Marshaler used by all +// instances of MultiChoiceCollection. This struct is safe to replace or modify but +// should not be done so concurrently. +var MultiChoiceCollectionJSONMarshaler = new(jsonpb.Marshaler) + +// MarshalJSON satisfies the encoding/json Marshaler interface. This method +// uses the more correct jsonpb package to correctly marshal the message. +func (m *MultiChoiceCollection) MarshalJSON() ([]byte, error) { + if m == nil { + return json.Marshal(nil) + } + + buf := &bytes.Buffer{} + + if err := MultiChoiceCollectionJSONMarshaler.Marshal(buf, m); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +var _ json.Marshaler = (*MultiChoiceCollection)(nil) + +// MultiChoiceCollectionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all +// instances of MultiChoiceCollection. This struct is safe to replace or modify but +// should not be done so concurrently. +var MultiChoiceCollectionJSONUnmarshaler = new(jsonpb.Unmarshaler) + +// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method +// uses the more correct jsonpb package to correctly unmarshal the message. +func (m *MultiChoiceCollection) UnmarshalJSON(b []byte) error { + return MultiChoiceCollectionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m) +} + +var _ json.Unmarshaler = (*MultiChoiceCollection)(nil) + +// MultiChoiceCollectionOptionJSONMarshaler describes the default jsonpb.Marshaler used by all +// instances of MultiChoiceCollectionOption. This struct is safe to replace or modify but +// should not be done so concurrently. +var MultiChoiceCollectionOptionJSONMarshaler = new(jsonpb.Marshaler) + +// MarshalJSON satisfies the encoding/json Marshaler interface. This method +// uses the more correct jsonpb package to correctly marshal the message. +func (m *MultiChoiceCollectionOption) MarshalJSON() ([]byte, error) { + if m == nil { + return json.Marshal(nil) + } + + buf := &bytes.Buffer{} + + if err := MultiChoiceCollectionOptionJSONMarshaler.Marshal(buf, m); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +var _ json.Marshaler = (*MultiChoiceCollectionOption)(nil) + +// MultiChoiceCollectionOptionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all +// instances of MultiChoiceCollectionOption. This struct is safe to replace or modify but +// should not be done so concurrently. +var MultiChoiceCollectionOptionJSONUnmarshaler = new(jsonpb.Unmarshaler) + +// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method +// uses the more correct jsonpb package to correctly unmarshal the message. +func (m *MultiChoiceCollectionOption) UnmarshalJSON(b []byte) error { + return MultiChoiceCollectionOptionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m) +} + +var _ json.Unmarshaler = (*MultiChoiceCollectionOption)(nil) + +// MultiChoiceCollectionOptionValueJSONMarshaler describes the default jsonpb.Marshaler used by all +// instances of MultiChoiceCollectionOptionValue. This struct is safe to replace or modify but +// should not be done so concurrently. +var MultiChoiceCollectionOptionValueJSONMarshaler = new(jsonpb.Marshaler) + +// MarshalJSON satisfies the encoding/json Marshaler interface. This method +// uses the more correct jsonpb package to correctly marshal the message. +func (m *MultiChoiceCollectionOptionValue) MarshalJSON() ([]byte, error) { + if m == nil { + return json.Marshal(nil) + } + + buf := &bytes.Buffer{} + + if err := MultiChoiceCollectionOptionValueJSONMarshaler.Marshal(buf, m); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +var _ json.Marshaler = (*MultiChoiceCollectionOptionValue)(nil) + +// MultiChoiceCollectionOptionValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all +// instances of MultiChoiceCollectionOptionValue. This struct is safe to replace or modify but +// should not be done so concurrently. +var MultiChoiceCollectionOptionValueJSONUnmarshaler = new(jsonpb.Unmarshaler) + +// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method +// uses the more correct jsonpb package to correctly unmarshal the message. +func (m *MultiChoiceCollectionOptionValue) UnmarshalJSON(b []byte) error { + return MultiChoiceCollectionOptionValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m) +} + +var _ json.Unmarshaler = (*MultiChoiceCollectionOptionValue)(nil) + // PermissionJSONMarshaler describes the default jsonpb.Marshaler used by all // instances of Permission. This struct is safe to replace or modify but // should not be done so concurrently. @@ -621,3 +729,75 @@ func (m *ListOptionValue) UnmarshalJSON(b []byte) error { } var _ json.Unmarshaler = (*ListOptionValue)(nil) + +// CollectionValueJSONMarshaler describes the default jsonpb.Marshaler used by all +// instances of CollectionValue. This struct is safe to replace or modify but +// should not be done so concurrently. +var CollectionValueJSONMarshaler = new(jsonpb.Marshaler) + +// MarshalJSON satisfies the encoding/json Marshaler interface. This method +// uses the more correct jsonpb package to correctly marshal the message. +func (m *CollectionValue) MarshalJSON() ([]byte, error) { + if m == nil { + return json.Marshal(nil) + } + + buf := &bytes.Buffer{} + + if err := CollectionValueJSONMarshaler.Marshal(buf, m); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +var _ json.Marshaler = (*CollectionValue)(nil) + +// CollectionValueJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all +// instances of CollectionValue. This struct is safe to replace or modify but +// should not be done so concurrently. +var CollectionValueJSONUnmarshaler = new(jsonpb.Unmarshaler) + +// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method +// uses the more correct jsonpb package to correctly unmarshal the message. +func (m *CollectionValue) UnmarshalJSON(b []byte) error { + return CollectionValueJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m) +} + +var _ json.Unmarshaler = (*CollectionValue)(nil) + +// CollectionOptionJSONMarshaler describes the default jsonpb.Marshaler used by all +// instances of CollectionOption. This struct is safe to replace or modify but +// should not be done so concurrently. +var CollectionOptionJSONMarshaler = new(jsonpb.Marshaler) + +// MarshalJSON satisfies the encoding/json Marshaler interface. This method +// uses the more correct jsonpb package to correctly marshal the message. +func (m *CollectionOption) MarshalJSON() ([]byte, error) { + if m == nil { + return json.Marshal(nil) + } + + buf := &bytes.Buffer{} + + if err := CollectionOptionJSONMarshaler.Marshal(buf, m); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +var _ json.Marshaler = (*CollectionOption)(nil) + +// CollectionOptionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all +// instances of CollectionOption. This struct is safe to replace or modify but +// should not be done so concurrently. +var CollectionOptionJSONUnmarshaler = new(jsonpb.Unmarshaler) + +// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method +// uses the more correct jsonpb package to correctly unmarshal the message. +func (m *CollectionOption) UnmarshalJSON(b []byte) error { + return CollectionOptionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m) +} + +var _ json.Unmarshaler = (*CollectionOption)(nil) diff --git a/protogen/gen/ocis/services/policies/v0/policies.pb.go b/protogen/gen/ocis/services/policies/v0/policies.pb.go index fa2f474f92e..9e1fa83dacc 100644 --- a/protogen/gen/ocis/services/policies/v0/policies.pb.go +++ b/protogen/gen/ocis/services/policies/v0/policies.pb.go @@ -157,9 +157,9 @@ var file_ocis_services_policies_v0_policies_proto_rawDesc = []byte{ 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, - 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x2f, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x42, 0xe2, 0x02, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, + 0x01, 0x2a, 0x22, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x69, 0x65, 0x73, 0x2f, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x42, 0xe2, 0x02, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, diff --git a/protogen/gen/ocis/services/search/v0/search.pb.go b/protogen/gen/ocis/services/search/v0/search.pb.go index a72515d5a4f..3b7e21636fd 100644 --- a/protogen/gen/ocis/services/search/v0/search.pb.go +++ b/protogen/gen/ocis/services/search/v0/search.pb.go @@ -468,17 +468,17 @@ var file_ocis_services_search_v0_search_proto_rawDesc = []byte{ 0x1a, 0x27, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1a, 0x22, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x8c, 0x01, 0x0a, 0x0a, + 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2a, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x76, 0x30, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x76, 0x30, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2f, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x2d, 0x73, 0x70, 0x61, 0x63, 0x65, 0x3a, 0x01, 0x2a, 0x32, 0x9d, 0x01, 0x0a, 0x0d, 0x49, + 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x22, 0x1a, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x2d, 0x73, 0x70, 0x61, 0x63, 0x65, 0x32, 0x9d, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x8b, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x2b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x76, @@ -486,9 +486,9 @@ var file_ocis_services_search_v0_search_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x42, 0xdc, 0x02, 0x5a, 0x3c, 0x67, + 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2f, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x42, 0xdc, 0x02, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, diff --git a/protogen/gen/ocis/services/settings/v0/settings.pb.go b/protogen/gen/ocis/services/settings/v0/settings.pb.go index 711020a2984..1d035ab63af 100644 --- a/protogen/gen/ocis/services/settings/v0/settings.pb.go +++ b/protogen/gen/ocis/services/settings/v0/settings.pb.go @@ -1555,27 +1555,27 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2d, 0x73, 0x61, 0x76, - 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x8e, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, + 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2d, + 0x73, 0x61, 0x76, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x2b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2d, 0x67, - 0x65, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x96, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, + 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, 0x75, 0x6e, 0x64, 0x6c, + 0x65, 0x2d, 0x67, 0x65, 0x74, 0x12, 0x96, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x12, 0x2d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x22, 0x1d, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, - 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0xb2, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, + 0x1d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x2f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xb2, 0x01, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x34, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, @@ -1584,20 +1584,20 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, 0x24, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, 0x75, 0x6e, - 0x64, 0x6c, 0x65, 0x73, 0x2d, 0x61, 0x64, 0x64, 0x2d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x3a, 0x01, 0x2a, 0x12, 0xa0, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, + 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x22, 0x24, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, + 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x2d, 0x61, 0x64, 0x64, 0x2d, 0x73, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x12, 0xa0, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x39, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x22, 0x27, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x62, 0x75, 0x6e, - 0x64, 0x6c, 0x65, 0x73, 0x2d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x3a, 0x01, 0x2a, 0x32, 0x8d, 0x05, 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x74, 0x79, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x3a, 0x01, 0x2a, 0x22, 0x27, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, + 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x2d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x8d, 0x05, 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x09, 0x53, 0x61, 0x76, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, @@ -1605,27 +1605,27 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x2d, 0x73, 0x61, 0x76, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x8b, 0x01, 0x0a, 0x08, 0x47, 0x65, + 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x2d, 0x73, 0x61, 0x76, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x2d, 0x67, 0x65, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x92, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, + 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x2d, 0x67, 0x65, 0x74, 0x12, 0x92, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0xc7, 0x01, 0x0a, + 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xc7, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x79, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, @@ -1635,10 +1635,10 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, - 0x22, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2d, 0x67, 0x65, 0x74, 0x2d, 0x62, 0x79, - 0x2d, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x2d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x73, 0x3a, 0x01, 0x2a, 0x32, 0xe5, 0x06, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x65, 0x53, + 0x3a, 0x01, 0x2a, 0x22, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2d, 0x67, 0x65, 0x74, + 0x2d, 0x62, 0x79, 0x2d, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x2d, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x32, 0xe5, 0x06, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x92, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x2d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, @@ -1646,9 +1646,9 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x72, 0x6f, - 0x6c, 0x65, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0xb2, 0x01, 0x0a, 0x13, + 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xb2, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x35, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, @@ -1657,9 +1657,9 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x22, 0x21, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x61, 0x73, 0x73, - 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x01, 0x2a, + 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x3a, 0x01, 0x2a, 0x22, 0x21, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, + 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xcb, 0x01, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x12, 0x3d, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, @@ -1669,10 +1669,10 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x36, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x22, - 0x2a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x2f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x6c, 0x69, - 0x73, 0x74, 0x2d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0xa8, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x3a, + 0x01, 0x2a, 0x22, 0x2a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x2d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x12, 0xa8, 0x01, 0x0a, 0x10, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, @@ -1681,18 +1681,18 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x25, 0x22, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x2d, 0x61, 0x64, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x92, 0x01, 0x0a, 0x12, 0x52, 0x65, + 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, + 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x61, 0x64, 0x64, 0x12, 0x92, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x34, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2e, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, - 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x3a, 0x01, 0x2a, 0x32, 0xc3, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x01, 0x2a, 0x22, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x61, 0x73, 0x73, 0x69, + 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x32, 0xc3, 0x04, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa6, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, @@ -1702,9 +1702,9 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x22, 0x21, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0xd0, 0x01, + 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x3a, 0x01, 0x2a, 0x22, 0x21, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x70, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xd0, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3b, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, @@ -1714,10 +1714,10 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x22, 0x2d, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2d, 0x6c, 0x69, 0x73, - 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x01, 0x2a, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x3a, 0x01, + 0x2a, 0x22, 0x2d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2d, + 0x6c, 0x69, 0x73, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0xb1, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x49, 0x44, 0x12, 0x33, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, @@ -1726,10 +1726,10 @@ var file_ocis_services_settings_v0_settings_proto_rawDesc = []byte{ 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x22, 0x26, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x6d, - 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2d, 0x67, 0x65, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x69, - 0x64, 0x3a, 0x01, 0x2a, 0x42, 0xe3, 0x02, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x65, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x01, 0x2a, 0x22, 0x26, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x70, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2d, 0x67, 0x65, 0x74, 0x2d, 0x62, + 0x79, 0x2d, 0x69, 0x64, 0x42, 0xe3, 0x02, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x74, diff --git a/protogen/gen/ocis/services/settings/v0/settings.swagger.json b/protogen/gen/ocis/services/settings/v0/settings.swagger.json index 40c29232143..919d04de2a5 100644 --- a/protogen/gen/ocis/services/settings/v0/settings.swagger.json +++ b/protogen/gen/ocis/services/settings/v0/settings.swagger.json @@ -674,6 +674,10 @@ "listValue": { "$ref": "#/definitions/settingsv0ListValue", "title": "@gotags: yaml:\"list_value\"" + }, + "collectionValue": { + "$ref": "#/definitions/v0CollectionValue", + "title": "@gotags: yaml:\"collection_value\"" } } }, @@ -774,6 +778,41 @@ ], "default": "TYPE_UNKNOWN" }, + "v0CollectionOption": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "@gotags: yaml:\"key\"", + "title": "required" + }, + "intValue": { + "type": "string", + "format": "int64", + "title": "@gotags: yaml:\"int_value\"" + }, + "stringValue": { + "type": "string", + "title": "@gotags: yaml:\"string_value\"" + }, + "boolValue": { + "type": "boolean", + "title": "@gotags: yaml:\"bool_value\"" + } + } + }, + "v0CollectionValue": { + "type": "object", + "properties": { + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/v0CollectionOption" + }, + "title": "@gotags: yaml:\"values\"" + } + } + }, "v0GetBundleRequest": { "type": "object", "properties": { @@ -926,6 +965,10 @@ "type": "string", "format": "int64", "title": "@gotags: yaml:\"int_value\"" + }, + "boolValue": { + "type": "boolean", + "title": "@gotags: yaml:\"bool_value\"" } } }, @@ -1019,6 +1062,56 @@ } } }, + "v0MultiChoiceCollection": { + "type": "object", + "properties": { + "options": { + "type": "array", + "items": { + "$ref": "#/definitions/v0MultiChoiceCollectionOption" + }, + "title": "@gotags: yaml:\"options\"" + } + } + }, + "v0MultiChoiceCollectionOption": { + "type": "object", + "properties": { + "value": { + "$ref": "#/definitions/v0MultiChoiceCollectionOptionValue", + "title": "@gotags: yaml:\"value\"" + }, + "key": { + "type": "string", + "title": "@gotags: yaml:\"key\"" + }, + "attribute": { + "type": "string", + "title": "@gotags: yaml:\"attribute\"" + }, + "displayValue": { + "type": "string", + "title": "@gotags: yaml:\"display_value\"" + } + } + }, + "v0MultiChoiceCollectionOptionValue": { + "type": "object", + "properties": { + "intValue": { + "$ref": "#/definitions/v0Int", + "title": "@gotags: yaml:\"int_value\"" + }, + "stringValue": { + "$ref": "#/definitions/v0String", + "title": "@gotags: yaml:\"string_value\"" + }, + "boolValue": { + "$ref": "#/definitions/v0Bool", + "title": "@gotags: yaml:\"bool_value\"" + } + } + }, "v0MultiChoiceList": { "type": "object", "properties": { @@ -1178,6 +1271,10 @@ "$ref": "#/definitions/v0Permission", "title": "@gotags: yaml:\"permission_value\"" }, + "multiChoiceCollectionValue": { + "$ref": "#/definitions/v0MultiChoiceCollection", + "title": "@gotags: yaml:\"multi_choice_collection_value\"" + }, "resource": { "$ref": "#/definitions/v0Resource", "title": "@gotags: yaml:\"resource\"" diff --git a/protogen/gen/ocis/services/store/v0/store.pb.go b/protogen/gen/ocis/services/store/v0/store.pb.go new file mode 100644 index 00000000000..d38008316b5 --- /dev/null +++ b/protogen/gen/ocis/services/store/v0/store.pb.go @@ -0,0 +1,929 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: ocis/services/store/v0/store.proto + +package v0 + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/store/v0" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ReadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Options *v0.ReadOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *ReadRequest) Reset() { + *x = ReadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadRequest) ProtoMessage() {} + +func (x *ReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead. +func (*ReadRequest) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{0} +} + +func (x *ReadRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *ReadRequest) GetOptions() *v0.ReadOptions { + if x != nil { + return x.Options + } + return nil +} + +type ReadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Records []*v0.Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` +} + +func (x *ReadResponse) Reset() { + *x = ReadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadResponse) ProtoMessage() {} + +func (x *ReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead. +func (*ReadResponse) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{1} +} + +func (x *ReadResponse) GetRecords() []*v0.Record { + if x != nil { + return x.Records + } + return nil +} + +type WriteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Record *v0.Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` + Options *v0.WriteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *WriteRequest) Reset() { + *x = WriteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteRequest) ProtoMessage() {} + +func (x *WriteRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead. +func (*WriteRequest) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{2} +} + +func (x *WriteRequest) GetRecord() *v0.Record { + if x != nil { + return x.Record + } + return nil +} + +func (x *WriteRequest) GetOptions() *v0.WriteOptions { + if x != nil { + return x.Options + } + return nil +} + +type WriteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *WriteResponse) Reset() { + *x = WriteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteResponse) ProtoMessage() {} + +func (x *WriteResponse) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead. +func (*WriteResponse) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{3} +} + +type DeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Options *v0.DeleteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *DeleteRequest) GetOptions() *v0.DeleteOptions { + if x != nil { + return x.Options + } + return nil +} + +type DeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{5} +} + +type ListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Options *v0.ListOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *ListRequest) Reset() { + *x = ListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest) ProtoMessage() {} + +func (x *ListRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. +func (*ListRequest) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{6} +} + +func (x *ListRequest) GetOptions() *v0.ListOptions { + if x != nil { + return x.Options + } + return nil +} + +type ListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Keys []string `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` +} + +func (x *ListResponse) Reset() { + *x = ListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse) ProtoMessage() {} + +func (x *ListResponse) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. +func (*ListResponse) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{7} +} + +func (x *ListResponse) GetKeys() []string { + if x != nil { + return x.Keys + } + return nil +} + +type DatabasesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DatabasesRequest) Reset() { + *x = DatabasesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DatabasesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DatabasesRequest) ProtoMessage() {} + +func (x *DatabasesRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DatabasesRequest.ProtoReflect.Descriptor instead. +func (*DatabasesRequest) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{8} +} + +type DatabasesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Databases []string `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"` +} + +func (x *DatabasesResponse) Reset() { + *x = DatabasesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DatabasesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DatabasesResponse) ProtoMessage() {} + +func (x *DatabasesResponse) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DatabasesResponse.ProtoReflect.Descriptor instead. +func (*DatabasesResponse) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{9} +} + +func (x *DatabasesResponse) GetDatabases() []string { + if x != nil { + return x.Databases + } + return nil +} + +type TablesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"` +} + +func (x *TablesRequest) Reset() { + *x = TablesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TablesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TablesRequest) ProtoMessage() {} + +func (x *TablesRequest) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TablesRequest.ProtoReflect.Descriptor instead. +func (*TablesRequest) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{10} +} + +func (x *TablesRequest) GetDatabase() string { + if x != nil { + return x.Database + } + return "" +} + +type TablesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tables []string `protobuf:"bytes,1,rep,name=tables,proto3" json:"tables,omitempty"` +} + +func (x *TablesResponse) Reset() { + *x = TablesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TablesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TablesResponse) ProtoMessage() {} + +func (x *TablesResponse) ProtoReflect() protoreflect.Message { + mi := &file_ocis_services_store_v0_store_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TablesResponse.ProtoReflect.Descriptor instead. +func (*TablesResponse) Descriptor() ([]byte, []int) { + return file_ocis_services_store_v0_store_proto_rawDescGZIP(), []int{11} +} + +func (x *TablesResponse) GetTables() []string { + if x != nil { + return x.Tables + } + return nil +} + +var File_ocis_services_store_v0_store_proto protoreflect.FileDescriptor + +var file_ocis_services_store_v0_store_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x1a, 0x22, 0x6f, 0x63, + 0x69, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x5e, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x3d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0x48, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x38, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x0c, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x06, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x63, + 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, + 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0x0a, 0x0b, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x63, 0x69, + 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x28, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x4a, 0x04, 0x08, 0x01, + 0x10, 0x02, 0x22, 0x12, 0x0a, 0x10, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, + 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, + 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, + 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x0d, 0x54, 0x61, 0x62, + 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0x28, 0x0a, 0x0e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, + 0x32, 0xa5, 0x04, 0x0a, 0x05, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x53, 0x0a, 0x04, 0x52, 0x65, + 0x61, 0x64, 0x12, 0x23, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, + 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x56, 0x0a, 0x05, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, + 0x30, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x59, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x12, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, + 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x55, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x23, 0x2e, 0x6f, 0x63, 0x69, + 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x24, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x62, 0x0a, 0x09, 0x44, 0x61, 0x74, + 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, + 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x29, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, + 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x59, 0x0a, + 0x06, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, + 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, + 0x2e, 0x6f, 0x63, 0x69, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x30, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xd9, 0x02, 0x5a, 0x3b, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x30, 0x92, 0x41, 0x98, 0x02, 0x12, 0xb3, 0x01, 0x0a, + 0x1d, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69, + 0x74, 0x65, 0x20, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x47, + 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x20, 0x47, 0x6d, 0x62, 0x48, 0x12, + 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, + 0x73, 0x1a, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x40, 0x6f, 0x77, 0x6e, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x2a, 0x42, 0x0a, 0x0a, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2d, 0x32, 0x2e, 0x30, 0x12, 0x34, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x2f, 0x6f, 0x63, 0x69, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x73, + 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x05, 0x31, 0x2e, 0x30, + 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x38, 0x0a, 0x10, 0x44, 0x65, + 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x12, 0x24, + 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x6f, 0x77, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ocis_services_store_v0_store_proto_rawDescOnce sync.Once + file_ocis_services_store_v0_store_proto_rawDescData = file_ocis_services_store_v0_store_proto_rawDesc +) + +func file_ocis_services_store_v0_store_proto_rawDescGZIP() []byte { + file_ocis_services_store_v0_store_proto_rawDescOnce.Do(func() { + file_ocis_services_store_v0_store_proto_rawDescData = protoimpl.X.CompressGZIP(file_ocis_services_store_v0_store_proto_rawDescData) + }) + return file_ocis_services_store_v0_store_proto_rawDescData +} + +var file_ocis_services_store_v0_store_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_ocis_services_store_v0_store_proto_goTypes = []interface{}{ + (*ReadRequest)(nil), // 0: ocis.services.store.v0.ReadRequest + (*ReadResponse)(nil), // 1: ocis.services.store.v0.ReadResponse + (*WriteRequest)(nil), // 2: ocis.services.store.v0.WriteRequest + (*WriteResponse)(nil), // 3: ocis.services.store.v0.WriteResponse + (*DeleteRequest)(nil), // 4: ocis.services.store.v0.DeleteRequest + (*DeleteResponse)(nil), // 5: ocis.services.store.v0.DeleteResponse + (*ListRequest)(nil), // 6: ocis.services.store.v0.ListRequest + (*ListResponse)(nil), // 7: ocis.services.store.v0.ListResponse + (*DatabasesRequest)(nil), // 8: ocis.services.store.v0.DatabasesRequest + (*DatabasesResponse)(nil), // 9: ocis.services.store.v0.DatabasesResponse + (*TablesRequest)(nil), // 10: ocis.services.store.v0.TablesRequest + (*TablesResponse)(nil), // 11: ocis.services.store.v0.TablesResponse + (*v0.ReadOptions)(nil), // 12: ocis.messages.store.v0.ReadOptions + (*v0.Record)(nil), // 13: ocis.messages.store.v0.Record + (*v0.WriteOptions)(nil), // 14: ocis.messages.store.v0.WriteOptions + (*v0.DeleteOptions)(nil), // 15: ocis.messages.store.v0.DeleteOptions + (*v0.ListOptions)(nil), // 16: ocis.messages.store.v0.ListOptions +} +var file_ocis_services_store_v0_store_proto_depIdxs = []int32{ + 12, // 0: ocis.services.store.v0.ReadRequest.options:type_name -> ocis.messages.store.v0.ReadOptions + 13, // 1: ocis.services.store.v0.ReadResponse.records:type_name -> ocis.messages.store.v0.Record + 13, // 2: ocis.services.store.v0.WriteRequest.record:type_name -> ocis.messages.store.v0.Record + 14, // 3: ocis.services.store.v0.WriteRequest.options:type_name -> ocis.messages.store.v0.WriteOptions + 15, // 4: ocis.services.store.v0.DeleteRequest.options:type_name -> ocis.messages.store.v0.DeleteOptions + 16, // 5: ocis.services.store.v0.ListRequest.options:type_name -> ocis.messages.store.v0.ListOptions + 0, // 6: ocis.services.store.v0.Store.Read:input_type -> ocis.services.store.v0.ReadRequest + 2, // 7: ocis.services.store.v0.Store.Write:input_type -> ocis.services.store.v0.WriteRequest + 4, // 8: ocis.services.store.v0.Store.Delete:input_type -> ocis.services.store.v0.DeleteRequest + 6, // 9: ocis.services.store.v0.Store.List:input_type -> ocis.services.store.v0.ListRequest + 8, // 10: ocis.services.store.v0.Store.Databases:input_type -> ocis.services.store.v0.DatabasesRequest + 10, // 11: ocis.services.store.v0.Store.Tables:input_type -> ocis.services.store.v0.TablesRequest + 1, // 12: ocis.services.store.v0.Store.Read:output_type -> ocis.services.store.v0.ReadResponse + 3, // 13: ocis.services.store.v0.Store.Write:output_type -> ocis.services.store.v0.WriteResponse + 5, // 14: ocis.services.store.v0.Store.Delete:output_type -> ocis.services.store.v0.DeleteResponse + 7, // 15: ocis.services.store.v0.Store.List:output_type -> ocis.services.store.v0.ListResponse + 9, // 16: ocis.services.store.v0.Store.Databases:output_type -> ocis.services.store.v0.DatabasesResponse + 11, // 17: ocis.services.store.v0.Store.Tables:output_type -> ocis.services.store.v0.TablesResponse + 12, // [12:18] is the sub-list for method output_type + 6, // [6:12] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_ocis_services_store_v0_store_proto_init() } +func file_ocis_services_store_v0_store_proto_init() { + if File_ocis_services_store_v0_store_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ocis_services_store_v0_store_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DatabasesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DatabasesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TablesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ocis_services_store_v0_store_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TablesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ocis_services_store_v0_store_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_ocis_services_store_v0_store_proto_goTypes, + DependencyIndexes: file_ocis_services_store_v0_store_proto_depIdxs, + MessageInfos: file_ocis_services_store_v0_store_proto_msgTypes, + }.Build() + File_ocis_services_store_v0_store_proto = out.File + file_ocis_services_store_v0_store_proto_rawDesc = nil + file_ocis_services_store_v0_store_proto_goTypes = nil + file_ocis_services_store_v0_store_proto_depIdxs = nil +} diff --git a/protogen/gen/ocis/services/store/v0/store.pb.micro.go b/protogen/gen/ocis/services/store/v0/store.pb.micro.go new file mode 100644 index 00000000000..53121345666 --- /dev/null +++ b/protogen/gen/ocis/services/store/v0/store.pb.micro.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: ocis/services/store/v0/store.proto + +package v0 + +import ( + fmt "fmt" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/store/v0" + proto "google.golang.org/protobuf/proto" + math "math" +) + +import ( + context "context" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Reference imports to suppress errors if they are not otherwise used. +var _ api.Endpoint +var _ context.Context +var _ client.Option +var _ server.Option + +// Api Endpoints for Store service + +func NewStoreEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for Store service + +type StoreService interface { + Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) + Write(ctx context.Context, in *WriteRequest, opts ...client.CallOption) (*WriteResponse, error) + Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) + List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (Store_ListService, error) + Databases(ctx context.Context, in *DatabasesRequest, opts ...client.CallOption) (*DatabasesResponse, error) + Tables(ctx context.Context, in *TablesRequest, opts ...client.CallOption) (*TablesResponse, error) +} + +type storeService struct { + c client.Client + name string +} + +func NewStoreService(name string, c client.Client) StoreService { + return &storeService{ + c: c, + name: name, + } +} + +func (c *storeService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) { + req := c.c.NewRequest(c.name, "Store.Read", in) + out := new(ReadResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeService) Write(ctx context.Context, in *WriteRequest, opts ...client.CallOption) (*WriteResponse, error) { + req := c.c.NewRequest(c.name, "Store.Write", in) + out := new(WriteResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) { + req := c.c.NewRequest(c.name, "Store.Delete", in) + out := new(DeleteResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (Store_ListService, error) { + req := c.c.NewRequest(c.name, "Store.List", &ListRequest{}) + stream, err := c.c.Stream(ctx, req, opts...) + if err != nil { + return nil, err + } + if err := stream.Send(in); err != nil { + return nil, err + } + return &storeServiceList{stream}, nil +} + +type Store_ListService interface { + Context() context.Context + SendMsg(interface{}) error + RecvMsg(interface{}) error + CloseSend() error + Close() error + Recv() (*ListResponse, error) +} + +type storeServiceList struct { + stream client.Stream +} + +func (x *storeServiceList) CloseSend() error { + return x.stream.CloseSend() +} + +func (x *storeServiceList) Close() error { + return x.stream.Close() +} + +func (x *storeServiceList) Context() context.Context { + return x.stream.Context() +} + +func (x *storeServiceList) SendMsg(m interface{}) error { + return x.stream.Send(m) +} + +func (x *storeServiceList) RecvMsg(m interface{}) error { + return x.stream.Recv(m) +} + +func (x *storeServiceList) Recv() (*ListResponse, error) { + m := new(ListResponse) + err := x.stream.Recv(m) + if err != nil { + return nil, err + } + return m, nil +} + +func (c *storeService) Databases(ctx context.Context, in *DatabasesRequest, opts ...client.CallOption) (*DatabasesResponse, error) { + req := c.c.NewRequest(c.name, "Store.Databases", in) + out := new(DatabasesResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeService) Tables(ctx context.Context, in *TablesRequest, opts ...client.CallOption) (*TablesResponse, error) { + req := c.c.NewRequest(c.name, "Store.Tables", in) + out := new(TablesResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Store service + +type StoreHandler interface { + Read(context.Context, *ReadRequest, *ReadResponse) error + Write(context.Context, *WriteRequest, *WriteResponse) error + Delete(context.Context, *DeleteRequest, *DeleteResponse) error + List(context.Context, *ListRequest, Store_ListStream) error + Databases(context.Context, *DatabasesRequest, *DatabasesResponse) error + Tables(context.Context, *TablesRequest, *TablesResponse) error +} + +func RegisterStoreHandler(s server.Server, hdlr StoreHandler, opts ...server.HandlerOption) error { + type store interface { + Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error + Write(ctx context.Context, in *WriteRequest, out *WriteResponse) error + Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error + List(ctx context.Context, stream server.Stream) error + Databases(ctx context.Context, in *DatabasesRequest, out *DatabasesResponse) error + Tables(ctx context.Context, in *TablesRequest, out *TablesResponse) error + } + type Store struct { + store + } + h := &storeHandler{hdlr} + return s.Handle(s.NewHandler(&Store{h}, opts...)) +} + +type storeHandler struct { + StoreHandler +} + +func (h *storeHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error { + return h.StoreHandler.Read(ctx, in, out) +} + +func (h *storeHandler) Write(ctx context.Context, in *WriteRequest, out *WriteResponse) error { + return h.StoreHandler.Write(ctx, in, out) +} + +func (h *storeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error { + return h.StoreHandler.Delete(ctx, in, out) +} + +func (h *storeHandler) List(ctx context.Context, stream server.Stream) error { + m := new(ListRequest) + if err := stream.Recv(m); err != nil { + return err + } + return h.StoreHandler.List(ctx, m, &storeListStream{stream}) +} + +type Store_ListStream interface { + Context() context.Context + SendMsg(interface{}) error + RecvMsg(interface{}) error + Close() error + Send(*ListResponse) error +} + +type storeListStream struct { + stream server.Stream +} + +func (x *storeListStream) Close() error { + return x.stream.Close() +} + +func (x *storeListStream) Context() context.Context { + return x.stream.Context() +} + +func (x *storeListStream) SendMsg(m interface{}) error { + return x.stream.Send(m) +} + +func (x *storeListStream) RecvMsg(m interface{}) error { + return x.stream.Recv(m) +} + +func (x *storeListStream) Send(m *ListResponse) error { + return x.stream.Send(m) +} + +func (h *storeHandler) Databases(ctx context.Context, in *DatabasesRequest, out *DatabasesResponse) error { + return h.StoreHandler.Databases(ctx, in, out) +} + +func (h *storeHandler) Tables(ctx context.Context, in *TablesRequest, out *TablesResponse) error { + return h.StoreHandler.Tables(ctx, in, out) +} diff --git a/protogen/gen/ocis/services/store/v0/store.swagger.json b/protogen/gen/ocis/services/store/v0/store.swagger.json new file mode 100644 index 00000000000..21a5a67ab63 --- /dev/null +++ b/protogen/gen/ocis/services/store/v0/store.swagger.json @@ -0,0 +1,242 @@ +{ + "swagger": "2.0", + "info": { + "title": "ownCloud Infinite Scale store", + "version": "1.0.0", + "contact": { + "name": "ownCloud GmbH", + "url": "https://github.com/owncloud/ocis", + "email": "support@owncloud.com" + }, + "license": { + "name": "Apache-2.0", + "url": "https://github.com/owncloud/ocis/blob/master/LICENSE" + } + }, + "tags": [ + { + "name": "Store" + } + ], + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v0DatabasesResponse": { + "type": "object", + "properties": { + "databases": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v0DeleteOptions": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "table": { + "type": "string" + } + } + }, + "v0DeleteResponse": { + "type": "object" + }, + "v0Field": { + "type": "object", + "properties": { + "type": { + "type": "string", + "title": "type of value e.g string, int, int64, bool, float64" + }, + "value": { + "type": "string", + "title": "the actual value" + } + } + }, + "v0ListOptions": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "table": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "suffix": { + "type": "string" + }, + "limit": { + "type": "string", + "format": "uint64" + }, + "offset": { + "type": "string", + "format": "uint64" + } + } + }, + "v0ListResponse": { + "type": "object", + "properties": { + "keys": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v0ReadOptions": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "table": { + "type": "string" + }, + "prefix": { + "type": "boolean" + }, + "suffix": { + "type": "boolean" + }, + "limit": { + "type": "string", + "format": "uint64" + }, + "offset": { + "type": "string", + "format": "uint64" + }, + "where": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/v0Field" + } + } + } + }, + "v0ReadResponse": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/definitions/v0Record" + } + } + } + }, + "v0Record": { + "type": "object", + "properties": { + "key": { + "type": "string", + "title": "key of the recorda" + }, + "value": { + "type": "string", + "format": "byte", + "title": "value in the record" + }, + "expiry": { + "type": "string", + "format": "int64", + "title": "time.Duration (signed int64 nanoseconds)" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/v0Field" + }, + "title": "the associated metadata" + } + } + }, + "v0TablesResponse": { + "type": "object", + "properties": { + "tables": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v0WriteOptions": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "table": { + "type": "string" + }, + "expiry": { + "type": "string", + "format": "int64", + "title": "time.Time" + }, + "ttl": { + "type": "string", + "format": "int64", + "title": "time.Duration" + } + } + }, + "v0WriteResponse": { + "type": "object" + } + }, + "externalDocs": { + "description": "Developer Manual", + "url": "https://owncloud.dev/services/store/" + } +} diff --git a/protogen/proto/ocis/messages/settings/v0/settings.proto b/protogen/proto/ocis/messages/settings/v0/settings.proto index caa47d31750..483efb5ac3b 100644 --- a/protogen/proto/ocis/messages/settings/v0/settings.proto +++ b/protogen/proto/ocis/messages/settings/v0/settings.proto @@ -94,6 +94,7 @@ message Setting { SingleChoiceList single_choice_value = 8; // @gotags: yaml:"single_choice_value" MultiChoiceList multi_choice_value = 9; // @gotags: yaml:"multi_choice_value" Permission permission_value = 10; // @gotags: yaml:"permission_value" + MultiChoiceCollection multi_choice_collection_value = 12; // @gotags: yaml:"multi_choice_collection_value" } Resource resource = 11; // @gotags: yaml:"resource" } @@ -133,6 +134,25 @@ message ListOption { string display_value = 3; // @gotags: yaml:"display_value" } +message MultiChoiceCollection { + repeated MultiChoiceCollectionOption options = 1; // @gotags: yaml:"options" +} + +message MultiChoiceCollectionOption { + MultiChoiceCollectionOptionValue value = 1; // @gotags: yaml:"value" + string key = 2; // @gotags: yaml:"key" + string attribute = 3; // @gotags: yaml:"attribute" + string display_value = 4; // @gotags: yaml:"display_value" +} + +message MultiChoiceCollectionOptionValue { + oneof option { + Int int_value = 1; // @gotags: yaml:"int_value" + String string_value = 2; // @gotags: yaml:"string_value" + Bool bool_value = 3; // @gotags: yaml:"bool_value" + } +} + message Permission { enum Operation { OPERATION_UNKNOWN = 0; @@ -170,6 +190,7 @@ message Value { int64 int_value = 7; // @gotags: yaml:"int_value" string string_value = 8; // @gotags: yaml:"string_value" ListValue list_value = 9; // @gotags: yaml:"list_value" + CollectionValue collection_value = 10; // @gotags: yaml:"collection_value" } } @@ -181,5 +202,20 @@ message ListOptionValue { oneof option { string string_value = 1; // @gotags: yaml:"string_value" int64 int_value = 2; // @gotags: yaml:"int_value" + bool bool_value = 3; // @gotags: yaml:"bool_value" + } +} + +message CollectionValue { + repeated CollectionOption values = 1; // @gotags: yaml:"values" +} + +message CollectionOption { + // required + string key = 1; // @gotags: yaml:"key" + oneof option { + int64 int_value = 2; // @gotags: yaml:"int_value" + string string_value = 3; // @gotags: yaml:"string_value" + bool bool_value = 4; // @gotags: yaml:"bool_value" } } diff --git a/protogen/proto/ocis/services/settings/v0/settings.proto b/protogen/proto/ocis/services/settings/v0/settings.proto index 19f4e447501..3cf50a96070 100644 --- a/protogen/proto/ocis/services/settings/v0/settings.proto +++ b/protogen/proto/ocis/services/settings/v0/settings.proto @@ -168,6 +168,7 @@ message GetBundleResponse { message ListBundlesRequest { repeated string bundle_ids = 1; + string locale = 2; } message ListBundlesResponse { diff --git a/services/activitylog/pkg/service/l10n/locale/de/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/de/LC_MESSAGES/activitylog.po index 3a33f75dd5c..fb6e99b8a20 100644 --- a/services/activitylog/pkg/service/l10n/locale/de/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/de/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-30 00:18+0000\n" +"POT-Creation-Date: 2024-12-20 00:46+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Martin , 2024\n" "Language-Team: German (https://app.transifex.com/owncloud-org/teams/6149/de/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/activitylog.po index bcf727b02ee..2309b841723 100644 --- a/services/activitylog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-08 00:19+0000\n" +"POT-Creation-Date: 2024-12-29 00:04+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Andi Chandler , 2024\n" "Language-Team: English (United Kingdom) (https://app.transifex.com/owncloud-org/teams/6149/en_GB/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/es/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/es/LC_MESSAGES/activitylog.po index 2c2b25f794f..7cd77a5b1b8 100644 --- a/services/activitylog/pkg/service/l10n/locale/es/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/es/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-16 00:19+0000\n" +"POT-Creation-Date: 2025-01-06 00:03+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Jesús Recio , 2024\n" "Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/ja_JP/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/ja_JP/LC_MESSAGES/activitylog.po index 31adea21fea..144bc5796a1 100644 --- a/services/activitylog/pkg/service/l10n/locale/ja_JP/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/ja_JP/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-12 00:51+0000\n" +"POT-Creation-Date: 2025-01-02 00:05+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: hoshi1800 , 2024\n" "Language-Team: Japanese (Japan) (https://app.transifex.com/owncloud-org/teams/6149/ja_JP/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/activitylog.po index ffe8084bcc4..903ee9ba0b0 100644 --- a/services/activitylog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/activitylog.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-14 00:17+0000\n" +"POT-Creation-Date: 2025-01-04 00:05+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Flávio Veras , 2024\n" "Language-Team: Portuguese (Brazil) (https://app.transifex.com/owncloud-org/teams/6149/pt_BR/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/ru/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/ru/LC_MESSAGES/activitylog.po index 122669e6160..5e8820e0698 100644 --- a/services/activitylog/pkg/service/l10n/locale/ru/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/ru/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-28 00:19+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Viktor Scharf, 2024\n" "Language-Team: Russian (https://app.transifex.com/owncloud-org/teams/6149/ru/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/sq/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/sq/LC_MESSAGES/activitylog.po index abc241868b0..0909a9d6829 100644 --- a/services/activitylog/pkg/service/l10n/locale/sq/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/sq/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-29 00:18+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Besnik Bleta , 2024\n" "Language-Team: Albanian (https://app.transifex.com/owncloud-org/teams/6149/sq/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/ug/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/ug/LC_MESSAGES/activitylog.po index 181cb314c0e..b78c4803154 100644 --- a/services/activitylog/pkg/service/l10n/locale/ug/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/ug/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-15 00:43+0000\n" +"POT-Creation-Date: 2025-01-05 00:05+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Keram, 2024\n" "Language-Team: Uyghur (https://app.transifex.com/owncloud-org/teams/6149/ug/)\n" diff --git a/services/activitylog/pkg/service/l10n/locale/uk/LC_MESSAGES/activitylog.po b/services/activitylog/pkg/service/l10n/locale/uk/LC_MESSAGES/activitylog.po index ece0e957d14..38a06620c39 100644 --- a/services/activitylog/pkg/service/l10n/locale/uk/LC_MESSAGES/activitylog.po +++ b/services/activitylog/pkg/service/l10n/locale/uk/LC_MESSAGES/activitylog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-14 00:17+0000\n" +"POT-Creation-Date: 2025-01-04 00:05+0000\n" "PO-Revision-Date: 2024-08-20 10:13+0000\n" "Last-Translator: Roman Perekhod, 2024\n" "Language-Team: Ukrainian (https://app.transifex.com/owncloud-org/teams/6149/uk/)\n" diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 7eda98ef3cd..b4e3c721f26 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -58,6 +58,8 @@ type Config struct { PasswordPolicy PasswordPolicy `yaml:"password_policy"` + ConfigurableNotifications bool `yaml:"configurable_notifications" env:"FRONTEND_CONFIGURABLE_NOTIFICATIONS" desc:"Allow configuring notifications via web client." introductionVersion:"7.1"` + Context context.Context `yaml:"-"` } diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index e58a93c2522..3cd7ad87add 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -333,7 +333,8 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string }, "password_policy": passwordPolicyCfg, "notifications": map[string]interface{}{ - "endpoints": []string{"list", "get", "delete"}, + "endpoints": []string{"list", "get", "delete"}, + "configurable": cfg.ConfigurableNotifications, }, }, "version": map[string]interface{}{ diff --git a/services/graph/pkg/l10n/locale/de/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/de/LC_MESSAGES/graph.po index 6000fd57720..0d1b110cbdd 100644 --- a/services/graph/pkg/l10n/locale/de/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/de/LC_MESSAGES/graph.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-16 00:19+0000\n" +"POT-Creation-Date: 2025-01-06 00:03+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Michael Barz , 2024\n" "Language-Team: German (https://app.transifex.com/owncloud-org/teams/6149/de/)\n" diff --git a/services/graph/pkg/l10n/locale/en_GB/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/en_GB/LC_MESSAGES/graph.po index 4df81c5790d..103da546410 100644 --- a/services/graph/pkg/l10n/locale/en_GB/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/en_GB/LC_MESSAGES/graph.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-30 00:18+0000\n" +"POT-Creation-Date: 2024-12-20 00:46+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Andi Chandler , 2024\n" "Language-Team: English (United Kingdom) (https://app.transifex.com/owncloud-org/teams/6149/en_GB/)\n" diff --git a/services/graph/pkg/l10n/locale/es/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/es/LC_MESSAGES/graph.po index b9997b5096f..2c03b55aea1 100644 --- a/services/graph/pkg/l10n/locale/es/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/es/LC_MESSAGES/graph.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-30 00:18+0000\n" +"POT-Creation-Date: 2024-12-20 00:46+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Juan Carlos Garrote, 2024\n" "Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n" diff --git a/services/graph/pkg/l10n/locale/pt_BR/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/pt_BR/LC_MESSAGES/graph.po index f2288b09568..67bfae38941 100644 --- a/services/graph/pkg/l10n/locale/pt_BR/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/pt_BR/LC_MESSAGES/graph.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-29 00:18+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Allan Antoni, 2024\n" "Language-Team: Portuguese (Brazil) (https://app.transifex.com/owncloud-org/teams/6149/pt_BR/)\n" diff --git a/services/graph/pkg/l10n/locale/ru/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/ru/LC_MESSAGES/graph.po index fe109235d54..7074a346be1 100644 --- a/services/graph/pkg/l10n/locale/ru/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/ru/LC_MESSAGES/graph.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-29 00:18+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Viktor Scharf, 2024\n" "Language-Team: Russian (https://app.transifex.com/owncloud-org/teams/6149/ru/)\n" diff --git a/services/graph/pkg/l10n/locale/sq/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/sq/LC_MESSAGES/graph.po index e82be7c9e6f..d43a50c69da 100644 --- a/services/graph/pkg/l10n/locale/sq/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/sq/LC_MESSAGES/graph.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-27 00:20+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Besnik Bleta , 2024\n" "Language-Team: Albanian (https://app.transifex.com/owncloud-org/teams/6149/sq/)\n" diff --git a/services/graph/pkg/l10n/locale/ug/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/ug/LC_MESSAGES/graph.po index c79cabeb65c..10bf26ffcce 100644 --- a/services/graph/pkg/l10n/locale/ug/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/ug/LC_MESSAGES/graph.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-16 00:19+0000\n" +"POT-Creation-Date: 2025-01-06 00:03+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Keram, 2024\n" "Language-Team: Uyghur (https://app.transifex.com/owncloud-org/teams/6149/ug/)\n" diff --git a/services/graph/pkg/l10n/locale/uk/LC_MESSAGES/graph.po b/services/graph/pkg/l10n/locale/uk/LC_MESSAGES/graph.po index 4c633d1f057..5f46514d8f4 100644 --- a/services/graph/pkg/l10n/locale/uk/LC_MESSAGES/graph.po +++ b/services/graph/pkg/l10n/locale/uk/LC_MESSAGES/graph.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-16 00:19+0000\n" +"POT-Creation-Date: 2025-01-06 00:03+0000\n" "PO-Revision-Date: 2024-04-04 00:17+0000\n" "Last-Translator: Roman Perekhod, 2024\n" "Language-Team: Ukrainian (https://app.transifex.com/owncloud-org/teams/6149/uk/)\n" diff --git a/services/graph/pkg/service/v0/api_driveitem_permissions.go b/services/graph/pkg/service/v0/api_driveitem_permissions.go index eda3999dfb9..9cb643cb325 100644 --- a/services/graph/pkg/service/v0/api_driveitem_permissions.go +++ b/services/graph/pkg/service/v0/api_driveitem_permissions.go @@ -143,6 +143,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto var shareid string var expiration *types.Timestamp + var cTime *types.Timestamp switch driveRecipient.GetLibreGraphRecipientType() { case "group": group, err := s.identityCache.GetGroup(ctx, objectID) @@ -166,6 +167,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto return libregraph.Permission{}, err } shareid = createShareResponse.GetShare().GetId().GetOpaqueId() + cTime = createShareResponse.GetShare().GetCtime() expiration = createShareResponse.GetShare().GetExpiration() default: user, err := s.identityCache.GetUser(ctx, objectID) @@ -209,6 +211,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto return libregraph.Permission{}, err } shareid = createShareResponse.GetShare().GetId().GetOpaqueId() + cTime = createShareResponse.GetShare().GetCtime() expiration = createShareResponse.GetShare().GetExpiration() } else { createShareRequest := createShareRequestToUser(user, statResponse.GetInfo(), cs3ResourcePermissions) @@ -221,6 +224,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto return libregraph.Permission{}, err } shareid = createShareResponse.GetShare().GetId().GetOpaqueId() + cTime = createShareResponse.GetShare().GetCtime() expiration = createShareResponse.GetShare().GetExpiration() } @@ -238,6 +242,11 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto permission.SetExpirationDateTime(utils.TSToTime(expiration)) } + // set cTime + if cTime != nil { + permission.SetCreatedDateTime(cs3TimestampToTime(cTime)) + } + if user, ok := revactx.ContextGetUser(ctx); ok { identity, err := userIdToIdentity(ctx, s.identityCache, user.GetId().GetOpaqueId()) if err != nil { diff --git a/services/notifications/pkg/email/l10n/locale/ca/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/ca/LC_MESSAGES/notifications.po index a468fa8c684..92e5a507c18 100644 --- a/services/notifications/pkg/email/l10n/locale/ca/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/ca/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Arnau Morancho, 2023\n" "Language-Team: Catalan (https://app.transifex.com/owncloud-org/teams/6149/ca/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/de/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/de/LC_MESSAGES/notifications.po index 46eb69f72bd..31aa2db1edc 100644 --- a/services/notifications/pkg/email/l10n/locale/de/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/de/LC_MESSAGES/notifications.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Martin , 2024\n" "Language-Team: German (https://app.transifex.com/owncloud-org/teams/6149/de/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/de_DE/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/de_DE/LC_MESSAGES/notifications.po index c354aae45bd..42c352f9c8a 100644 --- a/services/notifications/pkg/email/l10n/locale/de_DE/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/de_DE/LC_MESSAGES/notifications.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Michael Barz , 2023\n" "Language-Team: German (Germany) (https://app.transifex.com/owncloud-org/teams/6149/de_DE/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/en_GB/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/en_GB/LC_MESSAGES/notifications.po index 784182eda6f..79f3ad6f111 100644 --- a/services/notifications/pkg/email/l10n/locale/en_GB/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/en_GB/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-08 00:19+0000\n" +"POT-Creation-Date: 2024-12-29 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Andi Chandler , 2024\n" "Language-Team: English (United Kingdom) (https://app.transifex.com/owncloud-org/teams/6149/en_GB/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/es/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/es/LC_MESSAGES/notifications.po index b94cbd1d261..1203472062a 100644 --- a/services/notifications/pkg/email/l10n/locale/es/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/es/LC_MESSAGES/notifications.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-16 00:19+0000\n" +"POT-Creation-Date: 2025-01-06 00:03+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Jesús Recio , 2024\n" "Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/ja_JP/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/ja_JP/LC_MESSAGES/notifications.po index 20c30109754..cae2dbf1eed 100644 --- a/services/notifications/pkg/email/l10n/locale/ja_JP/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/ja_JP/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: hoshi1800 , 2024\n" "Language-Team: Japanese (Japan) (https://app.transifex.com/owncloud-org/teams/6149/ja_JP/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/ko/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/ko/LC_MESSAGES/notifications.po index 1f68fb6afbe..a2d5aa43ddf 100644 --- a/services/notifications/pkg/email/l10n/locale/ko/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/ko/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Hugo Blackwood, 2023\n" "Language-Team: Korean (https://app.transifex.com/owncloud-org/teams/6149/ko/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/pt_BR/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/pt_BR/LC_MESSAGES/notifications.po index 7165a0f7695..6171b5cd5df 100644 --- a/services/notifications/pkg/email/l10n/locale/pt_BR/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/pt_BR/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Flávio Veras , 2024\n" "Language-Team: Portuguese (Brazil) (https://app.transifex.com/owncloud-org/teams/6149/pt_BR/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/ru/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/ru/LC_MESSAGES/notifications.po index 77f403b9f7d..66056a33a27 100644 --- a/services/notifications/pkg/email/l10n/locale/ru/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/ru/LC_MESSAGES/notifications.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-28 00:19+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Viktor Scharf, 2024\n" "Language-Team: Russian (https://app.transifex.com/owncloud-org/teams/6149/ru/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/ru_RU/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/ru_RU/LC_MESSAGES/notifications.po index 8a10c9c9f89..111e9b24d01 100644 --- a/services/notifications/pkg/email/l10n/locale/ru_RU/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/ru_RU/LC_MESSAGES/notifications.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: dutty5, 2024\n" "Language-Team: Russian (Russia) (https://app.transifex.com/owncloud-org/teams/6149/ru_RU/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/sq/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/sq/LC_MESSAGES/notifications.po index 3a004430a25..b0f426794bb 100644 --- a/services/notifications/pkg/email/l10n/locale/sq/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/sq/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-11-28 00:19+0000\n" +"POT-Creation-Date: 2025-01-08 04:19+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Besnik Bleta , 2024\n" "Language-Team: Albanian (https://app.transifex.com/owncloud-org/teams/6149/sq/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/tr/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/tr/LC_MESSAGES/notifications.po index 717f63e1bd3..12a5c3ce9ba 100644 --- a/services/notifications/pkg/email/l10n/locale/tr/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/tr/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Begüm Topyıldız , 2023\n" "Language-Team: Turkish (https://app.transifex.com/owncloud-org/teams/6149/tr/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/ug/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/ug/LC_MESSAGES/notifications.po index 8f3919b5b7a..0fe062e4c9c 100644 --- a/services/notifications/pkg/email/l10n/locale/ug/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/ug/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-15 00:43+0000\n" +"POT-Creation-Date: 2025-01-05 00:05+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Keram, 2024\n" "Language-Team: Uyghur (https://app.transifex.com/owncloud-org/teams/6149/ug/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/uk/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/uk/LC_MESSAGES/notifications.po index a455aa5f5cb..11fd328942e 100644 --- a/services/notifications/pkg/email/l10n/locale/uk/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/uk/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-06 00:18+0000\n" +"POT-Creation-Date: 2024-12-27 00:05+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Roman Perekhod, 2024\n" "Language-Team: Ukrainian (https://app.transifex.com/owncloud-org/teams/6149/uk/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/zh-Hans/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/zh-Hans/LC_MESSAGES/notifications.po index 1a5a3b95ec9..ab2025f974e 100644 --- a/services/notifications/pkg/email/l10n/locale/zh-Hans/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/zh-Hans/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Shouyuan, 2023\n" "Language-Team: Chinese Simplified (https://app.transifex.com/owncloud-org/teams/6149/zh-Hans/)\n" diff --git a/services/notifications/pkg/email/l10n/locale/zh_CN/LC_MESSAGES/notifications.po b/services/notifications/pkg/email/l10n/locale/zh_CN/LC_MESSAGES/notifications.po index 22709ba6c71..42c9d40bb47 100644 --- a/services/notifications/pkg/email/l10n/locale/zh_CN/LC_MESSAGES/notifications.po +++ b/services/notifications/pkg/email/l10n/locale/zh_CN/LC_MESSAGES/notifications.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-11 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:04+0000\n" "PO-Revision-Date: 2023-04-19 11:11+0000\n" "Last-Translator: Shouyuan, 2023\n" "Language-Team: Chinese (China) (https://app.transifex.com/owncloud-org/teams/6149/zh_CN/)\n" diff --git a/services/notifications/pkg/service/filter.go b/services/notifications/pkg/service/filter.go new file mode 100644 index 00000000000..cde3fd19a87 --- /dev/null +++ b/services/notifications/pkg/service/filter.go @@ -0,0 +1,61 @@ +package service + +import ( + "context" + "errors" + user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/owncloud/ocis/v2/ocis-pkg/log" + "github.com/owncloud/ocis/v2/ocis-pkg/middleware" + settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" + micrometadata "go-micro.dev/v4/metadata" +) + +type notificationFilter struct { + log log.Logger + valueClient settingssvc.ValueService +} + +func newNotificationFilter(l log.Logger, vc settingssvc.ValueService) *notificationFilter { + return ¬ificationFilter{log: l, valueClient: vc} +} + +// execute removes users who have disabled mail notifications for the event +func (nf notificationFilter) execute(ctx context.Context, users []*user.User, settingId string) []*user.User { + var filteredUsers []*user.User + + for _, u := range users { + userId := u.GetId().GetOpaqueId() + enabled, err := getSetting(ctx, nf.valueClient, userId, settingId) + if err != nil { + nf.log.Error().Err(err).Str("userId", userId).Str("settingId", settingId).Msg("cannot get user event setting") + continue + } + if enabled { + filteredUsers = append(filteredUsers, u) + } + } + + return filteredUsers +} + +func getSetting(ctx context.Context, vc settingssvc.ValueService, userId string, settingId string) (bool, error) { + resp, err := vc.GetValueByUniqueIdentifiers( + micrometadata.Set(ctx, middleware.AccountID, userId), + &settingssvc.GetValueByUniqueIdentifiersRequest{ + AccountUuid: userId, + SettingId: settingId, + }, + ) + + if err != nil { + return false, err + } + + val := resp.GetValue().GetValue().GetCollectionValue().GetValues() + for _, option := range val { + if option.GetKey() == "mail" { + return option.GetBoolValue(), nil + } + } + return false, errors.New("no setting found") +} diff --git a/services/notifications/pkg/service/filter_test.go b/services/notifications/pkg/service/filter_test.go new file mode 100644 index 00000000000..c910ead6691 --- /dev/null +++ b/services/notifications/pkg/service/filter_test.go @@ -0,0 +1,79 @@ +package service + +import ( + "context" + user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/owncloud/ocis/v2/ocis-pkg/log" + settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" + settings "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "go-micro.dev/v4/client" + "testing" +) + +var testLogger = log.NewLogger() + +func TestNotificationFilter_execute(t *testing.T) { + type args struct { + ctx context.Context + users []*user.User + settingId string + } + tests := []struct { + name string + vc settings.ValueService + args args + want []*user.User + }{ + {"no connection to ValueService", settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return nil, errors.New("no connection to ValueService") + }, + }, args{users: []*user.User{{Id: &user.UserId{OpaqueId: "foo"}}}, settingId: "bar", ctx: context.TODO()}, []*user.User(nil)}, + {"no setting in ValueService response", settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return &settings.GetValueResponse{}, nil + }, + }, args{users: []*user.User{{Id: &user.UserId{OpaqueId: "foo"}}}, settingId: "bar", ctx: context.TODO()}, []*user.User(nil)}, + {"ValueService nil response", settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return nil, nil + }, + }, args{users: []*user.User{{Id: &user.UserId{OpaqueId: "foo"}}}, settingId: "bar", ctx: context.TODO()}, []*user.User(nil)}, + {"Event enabled", setupMockValueService(true), args{users: []*user.User{{Id: &user.UserId{OpaqueId: "foo"}}}, settingId: "bar", ctx: context.TODO()}, []*user.User{{Id: &user.UserId{OpaqueId: "foo"}}}}, + {"Event disabled", setupMockValueService(false), args{users: []*user.User{{Id: &user.UserId{OpaqueId: "foo"}}}, settingId: "bar", ctx: context.TODO()}, []*user.User(nil)}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ulf := notificationFilter{ + log: testLogger, + valueClient: tt.vc, + } + assert.Equal(t, tt.want, ulf.execute(tt.args.ctx, tt.args.users, tt.args.settingId)) + }) + } +} + +func setupMockValueService(mail bool) settings.ValueService { + return settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return &settings.GetValueResponse{ + Value: &settingsmsg.ValueWithIdentifier{ + Value: &settingsmsg.Value{ + Value: &settingsmsg.Value_CollectionValue{ + CollectionValue: &settingsmsg.CollectionValue{ + Values: []*settingsmsg.CollectionOption{ + { + Key: "mail", + Option: &settingsmsg.CollectionOption_BoolValue{BoolValue: mail}, + }, + }, + }, + }, + }, + }, + }, nil + }, + } +} diff --git a/services/notifications/pkg/service/service.go b/services/notifications/pkg/service/service.go index 6eadebe54de..4016249e9a1 100644 --- a/services/notifications/pkg/service/service.go +++ b/services/notifications/pkg/service/service.go @@ -65,6 +65,7 @@ func NewEventsNotifier( defaultLanguage: defaultLanguage, ocisURL: ocisURL, translationPath: translationPath, + filter: newNotificationFilter(logger, valueService), } } @@ -81,6 +82,7 @@ type eventsNotifier struct { ocisURL string serviceAccountID string serviceAccountSecret string + filter *notificationFilter } func (s eventsNotifier) Run() error { diff --git a/services/notifications/pkg/service/service_test.go b/services/notifications/pkg/service/service_test.go index abed14f9969..e2ab94e1328 100644 --- a/services/notifications/pkg/service/service_test.go +++ b/services/notifications/pkg/service/service_test.go @@ -2,6 +2,7 @@ package service_test import ( "context" + settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" "time" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" @@ -68,7 +69,22 @@ var _ = Describe("Notifications", func() { gatewayClient.On("Stat", mock.Anything, mock.Anything).Return(&provider.StatResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}, Info: &provider.ResourceInfo{Name: "secrets of the board", Space: &provider.StorageSpace{Name: "secret space"}}}, nil) vs = &settingssvc.MockValueService{} vs.GetValueByUniqueIdentifiersFunc = func(ctx context.Context, req *settingssvc.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settingssvc.GetValueResponse, error) { - return nil, nil + return &settingssvc.GetValueResponse{ + Value: &settingsmsg.ValueWithIdentifier{ + Value: &settingsmsg.Value{ + Value: &settingsmsg.Value_CollectionValue{ + CollectionValue: &settingsmsg.CollectionValue{ + Values: []*settingsmsg.CollectionOption{ + { + Key: "mail", + Option: &settingsmsg.CollectionOption_BoolValue{BoolValue: true}, + }, + }, + }, + }, + }, + }, + }, nil } }) @@ -266,7 +282,22 @@ var _ = Describe("Notifications X-Site Scripting", func() { }, nil) vs = &settingssvc.MockValueService{} vs.GetValueByUniqueIdentifiersFunc = func(ctx context.Context, req *settingssvc.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settingssvc.GetValueResponse, error) { - return nil, nil + return &settingssvc.GetValueResponse{ + Value: &settingsmsg.ValueWithIdentifier{ + Value: &settingsmsg.Value{ + Value: &settingsmsg.Value_CollectionValue{ + CollectionValue: &settingsmsg.CollectionValue{ + Values: []*settingsmsg.CollectionOption{ + { + Key: "mail", + Option: &settingsmsg.CollectionOption_BoolValue{BoolValue: true}, + }, + }, + }, + }, + }, + }, + }, nil } }) diff --git a/services/notifications/pkg/service/shares.go b/services/notifications/pkg/service/shares.go index 58ec8bec54f..1413b3e0496 100644 --- a/services/notifications/pkg/service/shares.go +++ b/services/notifications/pkg/service/shares.go @@ -4,6 +4,7 @@ import ( "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/utils" "github.com/owncloud/ocis/v2/services/notifications/pkg/email" + "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults" "google.golang.org/protobuf/types/known/fieldmaskpb" ) @@ -48,7 +49,8 @@ func (s eventsNotifier) handleShareCreated(e events.ShareCreated) { } granteeList := s.ensureGranteeList(ctx, owner.GetId(), e.GranteeUserID, e.GranteeGroupID) - if granteeList == nil { + filteredGrantees := s.filter.execute(ctx, granteeList, defaults.SettingUUIDProfileEventShareCreated) + if filteredGrantees == nil { return } @@ -59,7 +61,7 @@ func (s eventsNotifier) handleShareCreated(e events.ShareCreated) { "ShareSharer": sharerDisplayName, "ShareFolder": resourceInfo.Name, "ShareLink": shareLink, - }, granteeList, sharerDisplayName) + }, filteredGrantees, sharerDisplayName) if err != nil { s.logger.Error().Err(err).Str("event", "ShareCreated").Msg("could not get render the email") return @@ -100,7 +102,8 @@ func (s eventsNotifier) handleShareExpired(e events.ShareExpired) { } granteeList := s.ensureGranteeList(ctx, owner.GetId(), e.GranteeUserID, e.GranteeGroupID) - if granteeList == nil { + filteredGrantees := s.filter.execute(ctx, granteeList, defaults.SettingUUIDProfileEventShareExpired) + if filteredGrantees == nil { return } @@ -109,7 +112,7 @@ func (s eventsNotifier) handleShareExpired(e events.ShareExpired) { map[string]string{ "ShareFolder": resourceInfo.GetName(), "ExpiredAt": e.ExpiredAt.Format("2006-01-02 15:04:05"), - }, granteeList, owner.GetDisplayName()) + }, filteredGrantees, owner.GetDisplayName()) if err != nil { s.logger.Error().Err(err).Str("event", "ShareExpired").Msg("could not get render the email") return diff --git a/services/notifications/pkg/service/spaces.go b/services/notifications/pkg/service/spaces.go index 32ed5bacc07..5f1b4c827ca 100644 --- a/services/notifications/pkg/service/spaces.go +++ b/services/notifications/pkg/service/spaces.go @@ -5,6 +5,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storagespace" "github.com/cs3org/reva/v2/pkg/utils" "github.com/owncloud/ocis/v2/services/notifications/pkg/email" + "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults" ) func (s eventsNotifier) handleSpaceShared(e events.SpaceShared) { @@ -63,7 +64,8 @@ func (s eventsNotifier) handleSpaceShared(e events.SpaceShared) { // the Grantees of the shares. Ideally the notfication service would use some kind of service // user for this. granteeList := s.ensureGranteeList(ctx, executant.GetId(), e.GranteeUserID, e.GranteeGroupID) - if granteeList == nil { + filteredGrantees := s.filter.execute(ctx, granteeList, defaults.SettingUUIDProfileEventSpaceShared) + if filteredGrantees == nil { return } @@ -74,7 +76,7 @@ func (s eventsNotifier) handleSpaceShared(e events.SpaceShared) { "SpaceSharer": sharerDisplayName, "SpaceName": resourceInfo.GetSpace().GetName(), "ShareLink": shareLink, - }, granteeList, sharerDisplayName) + }, filteredGrantees, sharerDisplayName) if err != nil { s.logger.Error().Err(err).Str("event", "SharedSpace").Msg("could not get render the email") return @@ -136,7 +138,8 @@ func (s eventsNotifier) handleSpaceUnshared(e events.SpaceUnshared) { // the Grantees of the shares. Ideally the notfication service would use some kind of service // user for this. granteeList := s.ensureGranteeList(ctx, executant.GetId(), e.GranteeUserID, e.GranteeGroupID) - if granteeList == nil { + filteredGrantees := s.filter.execute(ctx, granteeList, defaults.SettingUUIDProfileEventSpaceUnshared) + if filteredGrantees == nil { return } @@ -147,7 +150,7 @@ func (s eventsNotifier) handleSpaceUnshared(e events.SpaceUnshared) { "SpaceSharer": sharerDisplayName, "SpaceName": resourceInfo.GetSpace().Name, "ShareLink": shareLink, - }, granteeList, sharerDisplayName) + }, filteredGrantees, sharerDisplayName) if err != nil { s.logger.Error().Err(err).Str("event", "UnsharedSpace").Msg("Could not get render the email") return @@ -185,13 +188,17 @@ func (s eventsNotifier) handleSpaceMembershipExpired(e events.SpaceMembershipExp if granteeList == nil { return } + filteredGrantees := s.filter.execute(ctx, granteeList, defaults.SettingUUIDProfileEventSpaceMembershipExpired) + if filteredGrantees == nil { + return + } recipientList, err := s.render(ctx, email.MembershipExpired, "SpaceGrantee", map[string]string{ "SpaceName": e.SpaceName, "ExpiredAt": e.ExpiredAt.Format("2006-01-02 15:04:05"), - }, granteeList, owner.GetDisplayName()) + }, filteredGrantees, owner.GetDisplayName()) if err != nil { s.logger.Error().Err(err).Str("event", "SpaceUnshared").Msg("could not get render the email") return diff --git a/services/settings/Makefile b/services/settings/Makefile index f426f34a640..1d6046e351c 100644 --- a/services/settings/Makefile +++ b/services/settings/Makefile @@ -1,6 +1,10 @@ SHELL := bash NAME := settings +# Where to write the files generated by this makefile. +OUTPUT_DIR = ./pkg/service/v0/l10n +TEMPLATE_FILE = ./pkg/service/v0/l10n/settings.pot + include ../../.make/recursion.mk ############ tooling ############ @@ -45,3 +49,25 @@ ci-node-check-licenses: .PHONY: ci-node-save-licenses ci-node-save-licenses: + +############ translations ######## +.PHONY: l10n-pull +l10n-pull: + cd $(OUTPUT_DIR) && tx pull --all --force --skip --minimum-perc=75 + +.PHONY: l10n-push +l10n-push: + cd $(OUTPUT_DIR) && tx push -s --skip + +.PHONY: l10n-read +l10n-read: $(GO_XGETTEXT) + go-xgettext -o $(OUTPUT_DIR)/settings.pot \ + --keyword=l10n.Template --add-comments -s \ + pkg/store/defaults/templates.go + +.PHONY: l10n-write +l10n-write: + +.PHONY: l10n-clean +l10n-clean: + rm -f $(TEMPLATE_FILE); diff --git a/services/settings/README.md b/services/settings/README.md index 122441ea148..621845a9bcc 100644 --- a/services/settings/README.md +++ b/services/settings/README.md @@ -64,6 +64,28 @@ Services can set or query Infinite Scale *setting values* of a user from setting The settings service needs to know the IDs of service accounts but it doesn't need their secrets. They can be configured using the `SETTINGS_SERVICE_ACCOUNTS_IDS` envvar. When only using one service account `OCIS_SERVICE_ACCOUNT_ID` can also be used. All configured service accounts will get a hidden 'service-account' role. This role contains all permissions the service account needs but will not appear calls to the list roles endpoint. It is not possible to assign the 'service-account' role to a normal user. +## Translations + +The `settings` service has embedded translations sourced via transifex to provide a basic set of translated languages. These embedded translations are available for all deployment scenarios. In addition, the service supports custom translations, though it is currently not possible to just add custom translations to embedded ones. If custom translations are configured, the embedded ones are not used. To configure custom translations, the `SETTINGS_TRANSLATION_PATH` environment variable needs to point to a base folder that will contain the translation files. This path must be available from all instances of the userlog service, a shared storage is recommended. Translation files must be of type [.po](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files) or [.mo](https://www.gnu.org/software/gettext/manual/html_node/Binaries.html). For each language, the filename needs to be `settings.po` (or `settings.mo`) and stored in a folder structure defining the language code. In general the path/name pattern for a translation file needs to be: + +```text +{SETTINGS_TRANSLATION_PATH}/{language-code}/LC_MESSAGES/settings.po +``` + +The language code pattern is composed of `language[_territory]` where `language` is the base language and `_territory` is optional and defines a country. + +For example, for the language `de`, one needs to place the corresponding translation files to `{SETTINGS_TRANSLATION_PATH}/de_DE/LC_MESSAGES/settings.po`. + + + +Important: For the time being, the embedded ownCloud Web frontend only supports the main language code but does not handle any territory. When strings are available in the language code `language_territory`, the web frontend does not see it as it only requests `language`. In consequence, any translations made must exist in the requested `language` to avoid a fallback to the default. + +### Translation Rules + +* If a requested language code is not available, the service tries to fall back to the base language if available. For example, if the requested language-code `de_DE` is not available, the service tries to fall back to translations in the `de` folder. +* If the base language `de` is also not available, the service falls back to the system's default English (`en`), +which is the source of the texts provided by the code. + ## Default Language The default language can be defined via the `OCIS_DEFAULT_LANGUAGE` environment variable. If this variable is not defined, English will be used as default. The value has the ISO 639-1 format ("de", "en", etc.) and is limited by the list supported languages. This setting can be used to set the default language for notification and invitation emails. diff --git a/services/settings/pkg/config/config.go b/services/settings/pkg/config/config.go index 6126e854ebf..a85f8eb1604 100644 --- a/services/settings/pkg/config/config.go +++ b/services/settings/pkg/config/config.go @@ -38,6 +38,7 @@ type Config struct { ServiceAccountIDs []string `yaml:"service_account_ids" env:"SETTINGS_SERVICE_ACCOUNT_IDS;OCIS_SERVICE_ACCOUNT_ID" desc:"The list of all service account IDs. These will be assigned the hidden 'service-account' role. Note: When using 'OCIS_SERVICE_ACCOUNT_ID' this will contain only one value while 'SETTINGS_SERVICE_ACCOUNT_IDS' can have multiple. See the 'auth-service' service description for more details about service accounts." introductionVersion:"5.0"` DefaultLanguage string `yaml:"default_language" env:"OCIS_DEFAULT_LANGUAGE" desc:"The default language used by services and the WebUI. If not defined, English will be used as default. See the documentation for more details." introductionVersion:"5.0"` + TranslationPath string `yaml:"translation_path" env:"OCIS_TRANSLATION_PATH;SETTINGS_TRANSLATION_PATH" desc:"(optional) Set this to a path with custom translations to overwrite the builtin translations. Note that file and folder naming rules apply, see the documentation for more details." introductionVersion:"7.1"` Context context.Context `yaml:"-"` } diff --git a/services/settings/pkg/service/v0/l10n/.tx/config b/services/settings/pkg/service/v0/l10n/.tx/config new file mode 100644 index 00000000000..e03a69ea22f --- /dev/null +++ b/services/settings/pkg/service/v0/l10n/.tx/config @@ -0,0 +1,10 @@ +[main] +host = https://www.transifex.com + +[o:owncloud-org:p:owncloud:r:ocis-settings] +file_filter = locale//LC_MESSAGES/settings.po +minimum_perc = 75 +resource_name = ocis-settings +source_file = settings.pot +source_lang = en +type = PO diff --git a/services/settings/pkg/service/v0/l10n/locale/en/LC_MESSAGES/settings.po b/services/settings/pkg/service/v0/l10n/locale/en/LC_MESSAGES/settings.po new file mode 100644 index 00000000000..e69de29bb2d diff --git a/services/settings/pkg/service/v0/service.go b/services/settings/pkg/service/v0/service.go index 97ffea318b9..cc53fabda8a 100644 --- a/services/settings/pkg/service/v0/service.go +++ b/services/settings/pkg/service/v0/service.go @@ -2,13 +2,17 @@ package svc import ( "context" + "embed" "errors" "fmt" "strings" cs3permissions "github.com/cs3org/go-cs3apis/cs3/permissions/v1beta1" rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" + ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/rgrpc/status" + "github.com/leonelquinteros/gotext" + "github.com/owncloud/ocis/v2/ocis-pkg/l10n" "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/ocis-pkg/middleware" "github.com/owncloud/ocis/v2/ocis-pkg/roles" @@ -23,6 +27,11 @@ import ( "google.golang.org/protobuf/types/known/emptypb" ) +//go:embed l10n/locale +var _translationFS embed.FS + +var _domain = "settings" + // Service represents a service. type Service struct { id string @@ -46,14 +55,14 @@ func NewService(cfg *config.Config, logger log.Logger) settings.ServiceHandler { // CheckPermission implements the CS3 API Permssions service. // It's used to check if a subject (user or group) has a permission. func (g Service) CheckPermission(ctx context.Context, req *cs3permissions.CheckPermissionRequest) (*cs3permissions.CheckPermissionResponse, error) { - spec := req.SubjectRef.Spec + spec := req.GetSubjectRef().GetSpec() var accountID string switch ref := spec.(type) { case *cs3permissions.SubjectReference_UserId: - accountID = ref.UserId.OpaqueId + accountID = ref.UserId.GetOpaqueId() case *cs3permissions.SubjectReference_GroupId: - accountID = ref.GroupId.OpaqueId + accountID = ref.GroupId.GetOpaqueId() } assignments, err := g.manager.ListRoleAssignments(accountID) @@ -65,10 +74,10 @@ func (g Service) CheckPermission(ctx context.Context, req *cs3permissions.CheckP roleIDs := make([]string, 0, len(assignments)) for _, a := range assignments { - roleIDs = append(roleIDs, a.RoleId) + roleIDs = append(roleIDs, a.GetRoleId()) } - permission, err := g.manager.ReadPermissionByName(req.Permission, roleIDs) + permission, err := g.manager.ReadPermissionByName(req.GetPermission(), roleIDs) if err != nil { if !errors.Is(err, settings.ErrNotFound) { return &cs3permissions.CheckPermissionResponse{ @@ -94,15 +103,15 @@ func (g Service) CheckPermission(ctx context.Context, req *cs3permissions.CheckP // SaveBundle implements the BundleServiceHandler interface func (g Service) SaveBundle(ctx context.Context, req *settingssvc.SaveBundleRequest, res *settingssvc.SaveBundleResponse) error { - cleanUpResource(ctx, req.Bundle.Resource) - if err := g.checkStaticPermissionsByBundleType(ctx, req.Bundle.Type); err != nil { + cleanUpResource(ctx, req.GetBundle().GetResource()) + if err := g.checkStaticPermissionsByBundleType(ctx, req.GetBundle().GetType()); err != nil { return err } if validationError := validateSaveBundle(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - r, err := g.manager.WriteBundle(req.Bundle) + r, err := g.manager.WriteBundle(req.GetBundle()) if err != nil { return merrors.BadRequest(g.id, "%s", err) } @@ -115,13 +124,13 @@ func (g Service) GetBundle(ctx context.Context, req *settingssvc.GetBundleReques if validationError := validateGetBundle(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - bundle, err := g.manager.ReadBundle(req.BundleId) + bundle, err := g.manager.ReadBundle(req.GetBundleId()) if err != nil { return merrors.NotFound(g.id, "%s", err) } filteredBundle := g.getFilteredBundle(g.getRoleIDs(ctx), bundle) - if len(filteredBundle.Settings) == 0 { - err = fmt.Errorf("could not read bundle: %s", req.BundleId) + if len(filteredBundle.GetSettings()) == 0 { + err = fmt.Errorf("could not read bundle: %s", req.GetBundleId()) return merrors.NotFound(g.id, "%s", err) } res.Bundle = filteredBundle @@ -134,18 +143,29 @@ func (g Service) ListBundles(ctx context.Context, req *settingssvc.ListBundlesRe if validationError := validateListBundles(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - bundles, err := g.manager.ListBundles(settingsmsg.Bundle_TYPE_DEFAULT, req.BundleIds) + bundles, err := g.manager.ListBundles(settingsmsg.Bundle_TYPE_DEFAULT, req.GetBundleIds()) if err != nil { return merrors.NotFound(g.id, "%s", err) } roleIDs := g.getRoleIDs(ctx) + // find user locale + var locale string + if u, ok := ctxpkg.ContextGetUser(ctx); ok { + var err error + locale, err = g.getUserLocale(ctx, u.GetId().GetOpaqueId()) + if err != nil { + g.logger.Error().Err(err).Str("userid", u.GetId().GetOpaqueId()).Msg("failed to get user locale") + } + } + // filter settings in bundles that are allowed according to roles var filteredBundles []*settingsmsg.Bundle for _, bundle := range bundles { filteredBundle := g.getFilteredBundle(roleIDs, bundle) - if len(filteredBundle.Settings) > 0 { - filteredBundles = append(filteredBundles, filteredBundle) + if len(filteredBundle.GetSettings()) > 0 { + t := l10n.NewTranslatorFromCommonConfig(g.config.DefaultLanguage, _domain, g.config.TranslationPath, _translationFS, "l10n/locale").Locale(locale) + filteredBundles = append(filteredBundles, translateBundle(filteredBundle, t)) } } @@ -157,7 +177,7 @@ func (g Service) getFilteredBundle(roleIDs []string, bundle *settingsmsg.Bundle) // check if full bundle is whitelisted bundleResource := &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_BUNDLE, - Id: bundle.Id, + Id: bundle.GetId(), } if g.hasPermission( roleIDs, @@ -170,10 +190,10 @@ func (g Service) getFilteredBundle(roleIDs []string, bundle *settingsmsg.Bundle) // filter settings based on permissions var filteredSettings []*settingsmsg.Setting - for _, setting := range bundle.Settings { + for _, setting := range bundle.GetSettings() { settingResource := &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SETTING, - Id: setting.Id, + Id: setting.GetId(), } if g.hasPermission( roleIDs, @@ -190,15 +210,15 @@ func (g Service) getFilteredBundle(roleIDs []string, bundle *settingsmsg.Bundle) // AddSettingToBundle implements the BundleServiceHandler interface func (g Service) AddSettingToBundle(ctx context.Context, req *settingssvc.AddSettingToBundleRequest, res *settingssvc.AddSettingToBundleResponse) error { - cleanUpResource(ctx, req.Setting.Resource) - if err := g.checkStaticPermissionsByBundleID(ctx, req.BundleId); err != nil { + cleanUpResource(ctx, req.GetSetting().GetResource()) + if err := g.checkStaticPermissionsByBundleID(ctx, req.GetBundleId()); err != nil { return err } if validationError := validateAddSettingToBundle(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - r, err := g.manager.AddSettingToBundle(req.BundleId, req.Setting) + r, err := g.manager.AddSettingToBundle(req.GetBundleId(), req.GetSetting()) if err != nil { return merrors.BadRequest(g.id, "%s", err) } @@ -208,14 +228,14 @@ func (g Service) AddSettingToBundle(ctx context.Context, req *settingssvc.AddSet // RemoveSettingFromBundle implements the BundleServiceHandler interface func (g Service) RemoveSettingFromBundle(ctx context.Context, req *settingssvc.RemoveSettingFromBundleRequest, _ *emptypb.Empty) error { - if err := g.checkStaticPermissionsByBundleID(ctx, req.BundleId); err != nil { + if err := g.checkStaticPermissionsByBundleID(ctx, req.GetBundleId()); err != nil { return err } if validationError := validateRemoveSettingFromBundle(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - if err := g.manager.RemoveSettingFromBundle(req.BundleId, req.SettingId); err != nil { + if err := g.manager.RemoveSettingFromBundle(req.GetBundleId(), req.GetSettingId()); err != nil { return merrors.BadRequest(g.id, "%s", err) } @@ -224,17 +244,17 @@ func (g Service) RemoveSettingFromBundle(ctx context.Context, req *settingssvc.R // SaveValue implements the ValueServiceHandler interface func (g Service) SaveValue(ctx context.Context, req *settingssvc.SaveValueRequest, res *settingssvc.SaveValueResponse) error { - req.Value.AccountUuid = getValidatedAccountUUID(ctx, req.Value.AccountUuid) - if !g.isCurrentUser(ctx, req.Value.AccountUuid) { + req.Value.AccountUuid = getValidatedAccountUUID(ctx, req.GetValue().GetAccountUuid()) + if !g.isCurrentUser(ctx, req.GetValue().GetAccountUuid()) { return merrors.Forbidden(g.id, "can't save value for another user") } - cleanUpResource(ctx, req.Value.Resource) + cleanUpResource(ctx, req.GetValue().GetResource()) // TODO: we need to check, if the authenticated user has permission to write the value for the specified resource (e.g. global, file with id xy, ...) if validationError := validateSaveValue(req); validationError != nil { return merrors.BadRequest(g.id, validationError.Error()) } - r, err := g.manager.WriteValue(req.Value) + r, err := g.manager.WriteValue(req.GetValue()) if err != nil { return merrors.BadRequest(g.id, err.Error()) } @@ -247,11 +267,11 @@ func (g Service) SaveValue(ctx context.Context, req *settingssvc.SaveValueReques } // GetValue implements the ValueServiceHandler interface -func (g Service) GetValue(ctx context.Context, req *settingssvc.GetValueRequest, res *settingssvc.GetValueResponse) error { +func (g Service) GetValue(_ context.Context, req *settingssvc.GetValueRequest, res *settingssvc.GetValueResponse) error { if validationError := validateGetValue(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - r, err := g.manager.ReadValue(req.Id) + r, err := g.manager.ReadValue(req.GetId()) if err != nil { return merrors.NotFound(g.id, "%s", err) } @@ -265,19 +285,19 @@ func (g Service) GetValue(ctx context.Context, req *settingssvc.GetValueRequest, // GetValueByUniqueIdentifiers implements the ValueService interface func (g Service) GetValueByUniqueIdentifiers(ctx context.Context, req *settingssvc.GetValueByUniqueIdentifiersRequest, res *settingssvc.GetValueResponse) error { - req.AccountUuid = getValidatedAccountUUID(ctx, req.AccountUuid) - if !g.isCurrentUser(ctx, req.AccountUuid) { + req.AccountUuid = getValidatedAccountUUID(ctx, req.GetAccountUuid()) + if !g.isCurrentUser(ctx, req.GetAccountUuid()) { return merrors.Forbidden(g.id, "can't get value of another user") } if validationError := validateGetValueByUniqueIdentifiers(req); validationError != nil { return merrors.BadRequest(g.id, validationError.Error()) } - v, err := g.manager.ReadValueByUniqueIdentifiers(req.AccountUuid, req.SettingId) + v, err := g.manager.ReadValueByUniqueIdentifiers(req.GetAccountUuid(), req.GetSettingId()) if err != nil { return merrors.NotFound(g.id, err.Error()) } - if v.BundleId != "" { + if v.GetBundleId() != "" { valueWithIdentifier, err := g.getValueWithIdentifier(v) if err != nil { return merrors.NotFound(g.id, err.Error()) @@ -290,15 +310,15 @@ func (g Service) GetValueByUniqueIdentifiers(ctx context.Context, req *settingss // ListValues implements the ValueServiceHandler interface func (g Service) ListValues(ctx context.Context, req *settingssvc.ListValuesRequest, res *settingssvc.ListValuesResponse) error { - req.AccountUuid = getValidatedAccountUUID(ctx, req.AccountUuid) - if !g.isCurrentUser(ctx, req.AccountUuid) { + req.AccountUuid = getValidatedAccountUUID(ctx, req.GetAccountUuid()) + if !g.isCurrentUser(ctx, req.GetAccountUuid()) { return merrors.Forbidden(g.id, "can't list values of another user") } if validationError := validateListValues(req); validationError != nil { return merrors.BadRequest(g.id, validationError.Error()) } - values, err := g.manager.ListValues(req.BundleId, req.AccountUuid) + values, err := g.manager.ListValues(req.GetBundleId(), req.GetAccountUuid()) if err != nil { return merrors.NotFound(g.id, err.Error()) } @@ -314,12 +334,12 @@ func (g Service) ListValues(ctx context.Context, req *settingssvc.ListValuesRequ } // ListRoles implements the RoleServiceHandler interface -func (g Service) ListRoles(c context.Context, req *settingssvc.ListBundlesRequest, res *settingssvc.ListBundlesResponse) error { +func (g Service) ListRoles(_ context.Context, req *settingssvc.ListBundlesRequest, res *settingssvc.ListBundlesResponse) error { //accountUUID := getValidatedAccountUUID(c, "me") if validationError := validateListRoles(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - r, err := g.manager.ListBundles(settingsmsg.Bundle_TYPE_ROLE, req.BundleIds) + r, err := g.manager.ListBundles(settingsmsg.Bundle_TYPE_ROLE, req.GetBundleIds()) if err != nil { return merrors.NotFound(g.id, "%s", err) } @@ -330,11 +350,11 @@ func (g Service) ListRoles(c context.Context, req *settingssvc.ListBundlesReques // ListRoleAssignments implements the RoleServiceHandler interface func (g Service) ListRoleAssignments(ctx context.Context, req *settingssvc.ListRoleAssignmentsRequest, res *settingssvc.ListRoleAssignmentsResponse) error { - req.AccountUuid = getValidatedAccountUUID(ctx, req.AccountUuid) + req.AccountUuid = getValidatedAccountUUID(ctx, req.GetAccountUuid()) if validationError := validateListRoleAssignments(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - r, err := g.manager.ListRoleAssignments(req.AccountUuid) + r, err := g.manager.ListRoleAssignments(req.GetAccountUuid()) if err != nil { return merrors.NotFound(g.id, "%s", err) } @@ -342,6 +362,7 @@ func (g Service) ListRoleAssignments(ctx context.Context, req *settingssvc.ListR return nil } +// ListRoleAssignmentsFiltered implements the RoleServiceHandler interface. Who made this up? And why is everyone copying it? So this methods lists role assignments filtered by account or role. func (g Service) ListRoleAssignmentsFiltered(ctx context.Context, req *settingssvc.ListRoleAssignmentsFilteredRequest, res *settingssvc.ListRoleAssignmentsResponse) error { if validationError := validateListRoleAssignmentsFiltered(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) @@ -367,7 +388,7 @@ func (g Service) ListRoleAssignmentsFiltered(ctx context.Context, req *settingss // AssignRoleToUser implements the RoleServiceHandler interface func (g Service) AssignRoleToUser(ctx context.Context, req *settingssvc.AssignRoleToUserRequest, res *settingssvc.AssignRoleToUserResponse) error { - req.AccountUuid = getValidatedAccountUUID(ctx, req.AccountUuid) + req.AccountUuid = getValidatedAccountUUID(ctx, req.GetAccountUuid()) if validationError := validateAssignRoleToUser(req); validationError != nil { return merrors.BadRequest(g.id, validationError.Error()) } @@ -379,13 +400,13 @@ func (g Service) AssignRoleToUser(ctx context.Context, req *settingssvc.AssignRo } switch { - case ownAccountUUID == req.AccountUuid: + case ownAccountUUID == req.GetAccountUuid(): // Allow users to assign themself to the user or user light role // deny any other attempt to change the user's own assignment - if r, err := g.manager.ListRoleAssignments(req.AccountUuid); err == nil && len(r) > 0 { + if r, err := g.manager.ListRoleAssignments(req.GetAccountUuid()); err == nil && len(r) > 0 { return merrors.Forbidden(g.id, "Changing own role assignment forbidden") } - if req.RoleId != defaults.BundleUUIDRoleUser && req.RoleId != defaults.BundleUUIDRoleUserLight { + if req.GetRoleId() != defaults.BundleUUIDRoleUser && req.GetRoleId() != defaults.BundleUUIDRoleUserLight { return merrors.Forbidden(g.id, "Changing own role assignment forbidden") } g.logger.Debug().Str("userid", ownAccountUUID).Msg("Self-assignment for default 'user' role permitted") @@ -394,7 +415,7 @@ func (g Service) AssignRoleToUser(ctx context.Context, req *settingssvc.AssignRo return merrors.Forbidden(g.id, "user has no role management permission") } - r, err := g.manager.WriteRoleAssignment(req.AccountUuid, req.RoleId) + r, err := g.manager.WriteRoleAssignment(req.GetAccountUuid(), req.GetRoleId()) if err != nil { return merrors.BadRequest(g.id, err.Error()) } @@ -425,13 +446,13 @@ func (g Service) RemoveRoleFromUser(ctx context.Context, req *settingssvc.Remove } for _, a := range al { - if a.Id == req.Id { + if a.GetId() == req.GetId() { g.logger.Debug().Str("id", g.id).Msg("Removing own role assignment forbidden") return merrors.Forbidden(g.id, "Removing own role assignment forbidden") } } - if err := g.manager.RemoveRoleAssignment(req.Id); err != nil { + if err := g.manager.RemoveRoleAssignment(req.GetId()); err != nil { return merrors.BadRequest(g.id, err.Error()) } return nil @@ -445,11 +466,11 @@ func (g Service) ListPermissions(ctx context.Context, req *settingssvc.ListPermi return merrors.InternalServerError(g.id, "user not in context") } - if ownAccountUUID != req.AccountUuid { - return merrors.NotFound(g.id, "user not found: %s", req.AccountUuid) + if ownAccountUUID != req.GetAccountUuid() { + return merrors.NotFound(g.id, "user not found: %s", req.GetAccountUuid()) } - assignments, err := g.manager.ListRoleAssignments(req.AccountUuid) + assignments, err := g.manager.ListRoleAssignments(req.GetAccountUuid()) if err != nil { return err } @@ -457,7 +478,7 @@ func (g Service) ListPermissions(ctx context.Context, req *settingssvc.ListPermi // deduplicate role ids roleIDs := map[string]struct{}{} for _, a := range assignments { - roleIDs[a.RoleId] = struct{}{} + roleIDs[a.GetRoleId()] = struct{}{} } // deduplicate permission names @@ -491,7 +512,7 @@ func (g Service) ListPermissionsByResource(ctx context.Context, req *settingssvc if validationError := validateListPermissionsByResource(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - permissions, err := g.manager.ListPermissionsByResource(req.Resource, g.getRoleIDs(ctx)) + permissions, err := g.manager.ListPermissionsByResource(req.GetResource(), g.getRoleIDs(ctx)) if err != nil { return merrors.BadRequest(g.id, "%s", err) } @@ -504,12 +525,12 @@ func (g Service) GetPermissionByID(ctx context.Context, req *settingssvc.GetPerm if validationError := validateGetPermissionByID(req); validationError != nil { return merrors.BadRequest(g.id, "%s", validationError) } - permission, err := g.manager.ReadPermissionByID(req.PermissionId, g.getRoleIDs(ctx)) + permission, err := g.manager.ReadPermissionByID(req.GetPermissionId(), g.getRoleIDs(ctx)) if err != nil { return merrors.BadRequest(g.id, "%s", err) } if permission == nil { - return merrors.NotFound(g.id, "%s", fmt.Errorf("permission %s not found in roles", req.PermissionId)) + return merrors.NotFound(g.id, "%s", fmt.Errorf("permission %s not found in roles", req.GetPermissionId())) } res.Permission = permission return nil @@ -517,8 +538,8 @@ func (g Service) GetPermissionByID(ctx context.Context, req *settingssvc.GetPerm // cleanUpResource makes sure that the account uuid of the authenticated user is injected if needed. func cleanUpResource(ctx context.Context, resource *settingsmsg.Resource) { - if resource != nil && resource.Type == settingsmsg.Resource_TYPE_USER { - resource.Id = getValidatedAccountUUID(ctx, resource.Id) + if resource != nil && resource.GetType() == settingsmsg.Resource_TYPE_USER { + resource.Id = getValidatedAccountUUID(ctx, resource.GetId()) } } @@ -551,7 +572,7 @@ func (g Service) getRoleIDs(ctx context.Context) []string { ownRoleIDs := make([]string, 0, len(assignments)) for _, a := range assignments { - ownRoleIDs = append(ownRoleIDs, a.RoleId) + ownRoleIDs = append(ownRoleIDs, a.GetRoleId()) } return ownRoleIDs } @@ -560,19 +581,19 @@ func (g Service) getRoleIDs(ctx context.Context) []string { } func (g Service) getValueWithIdentifier(value *settingsmsg.Value) (*settingsmsg.ValueWithIdentifier, error) { - bundle, err := g.manager.ReadBundle(value.BundleId) + bundle, err := g.manager.ReadBundle(value.GetBundleId()) if err != nil { return nil, err } - setting, err := g.manager.ReadSetting(value.SettingId) + setting, err := g.manager.ReadSetting(value.GetSettingId()) if err != nil { return nil, err } return &settingsmsg.ValueWithIdentifier{ Identifier: &settingsmsg.Identifier{ - Extension: bundle.Extension, - Bundle: bundle.Name, - Setting: setting.Name, + Extension: bundle.GetExtension(), + Bundle: bundle.GetName(), + Setting: setting.GetName(), }, Value: value, }, nil @@ -596,12 +617,12 @@ func (g Service) hasStaticPermission(ctx context.Context, permissionID string) b } // deduplicate roleids - uniqueRoleIds := make(map[string]struct{}) + uniqueRoleIDs := make(map[string]struct{}) for _, a := range assignments { - uniqueRoleIds[a.GetRoleId()] = struct{}{} + uniqueRoleIDs[a.GetRoleId()] = struct{}{} } - roleIDs = make([]string, 0, len(uniqueRoleIds)) - for a := range uniqueRoleIds { + roleIDs = make([]string, 0, len(uniqueRoleIDs)) + for a := range uniqueRoleIDs { roleIDs = append(roleIDs, a) } } @@ -614,7 +635,7 @@ func (g Service) checkStaticPermissionsByBundleID(ctx context.Context, bundleID if err != nil { return merrors.NotFound(g.id, "bundle not found: %s", err) } - return g.checkStaticPermissionsByBundleType(ctx, bundle.Type) + return g.checkStaticPermissionsByBundleType(ctx, bundle.GetType()) } func (g Service) checkStaticPermissionsByBundleType(ctx context.Context, bundleType settingsmsg.Bundle_Type) error { @@ -642,7 +663,58 @@ func (g Service) canManageRoles(ctx context.Context) bool { return g.hasStaticPermission(ctx, RoleManagementPermissionID) } +func (g Service) getUserLocale(ctx context.Context, userID string) (string, error) { + var resp settingssvc.GetValueResponse + err := g.GetValueByUniqueIdentifiers( + ctx, + &settingssvc.GetValueByUniqueIdentifiersRequest{ + AccountUuid: userID, + SettingId: defaults.SettingUUIDProfileLanguage, + }, + &resp, + ) + if err != nil { + return "", err + } + val := resp.GetValue().GetValue().GetListValue().GetValues() + if len(val) == 0 { + return "", errors.New("no language setting found") + } + return val[0].GetStringValue(), nil +} + func formatPermissionName(setting *settingsmsg.Setting) string { constraint := strings.TrimPrefix(setting.GetPermissionValue().GetConstraint().String(), "CONSTRAINT_") - return setting.Name + "." + strings.ToLower(constraint) + return setting.GetName() + "." + strings.ToLower(constraint) +} + +func translateBundle(bundle *settingsmsg.Bundle, t *gotext.Locale) *settingsmsg.Bundle { + for i, set := range bundle.GetSettings() { + switch set.GetId() { + default: + continue + case defaults.SettingUUIDProfileEmailSendingInterval: + // translate interval names ('Instant', 'Daily', 'Weekly', 'Never') + value := set.GetSingleChoiceValue() + for i, v := range value.GetOptions() { + value.Options[i].DisplayValue = t.Get(v.GetDisplayValue()) + } + set.Value = &settingsmsg.Setting_SingleChoiceValue{SingleChoiceValue: value} + fallthrough + case defaults.SettingUUIDProfileEventShareCreated, + defaults.SettingUUIDProfileEventShareRemoved, + defaults.SettingUUIDProfileEventShareExpired, + defaults.SettingUUIDProfileEventSpaceShared, + defaults.SettingUUIDProfileEventSpaceUnshared, + defaults.SettingUUIDProfileEventSpaceMembershipExpired, + defaults.SettingUUIDProfileEventSpaceDisabled, + defaults.SettingUUIDProfileEventSpaceDeleted: + // translate event names ('Share Received', 'Share Removed', ...) + set.DisplayName = t.Get(set.GetDisplayName()) + // translate event descriptions ('Notify me when I receive a share', ...) + set.Description = t.Get(set.GetDescription()) + bundle.Settings[i] = set + } + } + return bundle } diff --git a/services/settings/pkg/service/v0/servicedecorator.go b/services/settings/pkg/service/v0/servicedecorator.go index c8a5f9e0123..33ccfd5b59b 100644 --- a/services/settings/pkg/service/v0/servicedecorator.go +++ b/services/settings/pkg/service/v0/servicedecorator.go @@ -31,9 +31,13 @@ type defaultLanguageDecorator struct { func (s *defaultLanguageDecorator) GetValueByUniqueIdentifiers(ctx context.Context, req *settingssvc.GetValueByUniqueIdentifiersRequest, res *settingssvc.GetValueResponse) error { err := s.ServiceHandler.GetValueByUniqueIdentifiers(ctx, req, res) if err != nil { - if strings.Contains(strings.ToLower(err.Error()), "not found") && req.GetSettingId() == defaults.SettingUUIDProfileLanguage && res.GetValue() == nil { - res.Value = s.withDefaultLanguageSetting(req.AccountUuid) - return nil + if strings.Contains(strings.ToLower(err.Error()), "not found") && res.GetValue() == nil { + defaultValueList := getDefaultValueList() + // Ensure the default values for profile settings + if _, ok := defaultValueList[req.GetSettingId()]; ok { + res.Value = s.withDefaultProfileValue(ctx, req.AccountUuid, req.GetSettingId()) + return nil + } } return err } @@ -46,13 +50,21 @@ func (s *defaultLanguageDecorator) ListValues(ctx context.Context, req *settings if err != nil { return err } + defaultValueList := getDefaultValueList() for _, v := range res.Values { - if v.GetValue().GetSettingId() == defaults.SettingUUIDProfileLanguage { - return nil + delete(defaultValueList, v.GetValue().GetSettingId()) + } + + // Ensure the default values for profile settings + defaultValueList = s.withDefaultProfileValueList(ctx, req.AccountUuid, defaultValueList) + if len(defaultValueList) > 0 { + for _, v := range defaultValueList { + if v != nil { + res.Values = append(res.Values, v) + } } } - res.Values = append(res.Values, s.withDefaultLanguageSetting(req.AccountUuid)) return nil } @@ -82,3 +94,93 @@ func (s *defaultLanguageDecorator) withDefaultLanguageSetting(accountUUID string }, } } + +func (s *defaultLanguageDecorator) withDefaultProfileValue(ctx context.Context, accountUUID string, settingId string) *settingsmsg.ValueWithIdentifier { + if settingId == defaults.SettingUUIDProfileLanguage { + return s.withDefaultLanguageSetting(accountUUID) + } + res := s.withDefaultProfileValueList(ctx, accountUUID, map[string]*settingsmsg.ValueWithIdentifier{settingId: nil}) + if v, ok := res[settingId]; ok { + return v + } + return nil +} + +func (s *defaultLanguageDecorator) withDefaultProfileValueList(ctx context.Context, + accountUUID string, requested map[string]*settingsmsg.ValueWithIdentifier) map[string]*settingsmsg.ValueWithIdentifier { + + // we use the default profile bundle instead of s.GetBundle(ctx, req, resp) + bundle := defaults.GenerateDefaultProfileBundle() + + for _, setting := range bundle.GetSettings() { + if v, ok := requested[setting.GetId()]; !ok || v != nil { + continue + } + if setting.GetId() == defaults.SettingUUIDProfileLanguage { + requested[setting.GetId()] = s.withDefaultLanguageSetting(accountUUID) + continue + } + + newVal := &settingsmsg.ValueWithIdentifier{ + Identifier: &settingsmsg.Identifier{ + Extension: bundle.GetExtension(), + Bundle: bundle.GetName(), + Setting: setting.GetName(), + }, + Value: &settingsmsg.Value{ + BundleId: bundle.GetId(), + SettingId: setting.GetId(), + AccountUuid: accountUUID, + Resource: setting.GetResource(), + }, + } + + switch val := setting.GetValue().(type) { + case *settingsmsg.Setting_MultiChoiceCollectionValue: + newVal.Value.Value = multiChoiceCollectionToValue(val.MultiChoiceCollectionValue) + requested[setting.GetId()] = newVal + } + } + + return requested +} + +func multiChoiceCollectionToValue(collection *settingsmsg.MultiChoiceCollection) *settingsmsg.Value_CollectionValue { + values := make([]*settingsmsg.CollectionOption, 0, len(collection.GetOptions())) + for _, option := range collection.GetOptions() { + switch o := option.GetValue().GetOption().(type) { + case *settingsmsg.MultiChoiceCollectionOptionValue_BoolValue: + if o != nil { + values = append(values, &settingsmsg.CollectionOption{ + Key: option.GetKey(), + Option: &settingsmsg.CollectionOption_BoolValue{ + BoolValue: o.BoolValue.GetDefault(), + }, + }) + } + } + } + + return &settingsmsg.Value_CollectionValue{ + CollectionValue: &settingsmsg.CollectionValue{ + Values: values, + }, + } +} + +func getDefaultValueList() map[string]*settingsmsg.ValueWithIdentifier { + return map[string]*settingsmsg.ValueWithIdentifier{ + // specific profile settings should be handled individually + defaults.SettingUUIDProfileLanguage: nil, + // all other profile settings that populated from the bundle based on type + defaults.SettingUUIDProfileEventShareCreated: nil, + defaults.SettingUUIDProfileEventShareRemoved: nil, + defaults.SettingUUIDProfileEventShareExpired: nil, + defaults.SettingUUIDProfileEventSpaceShared: nil, + defaults.SettingUUIDProfileEventSpaceUnshared: nil, + defaults.SettingUUIDProfileEventSpaceMembershipExpired: nil, + defaults.SettingUUIDProfileEventSpaceDisabled: nil, + defaults.SettingUUIDProfileEventSpaceDeleted: nil, + defaults.SettingUUIDProfileEventPostprocessingStepFinished: nil, + } +} diff --git a/services/settings/pkg/service/v0/validator.go b/services/settings/pkg/service/v0/validator.go index 3faa661b081..283e45bf078 100644 --- a/services/settings/pkg/service/v0/validator.go +++ b/services/settings/pkg/service/v0/validator.go @@ -2,6 +2,7 @@ package svc import ( "errors" + "fmt" "regexp" validation "github.com/invopop/validation" @@ -85,6 +86,14 @@ func validateSaveValue(req *settingssvc.SaveValueRequest) error { return err } + if v := req.GetValue().GetCollectionValue().GetValues(); v != nil { + for i := range v { + if err := validation.Validate(v[i].GetKey(), validation.Required); err != nil { + return fmt.Errorf("collectionValue.values[%d].key %w", i, err) + } + } + } + // TODO: validate values against the respective setting. need to check if constraints of the setting are fulfilled. return nil } diff --git a/services/settings/pkg/store/defaults/defaults.go b/services/settings/pkg/store/defaults/defaults.go index e891e88ff73..32a85bb68ae 100644 --- a/services/settings/pkg/store/defaults/defaults.go +++ b/services/settings/pkg/store/defaults/defaults.go @@ -24,6 +24,27 @@ const ( SettingUUIDProfileDisableNotifications = "33ffb5d6-cd07-4dc0-afb0-84f7559ae438" // SettingUUIDProfileAutoAcceptShares is the hardcoded setting UUID for the disable notifications setting SettingUUIDProfileAutoAcceptShares = "ec3ed4a3-3946-4efc-8f9f-76d38b12d3a9" + + // SettingUUIDProfileEmailSendingInterval is the hardcoded setting UUID for the email sending interval setting + SettingUUIDProfileEmailSendingInterval = "08dec2fe-3f97-42a9-9d1b-500855e92f25" + // SettingUUIDProfileEventShareCreated it the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventShareCreated = "872d8ef6-6f2a-42ab-af7d-f53cc81d7046" + // SettingUUIDProfileEventShareRemoved is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventShareRemoved = "d7484394-8321-4c84-9677-741ba71e1f80" + // SettingUUIDProfileEventShareExpired is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventShareExpired = "e1aa0b7c-1b0f-4072-9325-c643c89fee4e" + // SettingUUIDProfileEventSpaceShared is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventSpaceShared = "694d5ee1-a41c-448c-8d14-396b95d2a918" + // SettingUUIDProfileEventSpaceUnshared is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventSpaceUnshared = "26c20e0e-98df-4483-8a77-759b3a766af0" + // SettingUUIDProfileEventSpaceMembershipExpired is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventSpaceMembershipExpired = "7275921e-b737-4074-ba91-3c2983be3edd" + // SettingUUIDProfileEventSpaceDisabled is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventSpaceDisabled = "eb5c716e-03be-42c6-9ed1-1105d24e109f" + // SettingUUIDProfileEventSpaceDeleted is the hardcoded setting UUID for the send in app setting + SettingUUIDProfileEventSpaceDeleted = "094ceca9-5a00-40ba-bb1a-bbc7bccd39ee" + // SettingUUIDProfileEventPostprocessingStepFinished is the hardcoded setting UUID for the send in mail setting + SettingUUIDProfileEventPostprocessingStepFinished = "fe0a3011-d886-49c8-b797-33d02fa426ef" ) // GenerateBundlesDefaultRoles bootstraps the default roles. @@ -37,6 +58,11 @@ func GenerateBundlesDefaultRoles() []*settingsmsg.Bundle { } } +// GenerateDefaultProfileBundle return the default profile bundle. +func GenerateDefaultProfileBundle() *settingsmsg.Bundle { + return generateBundleProfileRequest() +} + // ServiceAccountBundle returns the service account bundle func ServiceAccountBundle() *settingsmsg.Bundle { return &settingsmsg.Bundle{ @@ -94,6 +120,16 @@ func generateBundleAdminRole() *settingsmsg.Bundle { DeleteProjectSpacesPermission(All), DeleteReadOnlyPublicLinkPasswordPermission(All), DisableEmailNotificationsPermission(Own), + ProfileEmailSendingIntervalPermission(Own), + ProfileEventShareCreatedPermission(Own), + ProfileEventShareRemovedPermission(Own), + ProfileEventShareExpiredPermission(Own), + ProfileEventSpaceSharedPermission(Own), + ProfileEventSpaceUnsharedPermission(Own), + ProfileEventSpaceMembershipExpiredPermission(Own), + ProfileEventSpaceDisabledPermission(Own), + ProfileEventSpaceDeletedPermission(Own), + ProfileEventPostprocessingStepFinishedPermission(Own), GroupManagementPermission(All), LanguageManagementPermission(All), ListFavoritesPermission(Own), @@ -127,6 +163,16 @@ func generateBundleSpaceAdminRole() *settingsmsg.Bundle { DeleteProjectSpacesPermission(All), DeleteReadOnlyPublicLinkPasswordPermission(All), DisableEmailNotificationsPermission(Own), + ProfileEmailSendingIntervalPermission(Own), + ProfileEventShareCreatedPermission(Own), + ProfileEventShareRemovedPermission(Own), + ProfileEventShareExpiredPermission(Own), + ProfileEventSpaceSharedPermission(Own), + ProfileEventSpaceUnsharedPermission(Own), + ProfileEventSpaceMembershipExpiredPermission(Own), + ProfileEventSpaceDisabledPermission(Own), + ProfileEventSpaceDeletedPermission(Own), + ProfileEventPostprocessingStepFinishedPermission(Own), LanguageManagementPermission(Own), ListFavoritesPermission(Own), ListSpacesPermission(All), @@ -155,6 +201,16 @@ func generateBundleUserRole() *settingsmsg.Bundle { CreateSharePermission(All), CreateSpacesPermission(Own), DisableEmailNotificationsPermission(Own), + ProfileEmailSendingIntervalPermission(Own), + ProfileEventShareCreatedPermission(Own), + ProfileEventShareRemovedPermission(Own), + ProfileEventShareExpiredPermission(Own), + ProfileEventSpaceSharedPermission(Own), + ProfileEventSpaceUnsharedPermission(Own), + ProfileEventSpaceMembershipExpiredPermission(Own), + ProfileEventSpaceDisabledPermission(Own), + ProfileEventSpaceDeletedPermission(Own), + ProfileEventPostprocessingStepFinishedPermission(Own), LanguageManagementPermission(Own), ListFavoritesPermission(Own), SelfManagementPermission(Own), @@ -176,6 +232,7 @@ func generateBundleUserLightRole() *settingsmsg.Bundle { Settings: []*settingsmsg.Setting{ AutoAcceptSharesPermission(Own), DisableEmailNotificationsPermission(Own), + ProfileEmailSendingIntervalPermission(Own), LanguageManagementPermission(Own), }, } @@ -222,10 +279,250 @@ func generateBundleProfileRequest() *settingsmsg.Bundle { }, Value: &settingsmsg.Setting_BoolValue{BoolValue: &settingsmsg.Bool{Default: true, Label: "auto accept shares"}}, }, + { + Id: SettingUUIDProfileEmailSendingInterval, + Name: "email-sending-interval-options", + DisplayName: TemplateEmailSendingInterval, + Description: TemplateEmailSendingIntervalDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &sendEmailOptions, + }, + { + Id: SettingUUIDProfileEventShareCreated, + Name: "event-share-created-options", + DisplayName: TemplateShareCreated, + Description: TemplateShareCreatedDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailTrue, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventShareRemoved, + Name: "event-share-removed-options", + DisplayName: TemplateShareRemoved, + Description: TemplateShareRemovedDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailFalseDisabled, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventShareExpired, + Name: "event-share-expired-options", + DisplayName: TemplateShareExpired, + Description: TemplateShareExpiredDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailTrue, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventSpaceShared, + Name: "event-space-shared-options", + DisplayName: TemplateSpaceShared, + Description: TemplateSpaceSharedDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailTrue, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventSpaceUnshared, + Name: "event-space-unshared-options", + DisplayName: TemplateSpaceUnshared, + Description: TemplateSpaceUnsharedDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailTrue, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventSpaceMembershipExpired, + Name: "event-space-membership-expired-options", + DisplayName: TemplateSpaceMembershipExpired, + Description: TemplateSpaceMembershipExpiredDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailTrue, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventSpaceDisabled, + Name: "event-space-disabled-options", + DisplayName: TemplateSpaceDisabled, + Description: TemplateSpaceDisabledDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailFalseDisabled, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventSpaceDeleted, + Name: "event-space-deleted-options", + DisplayName: TemplateSpaceDeleted, + Description: TemplateSpaceDeletedDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailFalseDisabled, + }, + }, + }, + }, + { + Id: SettingUUIDProfileEventPostprocessingStepFinished, + Name: "event-postprocessing-step-finished-options", + DisplayName: TemplateFileRejected, + Description: TemplateFileRejectedDescription, + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_USER, + }, + Value: &settingsmsg.Setting_MultiChoiceCollectionValue{ + MultiChoiceCollectionValue: &settingsmsg.MultiChoiceCollection{ + Options: []*settingsmsg.MultiChoiceCollectionOption{ + &optionInAppTrue, + &optionMailFalseDisabled, + }, + }, + }, + }, }, } } +var sendEmailOptions = settingsmsg.Setting_SingleChoiceValue{ + SingleChoiceValue: &settingsmsg.SingleChoiceList{ + Options: []*settingsmsg.ListOption{ + { + Value: &settingsmsg.ListOptionValue{ + Option: &settingsmsg.ListOptionValue_StringValue{ + StringValue: "instant", + }, + }, + DisplayValue: TemplateIntervalInstant, + Default: true, + }, + { + Value: &settingsmsg.ListOptionValue{ + Option: &settingsmsg.ListOptionValue_StringValue{ + StringValue: "daily", + }, + }, + DisplayValue: TemplateIntervalDaily, + }, + { + Value: &settingsmsg.ListOptionValue{ + Option: &settingsmsg.ListOptionValue_StringValue{ + StringValue: "weekly", + }, + }, + DisplayValue: TemplateIntervalWeekly, + }, + { + Value: &settingsmsg.ListOptionValue{ + Option: &settingsmsg.ListOptionValue_StringValue{ + StringValue: "never", + }, + }, + DisplayValue: TemplateIntervalNever, + }, + }, + }, +} + +var optionInAppTrue = settingsmsg.MultiChoiceCollectionOption{ + Key: "in-app", + DisplayValue: "In-App", + Value: &settingsmsg.MultiChoiceCollectionOptionValue{ + Option: &settingsmsg.MultiChoiceCollectionOptionValue_BoolValue{ + BoolValue: &settingsmsg.Bool{ + Default: true, + }, + }, + }, +} + +var optionMailTrue = settingsmsg.MultiChoiceCollectionOption{ + Key: "mail", + DisplayValue: "Mail", + Value: &settingsmsg.MultiChoiceCollectionOptionValue{ + Option: &settingsmsg.MultiChoiceCollectionOptionValue_BoolValue{ + BoolValue: &settingsmsg.Bool{ + Default: true, + }, + }, + }, +} + +var optionMailFalseDisabled = settingsmsg.MultiChoiceCollectionOption{ + Key: "mail", + Attribute: "disabled", + DisplayValue: "Mail", + Value: &settingsmsg.MultiChoiceCollectionOptionValue{ + Option: &settingsmsg.MultiChoiceCollectionOptionValue_BoolValue{ + BoolValue: &settingsmsg.Bool{ + Default: false, + }, + }, + }, +} + // TODO: languageSetting needed? var languageSetting = settingsmsg.Setting_SingleChoiceValue{ SingleChoiceValue: &settingsmsg.SingleChoiceList{ diff --git a/services/settings/pkg/store/defaults/permissions.go b/services/settings/pkg/store/defaults/permissions.go index 432c6563e9a..76305d6c0f7 100644 --- a/services/settings/pkg/store/defaults/permissions.go +++ b/services/settings/pkg/store/defaults/permissions.go @@ -200,6 +200,196 @@ func DisableEmailNotificationsPermission(c settingsmsg.Permission_Constraint) *s } } +// ProfileEmailSendingIntervalPermission is the permission to set the email sending interval +func ProfileEmailSendingIntervalPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "7dc204ee-799a-43b6-b85d-425fb3b1fa5a", + Name: "EmailSendingInterval.ReadWrite", + DisplayName: "Email Sending Interval", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEmailSendingInterval, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventShareCreatedPermission is +func ProfileEventShareCreatedPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "8a50540c-1cdd-481f-b85f-44654393c8f0", + Name: "Event.ShareCreated.ReadWrite", + DisplayName: "Event Share Created", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventShareCreated, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventShareRemovedPermission is the permission to set the email sending interval +func ProfileEventShareRemovedPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "5ef55465-8e39-4a6c-ba97-1d19f5b07116", + Name: "Event.ShareRemoved.ReadWrite", + DisplayName: "Event Share Removed", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventShareRemoved, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventShareExpiredPermission is the permission to set the email sending interval +func ProfileEventShareExpiredPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "7d4f961b-d471-451b-b1fd-ac6a9d59ce88", + Name: "Event.ShareExpired.ReadWrite", + DisplayName: "Event Share Expired", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventShareExpired, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventSpaceSharedPermission is the permission to set the email sending interval +func ProfileEventSpaceSharedPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "feb16d2c-614c-4f79-ac37-755a028f5616", + Name: "Event.SpaceShared.ReadWrite", + DisplayName: "Event Space Shared", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventSpaceShared, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventSpaceUnsharedPermission is the permission to set the email sending interval +func ProfileEventSpaceUnsharedPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "4f979732-631b-4f27-9be7-a89fb223a6d2", + Name: "Event.SpaceUnshared.ReadWrite", + DisplayName: "Event Space Unshared", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventSpaceUnshared, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventSpaceMembershipExpiredPermission is the permission to set the email sending interval +func ProfileEventSpaceMembershipExpiredPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "a3cc45bf-9720-4e08-b403-b9133fe33f0b", + Name: "Event.SpaceMembershipExpired.ReadWrite", + DisplayName: "Event Space Membership Expired", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventSpaceMembershipExpired, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventSpaceDisabledPermission is the permission to set the email sending interval +func ProfileEventSpaceDisabledPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "896194c2-5055-4ea3-94a3-0a1419187a00", + Name: "Event.SpaceDisabled.ReadWrite", + DisplayName: "Event Space Disabled", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventSpaceDisabled, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventSpaceDeletedPermission is the permission to set the email sending interval +func ProfileEventSpaceDeletedPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "2083c280-b140-4b73-a931-9a4af2931531", + Name: "Event.SpaceDeleted.ReadWrite", + DisplayName: "Event Space Deleted", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventSpaceDeleted, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + +// ProfileEventPostprocessingStepFinishedPermission is the permission to set the email sending interval +func ProfileEventPostprocessingStepFinishedPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { + return &settingsmsg.Setting{ + Id: "27ba8e97-0bdf-4b18-97d4-df44c9568cda", + Name: "Event.PostprocessingStepFinished.ReadWrite", + DisplayName: "Event Postprocessing Step Finished", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SETTING, + Id: SettingUUIDProfileEventPostprocessingStepFinished, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: c, + }, + }, + } +} + // GroupManagementPermission is the permission to manage groups func GroupManagementPermission(c settingsmsg.Permission_Constraint) *settingsmsg.Setting { return &settingsmsg.Setting{ diff --git a/services/settings/pkg/store/defaults/templates.go b/services/settings/pkg/store/defaults/templates.go new file mode 100644 index 00000000000..0158fe91ef0 --- /dev/null +++ b/services/settings/pkg/store/defaults/templates.go @@ -0,0 +1,55 @@ +package defaults + +import "github.com/owncloud/ocis/v2/ocis-pkg/l10n" + +// Translatable configuration options +var ( + // name of the notification option 'Share Received' + TemplateShareCreated = l10n.Template("Share Received") + // description of the notification option 'Share Received' + TemplateShareCreatedDescription = l10n.Template("Notify me when I receive a share") + // name of the notification option 'Share Removed' + TemplateShareRemoved = l10n.Template("Share Removed") + // description of the notification option 'Share Removed' + TemplateShareRemovedDescription = l10n.Template("Notify me when my shares are removed") + // name of the notification option 'Share Expired' + TemplateShareExpired = l10n.Template("Share Expired") + // description of the notification option 'Share Expired' + TemplateShareExpiredDescription = l10n.Template("Notify me when my shares expire") + // name of the notification option 'Space Shared' + TemplateSpaceShared = l10n.Template("Added as space member") + // description of the notification option 'Space Shared' + TemplateSpaceSharedDescription = l10n.Template("Notify me when I am added as a member to a space") + // name of the notification option 'Space Unshared' + TemplateSpaceUnshared = l10n.Template("Removed as space member") + // description of the notification option 'Space Unshared' + TemplateSpaceUnsharedDescription = l10n.Template("Notify me when I am removed as a member from a space") + // name of the notification option 'Space Membership Expired' + TemplateSpaceMembershipExpired = l10n.Template("Space membership expired") + // description of the notification option 'Space Membership Expired' + TemplateSpaceMembershipExpiredDescription = l10n.Template("Notify me when my membership of a space expires") + // name of the notification option 'Space Disabled' + TemplateSpaceDisabled = l10n.Template("Space disabled") + // description of the notification option 'Space Disabled' + TemplateSpaceDisabledDescription = l10n.Template("Notify me when a space I am a member of is disabled") + // name of the notification option 'Space Deleted' + TemplateSpaceDeleted = l10n.Template("Space deleted") + // description of the notification option 'Space Deleted' + TemplateSpaceDeletedDescription = l10n.Template("Notify me when a space I am a member of is deleted") + // name of the notification option 'File Rejected' + TemplateFileRejected = l10n.Template("File rejected") + // description of the notification option 'File Rejected' + TemplateFileRejectedDescription = l10n.Template("Notify me when a file I uploaded is rejected because of virus infection or policy violation") + // name of the notification option 'Email Interval' + TemplateEmailSendingInterval = l10n.Template("Email sending interval") + // description of the notification option 'Email Interval' + TemplateEmailSendingIntervalDescription = l10n.Template("Notifiy me via email:") + // translation for the 'instant' email interval option + TemplateIntervalInstant = l10n.Template("Instant") + // translation for the 'daily' email interval option + TemplateIntervalDaily = l10n.Template("Daily") + // translation for the 'weekly' email interval option + TemplateIntervalWeekly = l10n.Template("Weekly") + // translation for the 'never' email interval option + TemplateIntervalNever = l10n.Template("Never") +) diff --git a/services/userlog/pkg/service/filter.go b/services/userlog/pkg/service/filter.go new file mode 100644 index 00000000000..660e361a104 --- /dev/null +++ b/services/userlog/pkg/service/filter.go @@ -0,0 +1,102 @@ +package service + +import ( + "context" + "errors" + user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/cs3org/reva/v2/pkg/events" + "github.com/owncloud/ocis/v2/ocis-pkg/log" + "github.com/owncloud/ocis/v2/ocis-pkg/middleware" + settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" + "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults" + micrometadata "go-micro.dev/v4/metadata" +) + +type userlogFilter struct { + log log.Logger + valueClient settingssvc.ValueService +} + +func newUserlogFilter(l log.Logger, vc settingssvc.ValueService) *userlogFilter { + return &userlogFilter{log: l, valueClient: vc} +} + +// execute removes users who should not receive an in-app notifications for the event +func (ulf userlogFilter) execute(ctx context.Context, event events.Event, executant *user.UserId, users []string) []string { + filteredUsers := ulf.filterExecutant(users, executant) + return ulf.filterUsersBySettings(ctx, filteredUsers, event) +} + +// filterExecutant removes the executant +func (ulf userlogFilter) filterExecutant(users []string, executant *user.UserId) []string { + var filteredUsers []string + for _, u := range users { + if u != executant.GetOpaqueId() { + filteredUsers = append(filteredUsers, u) + } + } + return filteredUsers +} + +// filterUsersBySettings removes users who have disabled in-app notifications for the event +func (ulf userlogFilter) filterUsersBySettings(ctx context.Context, users []string, event events.Event) []string { + var filteredUsers []string + var settingId string + // map type to settings key + switch event.Event.(type) { + case events.ShareCreated: + settingId = defaults.SettingUUIDProfileEventShareCreated + case events.ShareRemoved: + settingId = defaults.SettingUUIDProfileEventShareRemoved + case events.ShareExpired: + settingId = defaults.SettingUUIDProfileEventShareExpired + case events.SpaceShared: + settingId = defaults.SettingUUIDProfileEventSpaceShared + case events.SpaceUnshared: + settingId = defaults.SettingUUIDProfileEventSpaceUnshared + case events.SpaceMembershipExpired: + settingId = defaults.SettingUUIDProfileEventSpaceMembershipExpired + case events.SpaceDisabled: + settingId = defaults.SettingUUIDProfileEventSpaceDisabled + case events.SpaceDeleted: + settingId = defaults.SettingUUIDProfileEventSpaceDeleted + default: + // event that cannot be disabled + return users + } + + for _, u := range users { + enabled, err := getSetting(ctx, ulf.valueClient, u, settingId) + if err != nil { + ulf.log.Error().Err(err).Str("userId", u).Str("settingId", settingId).Msg("cannot get user event setting") + continue + } + if enabled { + filteredUsers = append(filteredUsers, u) + } + } + + return filteredUsers +} + +func getSetting(ctx context.Context, vc settingssvc.ValueService, userId string, settingId string) (bool, error) { + resp, err := vc.GetValueByUniqueIdentifiers( + micrometadata.Set(ctx, middleware.AccountID, userId), + &settingssvc.GetValueByUniqueIdentifiersRequest{ + AccountUuid: userId, + SettingId: settingId, + }, + ) + + if err != nil { + return false, err + } + + val := resp.GetValue().GetValue().GetCollectionValue().GetValues() + for _, option := range val { + if option.GetKey() == "in-app" { + return option.GetBoolValue(), nil + } + } + return false, errors.New("no setting found") +} diff --git a/services/userlog/pkg/service/filter_test.go b/services/userlog/pkg/service/filter_test.go new file mode 100644 index 00000000000..4e9293a69c0 --- /dev/null +++ b/services/userlog/pkg/service/filter_test.go @@ -0,0 +1,97 @@ +package service + +import ( + "context" + user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/cs3org/reva/v2/pkg/events" + "github.com/owncloud/ocis/v2/ocis-pkg/log" + settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" + settings "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "go-micro.dev/v4/client" + "testing" +) + +var testLogger = log.NewLogger() + +func TestUserlogFilter_execute(t *testing.T) { + type args struct { + ctx context.Context + event events.Event + executant *user.UserId + users []string + } + tests := []struct { + name string + vc settings.ValueService + args args + want []string + }{ + {"executant", settings.MockValueService{}, args{executant: &user.UserId{OpaqueId: "executant"}, users: []string{"foo", "executant"}}, []string{"foo"}}, + {"no connection to ValueService", settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return nil, errors.New("no connection to ValueService") + }, + }, args{users: []string{"foo"}, event: events.Event{Event: events.ShareCreated{}}, ctx: context.TODO()}, []string(nil)}, + {"no setting in ValueService response", settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return &settings.GetValueResponse{}, nil + }, + }, args{users: []string{"foo"}, event: events.Event{Event: events.ShareCreated{}}, ctx: context.TODO()}, []string(nil)}, + {"ValueService nil response", settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return nil, nil + }, + }, args{users: []string{"foo"}, event: events.Event{Event: events.ShareCreated{}}, ctx: context.TODO()}, []string(nil)}, + {"event that cannot be disabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.BytesReceived{}}, ctx: context.TODO()}, []string{"foo"}}, + {"ShareCreated enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.ShareCreated{}}, ctx: context.TODO()}, []string{"foo"}}, + {"ShareRemoved enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.ShareRemoved{}}, ctx: context.TODO()}, []string{"foo"}}, + {"ShareExpired enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.ShareExpired{}}, ctx: context.TODO()}, []string{"foo"}}, + {"SpaceShared enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceShared{}}, ctx: context.TODO()}, []string{"foo"}}, + {"SpaceUnshared enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceUnshared{}}, ctx: context.TODO()}, []string{"foo"}}, + {"SpaceMembershipExpired enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceMembershipExpired{}}, ctx: context.TODO()}, []string{"foo"}}, + {"SpaceDisabled enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceDisabled{}}, ctx: context.TODO()}, []string{"foo"}}, + {"SpaceDeleted enabled", setupMockValueService(true), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceDeleted{}}, ctx: context.TODO()}, []string{"foo"}}, + {"ShareCreated disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.ShareCreated{}}, ctx: context.TODO()}, []string(nil)}, + {"ShareRemoved disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.ShareRemoved{}}, ctx: context.TODO()}, []string(nil)}, + {"ShareExpired disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.ShareExpired{}}, ctx: context.TODO()}, []string(nil)}, + {"SpaceShared disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceShared{}}, ctx: context.TODO()}, []string(nil)}, + {"SpaceUnshared disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceUnshared{}}, ctx: context.TODO()}, []string(nil)}, + {"SpaceMembershipExpired disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceMembershipExpired{}}, ctx: context.TODO()}, []string(nil)}, + {"SpaceDisabled disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceDisabled{}}, ctx: context.TODO()}, []string(nil)}, + {"SpaceDeleted disabled", setupMockValueService(false), args{users: []string{"foo"}, event: events.Event{Event: events.SpaceDeleted{}}, ctx: context.TODO()}, []string(nil)}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ulf := userlogFilter{ + log: testLogger, + valueClient: tt.vc, + } + assert.Equal(t, tt.want, ulf.execute(tt.args.ctx, tt.args.event, tt.args.executant, tt.args.users)) + }) + } +} + +func setupMockValueService(inApp bool) settings.ValueService { + return settings.MockValueService{ + GetValueByUniqueIdentifiersFunc: func(ctx context.Context, req *settings.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settings.GetValueResponse, error) { + return &settings.GetValueResponse{ + Value: &settingsmsg.ValueWithIdentifier{ + Value: &settingsmsg.Value{ + Value: &settingsmsg.Value_CollectionValue{ + CollectionValue: &settingsmsg.CollectionValue{ + Values: []*settingsmsg.CollectionOption{ + { + Key: "in-app", + Option: &settingsmsg.CollectionOption_BoolValue{BoolValue: inApp}, + }, + }, + }, + }, + }, + }, + }, nil + }, + } +} diff --git a/services/userlog/pkg/service/l10n/locale/bg_BG/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/bg_BG/LC_MESSAGES/userlog.po index 8b137e92954..45d4aee9ef3 100644 --- a/services/userlog/pkg/service/l10n/locale/bg_BG/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/bg_BG/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Martin Zhekov , 2023\n" "Language-Team: Bulgarian (Bulgaria) (https://app.transifex.com/owncloud-org/teams/6149/bg_BG/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/de/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/de/LC_MESSAGES/userlog.po index 48e5aa9b5f3..ad0d59cc9a9 100644 --- a/services/userlog/pkg/service/l10n/locale/de/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/de/LC_MESSAGES/userlog.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Michael Barz , 2023\n" "Language-Team: German (https://app.transifex.com/owncloud-org/teams/6149/de/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/de_DE/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/de_DE/LC_MESSAGES/userlog.po index f75180f24ad..fe2303557b3 100644 --- a/services/userlog/pkg/service/l10n/locale/de_DE/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/de_DE/LC_MESSAGES/userlog.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Edith Parzefall, 2024\n" "Language-Team: German (Germany) (https://app.transifex.com/owncloud-org/teams/6149/de_DE/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/userlog.po index 5cb11bdaf96..2bfba055915 100644 --- a/services/userlog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/en_GB/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Andi Chandler , 2023\n" "Language-Team: English (United Kingdom) (https://app.transifex.com/owncloud-org/teams/6149/en_GB/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/es/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/es/LC_MESSAGES/userlog.po index d587377d9df..6329132ea22 100644 --- a/services/userlog/pkg/service/l10n/locale/es/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/es/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Juan Carlos Garrote, 2023\n" "Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/ko/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/ko/LC_MESSAGES/userlog.po index 412398b7bc0..dc325fa1b3b 100644 --- a/services/userlog/pkg/service/l10n/locale/ko/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/ko/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Hugo Blackwood, 2023\n" "Language-Team: Korean (https://app.transifex.com/owncloud-org/teams/6149/ko/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/userlog.po index 24077bae334..09016d8ed09 100644 --- a/services/userlog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/pt_BR/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Flávio Veras , 2023\n" "Language-Team: Portuguese (Brazil) (https://app.transifex.com/owncloud-org/teams/6149/pt_BR/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/ru/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/ru/LC_MESSAGES/userlog.po index 4c94e15db72..a73ea0dafdf 100644 --- a/services/userlog/pkg/service/l10n/locale/ru/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/ru/LC_MESSAGES/userlog.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-14 00:17+0000\n" +"POT-Creation-Date: 2025-01-04 00:05+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: dutty5, 2024\n" "Language-Team: Russian (https://app.transifex.com/owncloud-org/teams/6149/ru/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/ru_RU/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/ru_RU/LC_MESSAGES/userlog.po index d7228568f55..069a7e71d5a 100644 --- a/services/userlog/pkg/service/l10n/locale/ru_RU/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/ru_RU/LC_MESSAGES/userlog.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-14 00:17+0000\n" +"POT-Creation-Date: 2025-01-04 00:05+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: dutty5, 2024\n" "Language-Team: Russian (Russia) (https://app.transifex.com/owncloud-org/teams/6149/ru_RU/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/sq/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/sq/LC_MESSAGES/userlog.po index 2687cf5ca54..3e176547e50 100644 --- a/services/userlog/pkg/service/l10n/locale/sq/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/sq/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Besnik Bleta , 2023\n" "Language-Team: Albanian (https://app.transifex.com/owncloud-org/teams/6149/sq/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/tr/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/tr/LC_MESSAGES/userlog.po index 3fe9f7ed192..60f3fd27e92 100644 --- a/services/userlog/pkg/service/l10n/locale/tr/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/tr/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Begüm Topyıldız , 2023\n" "Language-Team: Turkish (https://app.transifex.com/owncloud-org/teams/6149/tr/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/ug/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/ug/LC_MESSAGES/userlog.po index 37478a87c8c..a7c3d06cf26 100644 --- a/services/userlog/pkg/service/l10n/locale/ug/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/ug/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-15 00:43+0000\n" +"POT-Creation-Date: 2025-01-05 00:05+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Keram, 2024\n" "Language-Team: Uyghur (https://app.transifex.com/owncloud-org/teams/6149/ug/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/uk/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/uk/LC_MESSAGES/userlog.po index 0a16b77976d..0adbb9c7924 100644 --- a/services/userlog/pkg/service/l10n/locale/uk/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/uk/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-16 00:19+0000\n" +"POT-Creation-Date: 2025-01-06 00:03+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Roman Perekhod, 2024\n" "Language-Team: Ukrainian (https://app.transifex.com/owncloud-org/teams/6149/uk/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/zh-Hans/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/zh-Hans/LC_MESSAGES/userlog.po index e9248864938..8b7b8216344 100644 --- a/services/userlog/pkg/service/l10n/locale/zh-Hans/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/zh-Hans/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: fnoopv , 2024\n" "Language-Team: Chinese Simplified (https://app.transifex.com/owncloud-org/teams/6149/zh-Hans/)\n" diff --git a/services/userlog/pkg/service/l10n/locale/zh_CN/LC_MESSAGES/userlog.po b/services/userlog/pkg/service/l10n/locale/zh_CN/LC_MESSAGES/userlog.po index af4c5f446f7..13c5c4a8dcc 100644 --- a/services/userlog/pkg/service/l10n/locale/zh_CN/LC_MESSAGES/userlog.po +++ b/services/userlog/pkg/service/l10n/locale/zh_CN/LC_MESSAGES/userlog.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2024-12-01 00:18+0000\n" +"POT-Creation-Date: 2024-12-22 00:18+0000\n" "PO-Revision-Date: 2023-03-15 08:28+0000\n" "Last-Translator: Shouyuan, 2023\n" "Language-Team: Chinese (China) (https://app.transifex.com/owncloud-org/teams/6149/zh_CN/)\n" diff --git a/services/userlog/pkg/service/service.go b/services/userlog/pkg/service/service.go index 89efc523f7e..8de8432b505 100644 --- a/services/userlog/pkg/service/service.go +++ b/services/userlog/pkg/service/service.go @@ -39,6 +39,7 @@ type UserlogService struct { tp trace.TracerProvider tracer trace.Tracer publisher events.Publisher + filter *userlogFilter } // NewUserlogService returns an EventHistory service @@ -69,6 +70,7 @@ func NewUserlogService(opts ...Option) (*UserlogService, error) { tp: o.TraceProvider, tracer: o.TraceProvider.Tracer("github.com/owncloud/ocis/services/userlog/pkg/service"), publisher: o.Stream, + filter: newUserlogFilter(o.Logger, o.ValueClient), } for _, e := range o.RegisteredEvents { @@ -190,10 +192,7 @@ func (ul *UserlogService) processEvent(event events.Event) { } // II) filter users who want to receive the event - // This step is postponed for later. - // For now each user should get all events she is eligible to receive - // ...except notifications for their own actions - users = removeExecutant(users, executant) + users = ul.filter.execute(ctx, event, executant, users) // III) store the eventID for each user for _, id := range users { @@ -461,13 +460,3 @@ func (ul *UserlogService) alterGlobalEvents(ctx context.Context, alter func(map[ Value: val, }) } - -func removeExecutant(users []string, executant *user.UserId) []string { - var usrs []string - for _, u := range users { - if u != executant.GetOpaqueId() { - usrs = append(usrs, u) - } - } - return usrs -} diff --git a/services/userlog/pkg/service/service_test.go b/services/userlog/pkg/service/service_test.go index 1203aa654b5..be62e3f5b6b 100644 --- a/services/userlog/pkg/service/service_test.go +++ b/services/userlog/pkg/service/service_test.go @@ -3,6 +3,7 @@ package service_test import ( "context" "encoding/json" + settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" "reflect" "time" @@ -77,7 +78,22 @@ var _ = Describe("UserlogService", func() { gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(&user.GetUserResponse{User: &user.User{Id: &user.UserId{OpaqueId: "userid"}}, Status: &rpc.Status{Code: rpc.Code_CODE_OK}}, nil) gatewayClient.On("Authenticate", mock.Anything, mock.Anything).Return(&gateway.AuthenticateResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}}, nil) vc.GetValueByUniqueIdentifiersFunc = func(ctx context.Context, req *settingssvc.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settingssvc.GetValueResponse, error) { - return nil, nil + return &settingssvc.GetValueResponse{ + Value: &settingsmsg.ValueWithIdentifier{ + Value: &settingsmsg.Value{ + Value: &settingsmsg.Value_CollectionValue{ + CollectionValue: &settingsmsg.CollectionValue{ + Values: []*settingsmsg.CollectionOption{ + { + Key: "in-app", + Option: &settingsmsg.CollectionOption_BoolValue{BoolValue: true}, + }, + }, + }, + }, + }, + }, + }, nil } ul, err = service.NewUserlogService( diff --git a/tests/acceptance/TestHelpers/Asserts/WebDav.php b/tests/acceptance/TestHelpers/Asserts/WebDav.php index 155d5ff1c9d..343708413ab 100644 --- a/tests/acceptance/TestHelpers/Asserts/WebDav.php +++ b/tests/acceptance/TestHelpers/Asserts/WebDav.php @@ -42,7 +42,7 @@ class WebDav extends Assert { ?string $expectedValue, ?array $responseXmlArray, ?string $extraErrorText = '' - ):void { + ): void { if ($extraErrorText !== '') { $extraErrorText = $extraErrorText . " "; } @@ -58,7 +58,9 @@ class WebDav extends Assert { } elseif ($element === "reason") { $result = $responseXmlArray['value'][3]['value']; } else { - self::fail(__METHOD__ . " element must be one of exception, response or reason. But '$element' was passed in."); + self::fail( + __METHOD__ . " element must be one of exception, response or reason. But '$element' was passed in." + ); } self::assertEquals( @@ -78,7 +80,7 @@ class WebDav extends Assert { public static function assertResponseContainsShareTypes( SimpleXMLElement $responseXmlObject, ?array $expectedShareTypes - ):void { + ): void { foreach ($expectedShareTypes as $row) { $xmlPart = $responseXmlObject->xpath( "//d:prop/oc:share-types/oc:share-type[.=" . $row[0] . "]" diff --git a/tests/acceptance/TestHelpers/AuthAppHelper.php b/tests/acceptance/TestHelpers/AuthAppHelper.php index 61d76d5ddd4..c42f5f4d8f5 100644 --- a/tests/acceptance/TestHelpers/AuthAppHelper.php +++ b/tests/acceptance/TestHelpers/AuthAppHelper.php @@ -42,7 +42,11 @@ class AuthAppHelper { * * @return ResponseInterface */ - public static function listAllAppAuthTokensForUser(string $baseUrl, string $user, string $password): ResponseInterface { + public static function listAllAppAuthTokensForUser( + string $baseUrl, + string $user, + string $password + ): ResponseInterface { $url = $baseUrl . self::getAuthAppEndpoint(); return HttpRequestHelper::sendRequest( $url, @@ -61,7 +65,12 @@ class AuthAppHelper { * * @return ResponseInterface */ - public static function createAppAuthToken(string $baseUrl, string $user, string $password, string $expiration): ResponseInterface { + public static function createAppAuthToken( + string $baseUrl, + string $user, + string $password, + string $expiration + ): ResponseInterface { $url = $baseUrl . self::getAuthAppEndpoint() . "?expiry=$expiration"; return HttpRequestHelper::sendRequest( $url, @@ -80,7 +89,12 @@ class AuthAppHelper { * * @return ResponseInterface */ - public static function deleteAppAuthToken(string $baseUrl, string $user, string $password, string $token): ResponseInterface { + public static function deleteAppAuthToken( + string $baseUrl, + string $user, + string $password, + string $token + ): ResponseInterface { $url = $baseUrl . self::getAuthAppEndpoint() . "?token=$token"; return HttpRequestHelper::sendRequest( $url, diff --git a/tests/acceptance/TestHelpers/BehatHelper.php b/tests/acceptance/TestHelpers/BehatHelper.php index 83c485969a8..5fd4fd5367f 100644 --- a/tests/acceptance/TestHelpers/BehatHelper.php +++ b/tests/acceptance/TestHelpers/BehatHelper.php @@ -38,7 +38,11 @@ class BehatHelper { * * @return Context */ - public static function getContext(ScenarioScope $scope, InitializedContextEnvironment $environment, string $class): Context { + public static function getContext( + ScenarioScope $scope, + InitializedContextEnvironment $environment, + string $class + ): Context { try { return $environment->getContext($class); } catch (ContextNotFoundException $e) { diff --git a/tests/acceptance/TestHelpers/EmailHelper.php b/tests/acceptance/TestHelpers/EmailHelper.php index bc09e81314c..03e613e5278 100644 --- a/tests/acceptance/TestHelpers/EmailHelper.php +++ b/tests/acceptance/TestHelpers/EmailHelper.php @@ -35,7 +35,7 @@ class EmailHelper { * * @return string */ - public static function getMailBoxFromEmail(string $emailAddress):string { + public static function getMailBoxFromEmail(string $emailAddress): string { return explode("@", $emailAddress)[0]; } @@ -45,7 +45,7 @@ class EmailHelper { * * @return string */ - public static function getLocalEmailUrl():string { + public static function getLocalEmailUrl(): string { $localEmailHost = self::getLocalEmailHost(); $emailPort = \getenv('EMAIL_PORT'); if ($emailPort === false) { @@ -60,7 +60,7 @@ class EmailHelper { * * @return string */ - public static function getEmailHost():string { + public static function getEmailHost(): string { $emailHost = \getenv('EMAIL_HOST'); if ($emailHost === false) { $emailHost = "127.0.0.1"; @@ -74,7 +74,7 @@ class EmailHelper { * * @return string */ - public static function getLocalEmailHost():string { + public static function getLocalEmailHost(): string { $localEmailHost = \getenv('LOCAL_EMAIL_HOST'); if ($localEmailHost === false) { $localEmailHost = self::getEmailHost(); @@ -92,7 +92,7 @@ class EmailHelper { * @return array * @throws GuzzleException */ - public static function getMailBoxInformation(string $mailBox, ?string $xRequestId = null):array { + public static function getMailBoxInformation(string $mailBox, ?string $xRequestId = null): array { $response = HttpRequestHelper::get( self::getLocalEmailUrl() . "/api/v1/mailbox/" . $mailBox, $xRequestId, @@ -113,7 +113,11 @@ class EmailHelper { * @return object * @throws GuzzleException */ - public static function getBodyOfAnEmailById(string $mailBox, string $mailboxId, ?string $xRequestId = null):object { + public static function getBodyOfAnEmailById( + string $mailBox, + string $mailboxId, + ?string $xRequestId = null + ): object { $response = HttpRequestHelper::get( self::getLocalEmailUrl() . "/api/v1/mailbox/" . $mailBox . "/" . $mailboxId, $xRequestId, @@ -142,7 +146,7 @@ class EmailHelper { string $xRequestId, ?int $emailNumber = 1, ?int $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC - ):string { + ): string { $currentTime = \time(); $endTime = $currentTime + $waitTimeSec; $mailBox = self::getMailBoxFromEmail($emailAddress); @@ -178,7 +182,7 @@ class EmailHelper { string $localInbucketUrl, ?string $xRequestId, string $mailBox - ):ResponseInterface { + ): ResponseInterface { return HttpRequestHelper::delete( $localInbucketUrl . "/api/v1/mailbox/" . $mailBox, $xRequestId diff --git a/tests/acceptance/TestHelpers/GraphHelper.php b/tests/acceptance/TestHelpers/GraphHelper.php index 21aa08e0ace..b00377c9f83 100644 --- a/tests/acceptance/TestHelpers/GraphHelper.php +++ b/tests/acceptance/TestHelpers/GraphHelper.php @@ -110,7 +110,8 @@ class GraphHelper { * @return string */ public static function getShareIdRegex(): string { - return self::getUUIDv4Regex() . '\\\$' . self::getUUIDv4Regex() . '!' . self::getUUIDv4Regex() . ':' . self::getUUIDv4Regex() . ':' . self::getUUIDv4Regex(); + return self::getUUIDv4Regex() . '\\\$' . self::getUUIDv4Regex() . '!' + . self::getUUIDv4Regex() . ':' . self::getUUIDv4Regex() . ':' . self::getUUIDv4Regex(); } /** @@ -1387,7 +1388,11 @@ class GraphHelper { string $password, array $groupIdArray ): ResponseInterface { - $url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$groupIdArray[0]') " . "and memberOf/any(m:m/id eq '$groupIdArray[1]')"); + $url = self::getFullUrl( + $baseUrl, + 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$groupIdArray[0]') " + . "and memberOf/any(m:m/id eq '$groupIdArray[1]')" + ); return HttpRequestHelper::get( $url, $xRequestId, @@ -1416,7 +1421,11 @@ class GraphHelper { string $firstGroup, string $secondGroup ): ResponseInterface { - $url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$firstGroup') " . "or memberOf/any(m:m/id eq '$secondGroup')"); + $url = self::getFullUrl( + $baseUrl, + 'users' . '?$filter=memberOf/any(m:m/id ' + . "eq '$firstGroup') " . "or memberOf/any(m:m/id eq '$secondGroup')" + ); return HttpRequestHelper::get( $url, $xRequestId, @@ -1472,7 +1481,11 @@ class GraphHelper { string $roleId, string $groupId ): ResponseInterface { - $url = self::getFullUrl($baseUrl, 'users' . '?$filter=appRoleAssignments/any(m:m/appRoleId ' . "eq '$roleId') " . "and memberOf/any(m:m/id eq '$groupId')"); + $url = self::getFullUrl( + $baseUrl, + 'users' . '?$filter=appRoleAssignments/any(m:m/appRoleId ' + . "eq '$roleId') " . "and memberOf/any(m:m/id eq '$groupId')" + ); return HttpRequestHelper::get( $url, $xRequestId, @@ -1669,7 +1682,15 @@ class GraphHelper { ): ResponseInterface { $fullUrl = self::getFullUrl($baseUrl, 'me'); $payload['preferredLanguage'] = $language; - return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PATCH', $user, $password, null, \json_encode($payload)); + return HttpRequestHelper::sendRequest( + $fullUrl, + $xRequestId, + 'PATCH', + $user, + $password, + null, + \json_encode($payload) + ); } /** @@ -1679,6 +1700,7 @@ class GraphHelper { * @param string $password * @param string $spaceId * @param string $itemId + * @param string|null $query * * @return ResponseInterface * @throws GuzzleException @@ -1689,9 +1711,14 @@ class GraphHelper { string $user, string $password, string $spaceId, - string $itemId + string $itemId, + ?string $query = null ): ResponseInterface { $url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/permissions"); + if (!empty($query)) { + $url .= "?$query"; + } + return HttpRequestHelper::get( $url, $xRequestId, @@ -1810,7 +1837,13 @@ class GraphHelper { ?string $expirationDateTime ): ResponseInterface { $url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/invite"); - $body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expirationDateTime); + $body = self::createShareInviteBody( + $shareeIds, + $shareTypes, + $permissionsRole, + $permissionsAction, + $expirationDateTime + ); return HttpRequestHelper::post( $url, $xRequestId, @@ -2052,7 +2085,7 @@ class GraphHelper { string $password, string $itemId, string $shareSpaceId - ):ResponseInterface { + ): ResponseInterface { $url = self::getBetaFullUrl($baseUrl, "drives/$shareSpaceId/items/$itemId"); return HttpRequestHelper::delete( $url, @@ -2083,7 +2116,7 @@ class GraphHelper { string $itemId, string $shareSpaceId, array $body - ):ResponseInterface { + ): ResponseInterface { $url = self::getBetaFullUrl($baseUrl, "drives/$shareSpaceId/items/$itemId"); return HttpRequestHelper::sendRequest( $url, @@ -2186,7 +2219,13 @@ class GraphHelper { ?string $expirationDateTime ): ResponseInterface { $url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/root/invite"); - $body = self::createShareInviteBody($shareeIds, $shareTypes, $permissionsRole, $permissionsAction, $expirationDateTime); + $body = self::createShareInviteBody( + $shareeIds, + $shareTypes, + $permissionsRole, + $permissionsAction, + $expirationDateTime + ); return HttpRequestHelper::post( $url, diff --git a/tests/acceptance/TestHelpers/HttpRequestHelper.php b/tests/acceptance/TestHelpers/HttpRequestHelper.php index 21fa4f3024f..39b92136f61 100644 --- a/tests/acceptance/TestHelpers/HttpRequestHelper.php +++ b/tests/acceptance/TestHelpers/HttpRequestHelper.php @@ -55,7 +55,7 @@ class HttpRequestHelper { * * @return int */ - public static function numRetriesOnHttpTooEarly():int { + public static function numRetriesOnHttpTooEarly(): int { // Currently reva and oCIS may return HTTP_TOO_EARLY // So try up to 10 times before giving up. return 10; @@ -93,7 +93,7 @@ class HttpRequestHelper { bool $stream = false, ?int $timeout = 0, ?Client $client = null - ):ResponseInterface { + ): ResponseInterface { if ($client === null) { $client = self::createClient( $user, @@ -196,7 +196,7 @@ class HttpRequestHelper { ?int $timeout = 0, ?Client $client = null, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { if ((\getenv('DEBUG_ACCEPTANCE_RESPONSES') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) { $debugResponses = true; } else { @@ -222,7 +222,10 @@ class HttpRequestHelper { $client ); - if ($response->getStatusCode() >= 400 && $response->getStatusCode() !== self::HTTP_TOO_EARLY && $response->getStatusCode() !== self::HTTP_CONFLICT) { + if ($response->getStatusCode() >= 400 + && $response->getStatusCode() !== self::HTTP_TOO_EARLY + && $response->getStatusCode() !== self::HTTP_CONFLICT + ) { $sendExceptionHappened = true; } @@ -248,7 +251,6 @@ class HttpRequestHelper { \sleep(1); } } while ($loopAgain); - return $response; } @@ -261,7 +263,7 @@ class HttpRequestHelper { * * @return void */ - private static function debugRequest(?RequestInterface $request, ?string $user, ?string $password):void { + private static function debugRequest(?RequestInterface $request, ?string $user, ?string $password): void { print("### AUTH: $user:$password\n"); print("### REQUEST: " . $request->getMethod() . " " . $request->getUri() . "\n"); self::printHeaders($request->getHeaders()); @@ -276,7 +278,7 @@ class HttpRequestHelper { * * @return void */ - private static function debugResponse(?ResponseInterface $response):void { + private static function debugResponse(?ResponseInterface $response): void { print("### RESPONSE\n"); print("Status: " . $response->getStatusCode() . "\n"); self::printHeaders($response->getHeaders()); @@ -291,7 +293,7 @@ class HttpRequestHelper { * * @return void */ - private static function printHeaders(?array $headers):void { + private static function printHeaders(?array $headers): void { if ($headers) { print("Headers:\n"); foreach ($headers as $header => $value) { @@ -313,7 +315,7 @@ class HttpRequestHelper { * * @return void */ - private static function printBody(?StreamInterface $body):void { + private static function printBody(?StreamInterface $body): void { print("Body:\n"); \var_dump($body->getContents()); // Rewind the stream so that later code can read from the start. @@ -333,7 +335,7 @@ class HttpRequestHelper { public static function sendBatchRequest( ?array $requests, ?Client $client - ):array { + ): array { return Pool::batch($client, $requests); } @@ -358,7 +360,7 @@ class HttpRequestHelper { ?CookieJar $cookies = null, ?bool $stream = false, ?int $timeout = 0 - ):Client { + ): Client { $options = []; if ($user !== null) { $options['auth'] = [$user, $password]; @@ -396,7 +398,7 @@ class HttpRequestHelper { ?string $method = 'GET', ?array $headers = null, $body = null - ):RequestInterface { + ): RequestInterface { if ($headers === null) { $headers = []; } @@ -449,7 +451,7 @@ class HttpRequestHelper { ?array $config = null, ?CookieJar $cookies = null, ?bool $stream = false - ):ResponseInterface { + ): ResponseInterface { return self::sendRequest( $url, $xRequestId, @@ -491,7 +493,7 @@ class HttpRequestHelper { ?array $config = null, ?CookieJar $cookies = null, ?bool $stream = false - ):ResponseInterface { + ): ResponseInterface { return self::sendRequest( $url, $xRequestId, @@ -533,7 +535,7 @@ class HttpRequestHelper { ?array $config = null, ?CookieJar $cookies = null, ?bool $stream = false - ):ResponseInterface { + ): ResponseInterface { return self::sendRequest( $url, $xRequestId, @@ -576,7 +578,7 @@ class HttpRequestHelper { ?array $config = null, ?CookieJar $cookies = null, ?bool $stream = false - ):ResponseInterface { + ): ResponseInterface { return self::sendRequest( $url, $xRequestId, @@ -605,7 +607,7 @@ class HttpRequestHelper { * @return SimpleXMLElement * @throws Exception */ - public static function getResponseXml(ResponseInterface $response, ?string $exceptionText = ''):SimpleXMLElement { + public static function getResponseXml(ResponseInterface $response, ?string $exceptionText = ''): SimpleXMLElement { // rewind just to make sure we can reparse it in case it was parsed already... $response->getBody()->rewind(); $contents = $response->getBody()->getContents(); @@ -647,7 +649,7 @@ class HttpRequestHelper { * * @return array */ - public static function parseResponseAsXml(ResponseInterface $response):array { + public static function parseResponseAsXml(ResponseInterface $response): array { // rewind so that we can reparse it if it was parsed already $response->getBody()->rewind(); $body = $response->getBody()->getContents(); diff --git a/tests/acceptance/TestHelpers/OcisConfigHelper.php b/tests/acceptance/TestHelpers/OcisConfigHelper.php index 70e49b01458..5d3ac479af3 100644 --- a/tests/acceptance/TestHelpers/OcisConfigHelper.php +++ b/tests/acceptance/TestHelpers/OcisConfigHelper.php @@ -56,7 +56,11 @@ class OcisConfigHelper { try { $response = $client->send($request); } catch (ConnectException $e) { - throw new \Error("Cannot connect to the ociswrapper at the moment, make sure that ociswrapper is running before proceeding with the test run.\n" . $e->getMessage()); + throw new \Error( + "Cannot connect to the ociswrapper at the moment," + . "make sure that ociswrapper is running before proceeding with the test run.\n" + . $e->getMessage() + ); } catch (GuzzleException $ex) { $response = $ex->getResponse(); diff --git a/tests/acceptance/TestHelpers/OcisHelper.php b/tests/acceptance/TestHelpers/OcisHelper.php index c16a4e2638d..ff75a2c97fa 100644 --- a/tests/acceptance/TestHelpers/OcisHelper.php +++ b/tests/acceptance/TestHelpers/OcisHelper.php @@ -87,7 +87,7 @@ class OcisHelper { /** * @return bool */ - public static function isTestingOnReva():bool { + public static function isTestingOnReva(): bool { return (\getenv("TEST_REVA") === "true"); } @@ -106,7 +106,7 @@ class OcisHelper { * @return string * @throws Exception */ - public static function getStorageDriver():string { + public static function getStorageDriver(): string { $storageDriver = (\getenv("STORAGE_DRIVER")); if ($storageDriver === false) { return StorageDriver::OWNCLOUD; @@ -166,7 +166,7 @@ class OcisHelper { * * @return void */ - public static function recurseCopy(?string $source, ?string $destination):void { + public static function recurseCopy(?string $source, ?string $destination): void { $dir = \opendir($source); @\mkdir($destination); while (($file = \readdir($dir)) !== false) { @@ -184,7 +184,7 @@ class OcisHelper { /** * @return int */ - public static function getLdapPort():int { + public static function getLdapPort(): int { $port = \getenv("REVA_LDAP_PORT"); return $port ? (int)$port : 636; } @@ -192,7 +192,7 @@ class OcisHelper { /** * @return bool */ - public static function useSsl():bool { + public static function useSsl(): bool { $useSsl = \getenv("REVA_LDAP_USESSL"); if ($useSsl === false) { return (self::getLdapPort() === 636); @@ -204,7 +204,7 @@ class OcisHelper { /** * @return string */ - public static function getBaseDN():string { + public static function getBaseDN(): string { $dn = \getenv("REVA_LDAP_BASE_DN"); return $dn ?: "dc=owncloud,dc=com"; } @@ -212,7 +212,7 @@ class OcisHelper { /** * @return string */ - public static function getGroupsOU():string { + public static function getGroupsOU(): string { $ou = \getenv("REVA_LDAP_GROUPS_OU"); return $ou ?: "TestGroups"; } @@ -220,7 +220,7 @@ class OcisHelper { /** * @return string */ - public static function getUsersOU():string { + public static function getUsersOU(): string { $ou = \getenv("REVA_LDAP_USERS_OU"); return $ou ?: "TestUsers"; } @@ -228,14 +228,14 @@ class OcisHelper { /** * @return string */ - public static function getGroupSchema():string { + public static function getGroupSchema(): string { $schema = \getenv("REVA_LDAP_GROUP_SCHEMA"); return $schema ?: "rfc2307"; } /** * @return string */ - public static function getHostname():string { + public static function getHostname(): string { $hostname = \getenv("REVA_LDAP_HOSTNAME"); return $hostname ?: "localhost"; } @@ -243,7 +243,7 @@ class OcisHelper { /** * @return string */ - public static function getBindDN():string { + public static function getBindDN(): string { $dn = \getenv("REVA_LDAP_BIND_DN"); return $dn ?: "cn=admin,dc=owncloud,dc=com"; } @@ -251,7 +251,7 @@ class OcisHelper { /** * @return string */ - public static function getBindPassword():string { + public static function getBindPassword(): string { $pw = \getenv("REVA_LDAP_BIND_PASSWORD"); return $pw ?: ""; } @@ -259,7 +259,7 @@ class OcisHelper { /** * @return string */ - private static function getOcisRevaDataRoot():string { + private static function getOcisRevaDataRoot(): string { $root = \getenv("OCIS_REVA_DATA_ROOT"); if ($root === false || $root === "") { $root = "/var/tmp/ocis/owncloud/"; @@ -275,7 +275,7 @@ class OcisHelper { * * @return bool */ - private static function recurseRmdir(?string $dir):bool { + private static function recurseRmdir(?string $dir): bool { if (\file_exists($dir) === true) { $files = \array_diff(\scandir($dir), ['.', '..']); foreach ($files as $file) { @@ -307,7 +307,7 @@ class OcisHelper { ?string $user, ?string $password, ?string $xRequestId = '' - ):void { + ): void { HttpRequestHelper::get( $baseUrl . "/ocs/v2.php/apps/notifications/api/v1/notifications", $xRequestId, diff --git a/tests/acceptance/TestHelpers/OcsApiHelper.php b/tests/acceptance/TestHelpers/OcsApiHelper.php index 27ba2d1d1eb..eea8af284fd 100644 --- a/tests/acceptance/TestHelpers/OcsApiHelper.php +++ b/tests/acceptance/TestHelpers/OcsApiHelper.php @@ -56,7 +56,7 @@ class OcsApiHelper { $body = [], ?int $ocsApiVersion = 2, ?array $headers = [] - ):ResponseInterface { + ): ResponseInterface { $fullUrl = $baseUrl; if (\substr($fullUrl, -1) !== '/') { $fullUrl .= '/'; @@ -86,7 +86,7 @@ class OcsApiHelper { $body = [], ?int $ocsApiVersion = 2, ?array $headers = [] - ):RequestInterface { + ): RequestInterface { $fullUrl = $baseUrl; if (\substr($fullUrl, -1) !== '/') { $fullUrl .= '/'; diff --git a/tests/acceptance/TestHelpers/SettingsHelper.php b/tests/acceptance/TestHelpers/SettingsHelper.php index d6a31328b01..3f53dd13321 100644 --- a/tests/acceptance/TestHelpers/SettingsHelper.php +++ b/tests/acceptance/TestHelpers/SettingsHelper.php @@ -55,7 +55,13 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getBundlesList(string $baseUrl, string $user, string $password, string $xRequestId, array $headers = []): ResponseInterface { + public static function getBundlesList( + string $baseUrl, + string $user, + string $password, + string $xRequestId, + array $headers = [] + ): ResponseInterface { $fullUrl = self::buildFullUrl($baseUrl, "bundles-list"); return HttpRequestHelper::post( $fullUrl, @@ -79,7 +85,13 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getBundleByName(string $baseUrl, string $user, string $password, string $bundleName, string $xRequestId): array { + public static function getBundleByName( + string $baseUrl, + string $user, + string $password, + string $bundleName, + string $xRequestId + ): array { $response = self::getBundlesList($baseUrl, $user, $password, $xRequestId); Assert::assertEquals(201, $response->getStatusCode(), "Failed to get bundles list"); @@ -104,7 +116,13 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getRolesList(string $baseUrl, string $user, string $password, string $xRequestId, array $headers = []): ResponseInterface { + public static function getRolesList( + string $baseUrl, + string $user, + string $password, + string $xRequestId, + array $headers = [] + ): ResponseInterface { $fullUrl = self::buildFullUrl($baseUrl, "roles-list"); return HttpRequestHelper::post( $fullUrl, @@ -130,7 +148,15 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function assignRoleToUser(string $baseUrl, string $user, string $password, string $assigneeId, string $roleId, string $xRequestId, array $headers = []): ResponseInterface { + public static function assignRoleToUser( + string $baseUrl, + string $user, + string $password, + string $assigneeId, + string $roleId, + string $xRequestId, + array $headers = [] + ): ResponseInterface { $fullUrl = self::buildFullUrl($baseUrl, "assignments-add"); $body = json_encode(["account_uuid" => $assigneeId, "role_id" => $roleId], JSON_THROW_ON_ERROR); return HttpRequestHelper::post( @@ -156,7 +182,14 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getAssignmentsList(string $baseUrl, string $user, string $password, string $userId, string $xRequestId, array $headers = []): ResponseInterface { + public static function getAssignmentsList( + string $baseUrl, + string $user, + string $password, + string $userId, + string $xRequestId, + array $headers = [] + ): ResponseInterface { $fullUrl = self::buildFullUrl($baseUrl, "assignments-list"); $body = json_encode(["account_uuid" => $userId], JSON_THROW_ON_ERROR); return HttpRequestHelper::post( @@ -181,7 +214,13 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getValuesList(string $baseUrl, string $user, string $password, string $xRequestId, array $headers = []): ResponseInterface { + public static function getValuesList( + string $baseUrl, + string $user, + string $password, + string $xRequestId, + array $headers = [] + ): ResponseInterface { $fullUrl = self::buildFullUrl($baseUrl, "values-list"); $body = json_encode(["account_uuid" => "me"], JSON_THROW_ON_ERROR); return HttpRequestHelper::post( @@ -205,7 +244,12 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getAutoAcceptSharesSettingValue(string $baseUrl, string $user, string $password, string $xRequestId): bool { + public static function getAutoAcceptSharesSettingValue( + string $baseUrl, + string $user, + string $password, + string $xRequestId + ): bool { $response = self::getValuesList($baseUrl, $user, $password, $xRequestId); Assert::assertEquals(201, $response->getStatusCode(), "Failed to get values list"); @@ -235,7 +279,12 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function getLanguageSettingValue(string $baseUrl, string $user, string $password, string $xRequestId): string { + public static function getLanguageSettingValue( + string $baseUrl, + string $user, + string $password, + string $xRequestId + ): string { $response = self::getValuesList($baseUrl, $user, $password, $xRequestId); Assert::assertEquals(201, $response->getStatusCode(), "Failed to get values list"); @@ -267,7 +316,14 @@ class SettingsHelper { * @throws GuzzleException * @throws Exception */ - public static function updateSettings(string $baseUrl, string $user, string $password, string $body, string $xRequestId, array $headers = []): ResponseInterface { + public static function updateSettings( + string $baseUrl, + string $user, + string $password, + string $body, + string $xRequestId, + array $headers = [] + ): ResponseInterface { $fullUrl = self::buildFullUrl($baseUrl, "values-save"); return HttpRequestHelper::post( $fullUrl, diff --git a/tests/acceptance/TestHelpers/SetupHelper.php b/tests/acceptance/TestHelpers/SetupHelper.php index d6652040158..e927e7e771f 100644 --- a/tests/acceptance/TestHelpers/SetupHelper.php +++ b/tests/acceptance/TestHelpers/SetupHelper.php @@ -43,7 +43,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { * * @return array of suite context parameters */ - public static function getSuiteParameters(HookScope $scope):array { + public static function getSuiteParameters(HookScope $scope): array { return $scope->getEnvironment()->getSuite() ->getSettings() ['context'] ['parameters']; } @@ -90,7 +90,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $adminUsername, ?string $adminPassword, ?string $xRequestId = '' - ):SimpleXMLElement { + ): SimpleXMLElement { $result = OcsApiHelper::sendRequest( $baseUrl, $adminUsername, @@ -122,7 +122,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $adminUsername, ?string $adminPassword, ?string $xRequestId = '' - ):string { + ): string { $sysInfo = self::getSysInfo( $baseUrl, $adminUsername, @@ -141,7 +141,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { * @return string * @throws Exception */ - private static function checkAdminUsername(?string $adminUsername, ?string $callerName):?string { + private static function checkAdminUsername(?string $adminUsername, ?string $callerName): ?string { if (self::$adminUsername === null && $adminUsername === null ) { @@ -162,7 +162,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { * @return string * @throws Exception */ - private static function checkAdminPassword(?string $adminPassword, ?string $callerName):string { + private static function checkAdminPassword(?string $adminPassword, ?string $callerName): string { if (self::$adminPassword === null && $adminPassword === null ) { @@ -183,7 +183,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { * @return string * @throws Exception */ - private static function checkBaseUrl(?string $baseUrl, ?string $callerName):?string { + private static function checkBaseUrl(?string $baseUrl, ?string $callerName): ?string { if (self::$baseUrl === null && $baseUrl === null ) { @@ -215,7 +215,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $baseUrl = null, ?string $adminUsername = null, ?string $adminPassword = null - ):void { + ): void { $baseUrl = self::checkBaseUrl($baseUrl, "mkDirOnServer"); $adminUsername = self::checkAdminUsername($adminUsername, "mkDirOnServer"); $adminPassword = self::checkAdminPassword($adminPassword, "mkDirOnServer"); @@ -254,7 +254,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $baseUrl = null, ?string $adminUsername = null, ?string $adminPassword = null - ):void { + ): void { $baseUrl = self::checkBaseUrl($baseUrl, "rmDirOnServer"); $adminUsername = self::checkAdminUsername($adminUsername, "rmDirOnServer"); $adminPassword = self::checkAdminPassword($adminPassword, "rmDirOnServer"); @@ -295,7 +295,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $baseUrl = null, ?string $adminUsername = null, ?string $adminPassword = null - ):void { + ): void { $baseUrl = self::checkBaseUrl($baseUrl, "createFileOnServer"); $adminUsername = self::checkAdminUsername($adminUsername, "createFileOnServer"); $adminPassword = self::checkAdminPassword($adminPassword, "createFileOnServer"); @@ -337,7 +337,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $baseUrl = null, ?string $adminUsername = null, ?string $adminPassword = null - ):void { + ): void { $baseUrl = self::checkBaseUrl($baseUrl, "deleteFileOnServer"); $adminUsername = self::checkAdminUsername($adminUsername, "deleteFileOnServer"); $adminPassword = self::checkAdminPassword($adminPassword, "deleteFileOnServer"); @@ -377,7 +377,7 @@ class SetupHelper extends \PHPUnit\Framework\Assert { ?string $baseUrl = null, ?string $adminUsername = null, ?string $adminPassword = null - ):string { + ): string { $baseUrl = self::checkBaseUrl($baseUrl, "readFile"); $adminUsername = self::checkAdminUsername( $adminUsername, diff --git a/tests/acceptance/TestHelpers/SharingHelper.php b/tests/acceptance/TestHelpers/SharingHelper.php index 07a2e74f53a..67fe337cfa4 100644 --- a/tests/acceptance/TestHelpers/SharingHelper.php +++ b/tests/acceptance/TestHelpers/SharingHelper.php @@ -192,7 +192,7 @@ class SharingHelper { * @throws InvalidArgumentException * */ - public static function getPermissionSum($permissions):int { + public static function getPermissionSum($permissions): int { if (\is_numeric($permissions)) { // Allow any permission number so that test scenarios can // specifically test invalid permission values @@ -230,7 +230,7 @@ class SharingHelper { * @throws InvalidArgumentException * */ - public static function getShareType($shareType):int { + public static function getShareType($shareType): int { if (\array_key_exists($shareType, self::SHARE_TYPES)) { return self::SHARE_TYPES[$shareType]; } else { @@ -259,7 +259,7 @@ class SharingHelper { public static function getLastShareIdFromResponse( SimpleXMLElement $responseXmlObject, string $errorMessage = "cannot find share id in response" - ):string { + ): string { $xmlPart = $responseXmlObject->xpath("//data/element[last()]/id"); if (!\is_array($xmlPart) || (\count($xmlPart) === 0)) { diff --git a/tests/acceptance/TestHelpers/UploadHelper.php b/tests/acceptance/TestHelpers/UploadHelper.php index e85319fc59a..fe3577ff7e7 100644 --- a/tests/acceptance/TestHelpers/UploadHelper.php +++ b/tests/acceptance/TestHelpers/UploadHelper.php @@ -138,7 +138,7 @@ class UploadHelper extends Assert { * * @return array $string */ - public static function chunkFile(?string $file, ?int $noOfChunks = 1):array { + public static function chunkFile(?string $file, ?int $noOfChunks = 1): array { $size = \filesize($file); $chunkSize = \ceil($size / $noOfChunks); $chunks = []; @@ -162,7 +162,7 @@ class UploadHelper extends Assert { * * @return void */ - public static function createFileSpecificSize(?string $name, ?int $size):void { + public static function createFileSpecificSize(?string $name, ?int $size): void { if (\file_exists($name)) { \unlink($name); } @@ -190,7 +190,7 @@ class UploadHelper extends Assert { * * @return void */ - public static function createFileWithText(?string $name, ?string $text):void { + public static function createFileWithText(?string $name, ?string $text): void { $file = \fopen($name, 'w'); \fwrite($file, $text); \fclose($file); @@ -207,7 +207,7 @@ class UploadHelper extends Assert { * * @return string */ - public static function getUploadFilesDir(?string $name):string { + public static function getUploadFilesDir(?string $name): string { return \getenv("FILES_FOR_UPLOAD") . $name; } } diff --git a/tests/acceptance/TestHelpers/UserHelper.php b/tests/acceptance/TestHelpers/UserHelper.php index e38e05981a7..a35a5b73c88 100644 --- a/tests/acceptance/TestHelpers/UserHelper.php +++ b/tests/acceptance/TestHelpers/UserHelper.php @@ -56,7 +56,7 @@ class UserHelper { string $adminPassword, string $xRequestId = '', ?int $ocsApiVersion = 2 - ):ResponseInterface { + ): ResponseInterface { return OcsApiHelper::sendRequest( $baseUrl, $adminUser, @@ -90,7 +90,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId = '', ?int $ocsApiVersion = 2 - ):array { + ): array { $requests = []; $client = HttpRequestHelper::createClient( $adminUser, @@ -143,7 +143,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId = '', ?int $ocsApiVersion = 2 - ):ResponseInterface { + ): ResponseInterface { return OcsApiHelper::sendRequest( $baseUrl, $adminUser, @@ -175,7 +175,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId = '', ?int $ocsApiVersion = 2 - ):ResponseInterface { + ): ResponseInterface { return OcsApiHelper::sendRequest( $baseUrl, $adminUser, @@ -209,7 +209,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId = '', ?int $ocsApiVersion = 2 - ):ResponseInterface { + ): ResponseInterface { return OcsApiHelper::sendRequest( $baseUrl, $adminUser, @@ -243,7 +243,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId, ?int $ocsApiVersion = 2 - ):ResponseInterface { + ): ResponseInterface { return OcsApiHelper::sendRequest( $baseUrl, $adminUser, @@ -273,7 +273,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId = '', ?string $search ="" - ):ResponseInterface { + ): ResponseInterface { return OcsApiHelper::sendRequest( $baseUrl, $adminUser, @@ -301,7 +301,7 @@ class UserHelper { ?string $adminPassword, ?string $xRequestId = '', ?string $search = "" - ):array { + ): array { $result = self::getGroups( $baseUrl, $adminUser, diff --git a/tests/acceptance/TestHelpers/WebDavHelper.php b/tests/acceptance/TestHelpers/WebDavHelper.php index 4297e18feb5..ac9c2519827 100644 --- a/tests/acceptance/TestHelpers/WebDavHelper.php +++ b/tests/acceptance/TestHelpers/WebDavHelper.php @@ -86,7 +86,7 @@ class WebDavHelper { */ public static function removeSpaceIdReferenceForUser( ?string $user - ):void { + ): void { if (\array_key_exists($user, self::$spacesIdRef)) { unset(self::$spacesIdRef[$user]); } @@ -245,7 +245,7 @@ class WebDavHelper { ?int $davPathVersionToUse = self::DAV_VERSION_NEW, ?string $doDavRequestAsUser = null, ?array $headers = [] - ):ResponseInterface { + ): ResponseInterface { $body = self::getBodyForPropfind($properties); $folderDepth = (string) $folderDepth; if ($folderDepth !== '0' && $folderDepth !== '1' && $folderDepth !== 'infinity') { @@ -307,7 +307,7 @@ class WebDavHelper { ?int $davPathVersionToUse = self::DAV_VERSION_NEW, ?string $type="files", ?string $spaceId = null, - ):ResponseInterface { + ): ResponseInterface { if ($namespaceString !== null) { $ns = self::parseNamespace($namespaceString); $propertyBody = "<$ns->prefix:$propertyName" . @@ -348,7 +348,7 @@ class WebDavHelper { * * @return array */ - public static function getPropertyWithNamespaceInfo(string $namespaceString = "", string $property = ""):array { + public static function getPropertyWithNamespaceInfo(string $namespaceString = "", string $property = ""): array { $namespace = ""; $namespacePrefix = ""; if (\is_int($namespaceString)) { @@ -396,7 +396,7 @@ class WebDavHelper { ?int $davPathVersion = null, ?string $namespaceString = null, ?string $type="files" - ):ResponseInterface { + ): ResponseInterface { $propertyBody = ""; foreach ($propertiesArray as $propertyArray) { $property = $propertyArray["propertyName"]; @@ -466,7 +466,7 @@ class WebDavHelper { ?array $properties = null, ?string $type = "files", ?int $davPathVersionToUse = self::DAV_VERSION_NEW - ):ResponseInterface { + ): ResponseInterface { if (!$properties) { $properties = [ 'd:getetag', 'd:resourcetype' @@ -493,7 +493,7 @@ class WebDavHelper { * @return string * @throws Exception */ - public static function generateUUIDv4():string { + public static function generateUUIDv4(): string { // generate 16 bytes (128 bits) of random data or use the data passed into the function. $data = random_bytes(16); \assert(\strlen($data) == 16); @@ -516,7 +516,12 @@ class WebDavHelper { * @throws GuzzleException * @throws Exception */ - public static function getPersonalSpaceIdForUser(string $baseUrl, string $user, string $password, string $xRequestId):string { + public static function getPersonalSpaceIdForUser( + string $baseUrl, + string $user, + string $password, + string $xRequestId + ): string { if (\array_key_exists($user, self::$spacesIdRef) && \array_key_exists("personal", self::$spacesIdRef[$user])) { return self::$spacesIdRef[$user]["personal"]; } @@ -546,14 +551,21 @@ class WebDavHelper { $user, $password ); - Assert::assertEquals(207, $response->getStatusCode(), "PROPFIND for user '$user' failed so the personal space id cannot be discovered"); + Assert::assertEquals( + 207, + $response->getStatusCode(), + "PROPFIND for user '$user' failed so the personal space id cannot be discovered" + ); $responseXmlObject = HttpRequestHelper::getResponseXml( $response, __METHOD__ ); $xmlPart = $responseXmlObject->xpath("/d:multistatus/d:response[1]/d:propstat/d:prop/oc:spaceid"); - Assert::assertNotEmpty($xmlPart, "The 'oc:spaceid' for user '$user' was not found in the PROPFIND response"); + Assert::assertNotEmpty( + $xmlPart, + "The 'oc:spaceid' for user '$user' was not found in the PROPFIND response" + ); $personalSpaceId = $xmlPart[0]->__toString(); } @@ -577,7 +589,12 @@ class WebDavHelper { * @return string * @throws Exception|GuzzleException */ - public static function getPersonalSpaceIdForUserOrFakeIfNotFound(string $baseUrl, string $user, string $password, string $xRequestId):string { + public static function getPersonalSpaceIdForUserOrFakeIfNotFound( + string $baseUrl, + string $user, + string $password, + string $xRequestId + ): string { if (\str_starts_with($user, "non-exist") || \str_starts_with($user, "nonexist")) { return self::generateUUIDv4(); } @@ -641,7 +658,7 @@ class WebDavHelper { ?array $urlParameter = [], ?string $doDavRequestAsUser = null, ?bool $isGivenStep = false, - ):ResponseInterface { + ): ResponseInterface { $baseUrl = self::sanitizeUrl($baseUrl, true); // We need to manipulate and use path as a string. @@ -651,7 +668,9 @@ class WebDavHelper { } // get space id if testing with spaces dav - if ($spaceId === null && $davPathVersionToUse === self::DAV_VERSION_SPACES && !\in_array($type, ["public-files", "versions"])) { + if ($spaceId === null && $davPathVersionToUse === self::DAV_VERSION_SPACES + && !\in_array($type, ["public-files", "versions"]) + ) { $path = \ltrim($path, "/"); if (\str_starts_with($path, "Shares/")) { $spaceId = GraphHelper::SHARES_SPACE_ID; @@ -667,7 +686,9 @@ class WebDavHelper { } $suffixPath = $user; - if ($davPathVersionToUse === self::DAV_VERSION_SPACES && !\in_array($type, ["archive", "versions", "public-files"])) { + if ($davPathVersionToUse === self::DAV_VERSION_SPACES + && !\in_array($type, ["archive", "versions", "public-files"]) + ) { $suffixPath = $spaceId; } elseif ($type === "versions") { // $path is file-id in case of versions @@ -751,7 +772,7 @@ class WebDavHelper { int $davPathVersion, ?string $userOrItemIdOrSpaceIdOrToken = null, ?string $type = "files" - ):string { + ): string { switch ($type) { case 'archive': return self::prefixRemotePhp("dav/archive/$userOrItemIdOrSpaceIdOrToken/files"); @@ -807,7 +828,7 @@ class WebDavHelper { * * @return string */ - public static function sanitizeUrl(?string $url, ?bool $trailingSlash = false):string { + public static function sanitizeUrl(?string $url, ?bool $trailingSlash = false): string { if ($trailingSlash === true) { $url = $url . "/"; } else { @@ -834,7 +855,7 @@ class WebDavHelper { ?string $token, ?string $xRequestId = '', ?int $davVersionToUse = self::DAV_VERSION_NEW - ):string { + ): string { $response = self::propfind( $baseUrl, null, @@ -879,7 +900,7 @@ class WebDavHelper { ?string $xRequestId = '', ?int $davPathVersionToUse = self::DAV_VERSION_NEW, ?string $spaceId = null, - ):string { + ): string { $response = self::propfind( $baseUrl, $user, @@ -900,7 +921,9 @@ class WebDavHelper { Assert::assertArrayHasKey( 0, $xmlPart, - __METHOD__ . " XML part does not have key 0. Expected a value at index 0 of 'xmlPart' but, found: " . json_encode($xmlPart) + __METHOD__ + . " XML part does not have key 0. Expected a value at index 0 of 'xmlPart' but, found: " + . json_encode($xmlPart) ); $mtime = new DateTime($xmlPart[0]->__toString()); return $mtime->format('U'); diff --git a/tests/acceptance/bootstrap/ArchiverContext.php b/tests/acceptance/bootstrap/ArchiverContext.php index 48f15eaf50f..a5cd7ac9fe7 100644 --- a/tests/acceptance/bootstrap/ArchiverContext.php +++ b/tests/acceptance/bootstrap/ArchiverContext.php @@ -43,6 +43,7 @@ class ArchiverContext implements Context { * @var FeatureContext */ private FeatureContext $featureContext; + private SpacesContext $spacesContext; /** * @BeforeScenario @@ -58,6 +59,7 @@ class ArchiverContext implements Context { $environment = $scope->getEnvironment(); // Get all the contexts you need in this context $this->featureContext = BehatHelper::getContext($scope, $environment, 'FeatureContext'); + $this->spacesContext = BehatHelper::getContext($scope, $environment, 'SpacesContext'); } /** @@ -120,13 +122,15 @@ class ArchiverContext implements Context { case 'id': case 'ids': return 'id=' . $this->featureContext->getFileIdForPath($user, $resource); + case 'remoteItemIds': + return 'id=' . $this->spacesContext->getSharesRemoteItemId($user, $resource); case 'path': case 'paths': return 'path=' . $resource; default: throw new Exception( '"' . $addressType . - '" is not a legal value for $addressType, must be id|ids|path|paths' + '" is not a legal value for $addressType, must be id|ids|remoteItemIds|path|paths' ); } } @@ -160,7 +164,9 @@ class ArchiverContext implements Context { foreach ($headersTable as $row) { $headers[$row['header']] = $row ['value']; } - $this->featureContext->setResponse($this->downloadArchive($user, $resource, $addressType, $archiveType, null, $headers)); + $this->featureContext->setResponse( + $this->downloadArchive($user, $resource, $addressType, $archiveType, null, $headers) + ); } /** @@ -263,7 +269,7 @@ class ArchiverContext implements Context { * * @throws Exception */ - public function theDownloadedArchiveShouldContainTheseFiles(string $type, TableNode $expectedFiles):void { + public function theDownloadedArchiveShouldContainTheseFiles(string $type, TableNode $expectedFiles): void { $this->featureContext->verifyTableNodeColumns($expectedFiles, ['name', 'content']); $contents = $this->featureContext->getResponse()->getBody()->getContents(); $tempFile = \tempnam(\sys_get_temp_dir(), 'OcAcceptanceTests_'); @@ -276,7 +282,7 @@ class ArchiverContext implements Context { $tar = $this->getArchiveClass($type); $tar->open($tempFile); $archiveData = $tar->contents(); - + // extract the archive $tar->open($tempFile); $tar->extract($tempExtractFolder); @@ -291,13 +297,22 @@ class ArchiverContext implements Context { if ($expectedPath === $actualPath) { if (!$info->getIsdir()) { - $fileContent = \file_get_contents("$tempExtractFolder/$actualPath"); - Assert::assertEquals( - $expectedItem['content'], - $fileContent, - __METHOD__ . - " content of '" . $expectedPath . "' not as expected" - ); + $fileFullPath = "$tempExtractFolder/$actualPath"; + $fileMimeType = \mime_content_type($fileFullPath); + + if ($fileMimeType === "text/plain") { + $fileContent = \file_get_contents($fileFullPath); + Assert::assertEquals( + $expectedItem['content'], + $fileContent, + __METHOD__ . " content of '" . $expectedPath . "' not as expected" + ); + } else { + Assert::assertFileExists( + $fileFullPath, + __METHOD__ . " File '" . $expectedPath . "' is not in the downloaded archive." + ); + } } $found = true; break; diff --git a/tests/acceptance/bootstrap/AuthAppContext.php b/tests/acceptance/bootstrap/AuthAppContext.php index ad95dc02dbf..ce562b6c255 100644 --- a/tests/acceptance/bootstrap/AuthAppContext.php +++ b/tests/acceptance/bootstrap/AuthAppContext.php @@ -68,7 +68,7 @@ class AuthAppContext implements Context { } /** - * @Given user :user has created app token with expiration time :expiration + * @Given user :user has created app token with expiration time :expiration using the auth-app API * * @param string $user * @param string $expiration diff --git a/tests/acceptance/bootstrap/AuthContext.php b/tests/acceptance/bootstrap/AuthContext.php index 72346012c8e..d0a256f1b23 100644 --- a/tests/acceptance/bootstrap/AuthContext.php +++ b/tests/acceptance/bootstrap/AuthContext.php @@ -40,7 +40,7 @@ class AuthContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context @@ -141,7 +141,7 @@ class AuthContext implements Context { * * @return void */ - public function userRequestsURLWithNoAuth(string $url, string $method):void { + public function userRequestsURLWithNoAuth(string $url, string $method): void { $this->featureContext->setResponse($this->sendRequest($url, $method)); } @@ -156,7 +156,12 @@ class AuthContext implements Context { * @return void * @throws JsonException */ - public function userRequestsEndpointsWithBodyAndNoAuthThenStatusCodeAboutUser(string $method, string $body, string $ofUser, TableNode $table): void { + public function userRequestsEndpointsWithBodyAndNoAuthThenStatusCodeAboutUser( + string $method, + string $body, + string $ofUser, + TableNode $table + ): void { $ofUser = \strtolower($this->featureContext->getActualUsername($ofUser)); $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); foreach ($table->getHash() as $row) { @@ -180,7 +185,11 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser(string $method, string $ofUser, TableNode $table): void { + public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser( + string $method, + string $ofUser, + TableNode $table + ): void { $ofUser = \strtolower($this->featureContext->getActualUsername($ofUser)); $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); foreach ($table->getHash() as $row) { @@ -203,8 +212,8 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsEndpointsWithNoAuthentication(string $method, TableNode $table):void { - $this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']); + public function userRequestsEndpointsWithNoAuthentication(string $method, TableNode $table): void { + $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); foreach ($table->getHash() as $row) { $this->featureContext->setResponse( $this->sendRequest( @@ -216,6 +225,29 @@ class AuthContext implements Context { } } + /** + * @When a user requests these URLs with :method and no authentication + * + * @param $method + * @param TableNode $table + * + * @return void + * @throws Exception + */ + public function aUserRequestsTheseUrlsWithAndNoAuthentication($method, TableNode $table): void { + $this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']); + foreach ($table->getHash() as $row) { + $this->featureContext->setResponse( + HttpRequestHelper::sendRequest( + $this->featureContext->substituteInLineCodes($row['endpoint']), + $this->featureContext->getStepLineRef(), + $method + ) + ); + $this->featureContext->pushToLastStatusCodesArrays(); + } + } + /** * @When the user :user requests these endpoints with :method with basic auth * @@ -226,7 +258,7 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsEndpointsWithBasicAuth(string $user, string $method, TableNode $table):void { + public function userRequestsEndpointsWithBasicAuth(string $user, string $method, TableNode $table): void { $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); foreach ($table->getHash() as $row) { $response = $this->requestUrlWithBasicAuth($user, $row['endpoint'], $method); @@ -253,7 +285,7 @@ class AuthContext implements Context { string $property, string $ofUser, TableNode $table - ):void { + ): void { $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); foreach ($table->getHash() as $row) { @@ -276,7 +308,7 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function theAdminRequestsTheseEndpointsWithMethod(string $method, TableNode $table):void { + public function theAdminRequestsTheseEndpointsWithMethod(string $method, TableNode $table): void { $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); foreach ($table->getHash() as $row) { $response = $this->requestUrlWithBasicAuth( @@ -302,7 +334,7 @@ class AuthContext implements Context { string $user, string $url, string $method - ):void { + ): void { $response = $this->requestUrlWithBasicAuth($user, $url, $method); $this->featureContext->setResponse($response); } @@ -318,7 +350,12 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsURLWithUsingBasicAuthAndDepthHeader(string $user, string $url, string $method, TableNode $headersTable):void { + public function userRequestsURLWithUsingBasicAuthAndDepthHeader( + string $user, + string $url, + string $method, + TableNode $headersTable + ): void { $user = $this->featureContext->getActualUsername($user); $url = $this->featureContext->substituteInLineCodes( $url, @@ -390,7 +427,7 @@ class AuthContext implements Context { string $password, string $ofUser, TableNode $table - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $ofUser = $this->featureContext->getActualUsername($ofUser); $this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['destination']); @@ -407,7 +444,8 @@ class AuthContext implements Context { $row['destination'], $ofUser ); - $headers['Destination'] = $this->featureContext->getBaseUrl() . "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/")); + $headers['Destination'] = $this->featureContext->getBaseUrl() + . "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/")); } $response = $this->sendRequest( $row['endpoint'], @@ -440,7 +478,7 @@ class AuthContext implements Context { string $password, string $ofUser, TableNode $table - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $ofUser = $this->featureContext->getActualUsername($ofUser); $this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['destination']); @@ -457,7 +495,8 @@ class AuthContext implements Context { $row['destination'], $ofUser ); - $headers['Destination'] = $this->featureContext->getBaseUrl() . "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/")); + $headers['Destination'] = $this->featureContext->getBaseUrl() + . "/" . WebdavHelper::prefixRemotePhp(\ltrim($destination, "/")); } $response = $this->sendRequest( $row['endpoint'], @@ -482,7 +521,13 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsTheseEndpointsIncludingBodyAboutUser(string $user, string $method, string $body, string $ofUser, TableNode $table):void { + public function userRequestsTheseEndpointsIncludingBodyAboutUser( + string $user, + string $method, + string $body, + string $ofUser, + TableNode $table + ): void { $user = $this->featureContext->getActualUsername($user); $ofUser = $this->featureContext->getActualUsername($ofUser); $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); @@ -520,7 +565,12 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsTheseEndpointsWithoutBodyUsingThePasswordOfUser(string $asUser, string $method, string $ofUser, TableNode $table):void { + public function userRequestsTheseEndpointsWithoutBodyUsingThePasswordOfUser( + string $asUser, + string $method, + string $ofUser, + TableNode $table + ): void { $asUser = $this->featureContext->getActualUsername($asUser); $ofUser = $this->featureContext->getActualUsername($ofUser); $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); @@ -556,7 +606,13 @@ class AuthContext implements Context { * @return void * @throws JsonException */ - public function userRequestsTheseEndpointsIncludingBodyUsingPasswordOfUser(string $asUser, string $method, ?string $body, string $ofUser, TableNode $table):void { + public function userRequestsTheseEndpointsIncludingBodyUsingPasswordOfUser( + string $asUser, + string $method, + ?string $body, + string $ofUser, + TableNode $table + ): void { $asUser = $this->featureContext->getActualUsername($asUser); $ofUser = $this->featureContext->getActualUsername($ofUser); $this->featureContext->verifyTableNodeColumns($table, ['endpoint']); @@ -591,7 +647,12 @@ class AuthContext implements Context { * @return void * @throws Exception */ - public function userRequestsTheseEndpointsAboutUser(string $user, string $method, string $ofUser, TableNode $table):void { + public function userRequestsTheseEndpointsAboutUser( + string $user, + string $method, + string $ofUser, + TableNode $table + ): void { $headers = []; if ($method === 'MOVE' || $method === 'COPY') { $baseUrl = $this->featureContext->getBaseUrl(); @@ -633,7 +694,7 @@ class AuthContext implements Context { string $user, string $endpoint, string $method - ):void { + ): void { $username = $this->featureContext->getActualUsername($user); $endpoint = $this->featureContext->substituteInLineCodes( $endpoint, diff --git a/tests/acceptance/bootstrap/CapabilitiesContext.php b/tests/acceptance/bootstrap/CapabilitiesContext.php index 739c9dee354..8ee6248ec5f 100644 --- a/tests/acceptance/bootstrap/CapabilitiesContext.php +++ b/tests/acceptance/bootstrap/CapabilitiesContext.php @@ -49,7 +49,7 @@ class CapabilitiesContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context @@ -164,7 +164,7 @@ class CapabilitiesContext implements Context { * @return void * @throws Exception */ - public function checkVersionMajorMinorMicroResponse():void { + public function checkVersionMajorMinorMicroResponse(): void { $jsonResponse = $this->featureContext->getJsonDecodedResponseBodyContent(); $versionData = $jsonResponse->ocs->data->version; $versionString = (string) $versionData->string; diff --git a/tests/acceptance/bootstrap/ChecksumContext.php b/tests/acceptance/bootstrap/ChecksumContext.php index 18242e7e794..50a6d58f791 100644 --- a/tests/acceptance/bootstrap/ChecksumContext.php +++ b/tests/acceptance/bootstrap/ChecksumContext.php @@ -47,7 +47,7 @@ class ChecksumContext implements Context { string $source, string $destination, string $checksum - ):ResponseInterface { + ): ResponseInterface { $file = \file_get_contents( $this->featureContext->acceptanceTestsDirLocation() . $source ); @@ -75,8 +75,10 @@ class ChecksumContext implements Context { string $source, string $destination, string $checksum - ):void { - $this->featureContext->setResponse($this->uploadFileToWithChecksumUsingTheAPI($user, $source, $destination, $checksum)); + ): void { + $this->featureContext->setResponse( + $this->uploadFileToWithChecksumUsingTheAPI($user, $source, $destination, $checksum) + ); } /** @@ -94,7 +96,7 @@ class ChecksumContext implements Context { string $source, string $destination, string $checksum - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $response = $this->uploadFileToWithChecksumUsingTheAPI( $user, @@ -118,7 +120,7 @@ class ChecksumContext implements Context { string $content, string $checksum, string $destination - ):ResponseInterface { + ): ResponseInterface { return $this->featureContext->makeDavRequest( $user, 'PUT', @@ -143,7 +145,7 @@ class ChecksumContext implements Context { string $content, string $checksum, string $destination - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $response = $this->uploadFileWithContentAndChecksumToUsingTheAPI($user, $content, $checksum, $destination); $this->featureContext->theHTTPStatusCodeShouldBe(201, '', $response); @@ -157,7 +159,7 @@ class ChecksumContext implements Context { * * @return void */ - public function userRequestsTheChecksumOfViaPropfind(string $user, string $path):void { + public function userRequestsTheChecksumOfViaPropfind(string $user, string $path): void { $this->featureContext->setResponse($this->propfindResourceChecksum($user, $path)); } @@ -168,7 +170,7 @@ class ChecksumContext implements Context { * * @return ResponseInterface */ - public function propfindResourceChecksum(string $user, string $path, ?string $spaceId = null) : ResponseInterface { + public function propfindResourceChecksum(string $user, string $path, ?string $spaceId = null): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $body = ' @@ -199,7 +201,7 @@ class ChecksumContext implements Context { * @return void * @throws Exception */ - public function theWebdavChecksumShouldMatch(string $expectedChecksum):void { + public function theWebdavChecksumShouldMatch(string $expectedChecksum): void { $bodyContents = $this->featureContext->getResponse()->getBody()->getContents(); $this->validateChecksum($bodyContents, $expectedChecksum); } @@ -214,7 +216,11 @@ class ChecksumContext implements Context { * @return void * @throws Exception */ - public function asUserTheWebdavChecksumOfPathViaPropfindShouldMatch(string $user, string $path, string $expectedChecksum):void { + public function asUserTheWebdavChecksumOfPathViaPropfindShouldMatch( + string $user, + string $path, + string $expectedChecksum + ): void { $user = $this->featureContext->getActualUsername($user); $resource = $this->propfindResourceChecksum($user, $path); $bodyContents = $resource->getBody()->getContents(); @@ -226,7 +232,7 @@ class ChecksumContext implements Context { * * @return void */ - public function validateChecksum(string $bodyContents, string $expectedChecksum):void { + public function validateChecksum(string $bodyContents, string $expectedChecksum): void { $service = new Sabre\Xml\Service(); $parsed = $service->parse($bodyContents); @@ -243,7 +249,8 @@ class ChecksumContext implements Context { Assert::assertIsArray( $parsed, - __METHOD__ . " could not parse response as XML. Expected parsed XML to be an array but found " . $bodyContents + __METHOD__ + . " could not parse response as XML. Expected parsed XML to be an array but found " . $bodyContents ); Assert::assertArrayHasKey( 0, @@ -320,7 +327,7 @@ class ChecksumContext implements Context { * @return void * @throws Exception */ - public function theHeaderChecksumShouldMatch(string $expectedChecksum):void { + public function theHeaderChecksumShouldMatch(string $expectedChecksum): void { $headerChecksums = $this->featureContext->getResponse()->getHeader('OC-Checksum'); @@ -360,7 +367,11 @@ class ChecksumContext implements Context { * @return void * @throws Exception */ - public function theHeaderChecksumWhenUserDownloadsFileUsingTheWebdavApiShouldMatch(string $user, string $fileName, string $expectedChecksum):void { + public function theHeaderChecksumWhenUserDownloadsFileUsingTheWebdavApiShouldMatch( + string $user, + string $fileName, + string $expectedChecksum + ): void { $response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName); $headerChecksums = $response->getHeader('OC-Checksum'); @@ -407,7 +418,7 @@ class ChecksumContext implements Context { string $data, string $destination, string $expectedChecksum - ):ResponseInterface { + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $num -= 1; $file = "$destination-chunking-42-$total-$num"; @@ -439,8 +450,15 @@ class ChecksumContext implements Context { string $data, string $destination, string $expectedChecksum - ):void { - $response = $this->uploadChunkFileOfWithToWithChecksum($user, $num, $total, $data, $destination, $expectedChecksum); + ): void { + $response = $this->uploadChunkFileOfWithToWithChecksum( + $user, + $num, + $total, + $data, + $destination, + $expectedChecksum + ); $this->featureContext->setResponse($response); } @@ -463,8 +481,15 @@ class ChecksumContext implements Context { string $data, string $destination, string $expectedChecksum - ):void { - $response = $this->uploadChunkFileOfWithToWithChecksum($user, $num, $total, $data, $destination, $expectedChecksum); + ): void { + $response = $this->uploadChunkFileOfWithToWithChecksum( + $user, + $num, + $total, + $data, + $destination, + $expectedChecksum + ); $this->featureContext->theHTTPStatusCodeShouldBe( [201, 206], '', @@ -482,7 +507,7 @@ class ChecksumContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context diff --git a/tests/acceptance/bootstrap/CliContext.php b/tests/acceptance/bootstrap/CliContext.php index 7e4fe4a4d70..1dae04440c3 100644 --- a/tests/acceptance/bootstrap/CliContext.php +++ b/tests/acceptance/bootstrap/CliContext.php @@ -80,7 +80,11 @@ class CliContext implements Context { * * @return void */ - public function theAdministratorResetsThePasswordOfUserUsingTheCLI(string $status, string $user, string $password): void { + public function theAdministratorResetsThePasswordOfUserUsingTheCLI( + string $status, + string $user, + string $password + ): void { $command = "idm resetpassword -u $user"; $body = [ "command" => $command, @@ -99,7 +103,7 @@ class CliContext implements Context { * * @return void */ - public function theAdministratorDeletesEmptyTrashbinFoldersUsingTheCli():void { + public function theAdministratorDeletesEmptyTrashbinFoldersUsingTheCli(): void { $path = $this->featureContext->getStorageUsersRoot(); $command = "trash purge-empty-dirs -p $path --dry-run=false"; $body = [ @@ -113,7 +117,7 @@ class CliContext implements Context { * * @return void */ - public function theAdministratorChecksTheBackupConsistencyUsingTheCli():void { + public function theAdministratorChecksTheBackupConsistencyUsingTheCli(): void { $path = $this->featureContext->getStorageUsersRoot(); $command = "backup consistency -p $path"; $body = [ @@ -122,6 +126,55 @@ class CliContext implements Context { $this->featureContext->setResponse(CliHelper::runCommand($body)); } + /** + * @When the administrator creates app token for user :user with expiration time :expirationTime using the auth-app CLI + * + * @param string $user + * @param string $expirationTime + * + * @return void + */ + public function theAdministratorCreatesAppTokenForUserWithExpirationTimeUsingTheAuthAppCLI( + string $user, + string $expirationTime + ): void { + $user = $this->featureContext->getActualUserName($user); + $command = "auth-app create --user-name=$user --expiration=$expirationTime"; + $body = [ + "command" => $command + ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); + } + + /** + * @Given user :user has created app token with expiration time :expirationTime using the auth-app CLI + * + * @param string $user + * @param string $expirationTime + * + * @return void + */ + public function userHasCreatedAppTokenWithExpirationTimeUsingTheAuthAppCLI( + string $user, + string $expirationTime + ): void { + $user = $this->featureContext->getActualUserName($user); + $command = "auth-app create --user-name=$user --expiration=$expirationTime"; + $body = [ + "command" => $command + ]; + + $response = CliHelper::runCommand($body); + $this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response); + $jsonResponse = $this->featureContext->getJsonDecodedResponse($response); + Assert::assertSame("OK", $jsonResponse["status"]); + Assert::assertSame( + 0, + $jsonResponse["exitCode"], + "Expected exit code to be 0, but got " . $jsonResponse["exitCode"] + ); + } + /** * @When the administrator removes all the file versions using the CLI * @@ -191,7 +244,7 @@ class CliContext implements Context { * * @return void */ - public function theAdministratorRemovesTheVersionsOfFilesInSpaceUsingSpaceId(string $space):void { + public function theAdministratorRemovesTheVersionsOfFilesInSpaceUsingSpaceId(string $space): void { $path = $this->featureContext->getStorageUsersRoot(); $adminUsername = $this->featureContext->getAdminUsername(); $spaceId = $this->spacesContext->getSpaceIdByName($adminUsername, $space); @@ -214,7 +267,11 @@ class CliContext implements Context { $jsonResponse = $this->featureContext->getJsonDecodedResponse($response); Assert::assertSame("OK", $jsonResponse["status"]); - Assert::assertSame(0, $jsonResponse["exitCode"], "Expected exit code to be 0, but got " . $jsonResponse["exitCode"]); + Assert::assertSame( + 0, + $jsonResponse["exitCode"], + "Expected exit code to be 0, but got " . $jsonResponse["exitCode"] + ); } /** diff --git a/tests/acceptance/bootstrap/CollaborationContext.php b/tests/acceptance/bootstrap/CollaborationContext.php index ce080fe2294..250936fb0c5 100644 --- a/tests/acceptance/bootstrap/CollaborationContext.php +++ b/tests/acceptance/bootstrap/CollaborationContext.php @@ -86,7 +86,13 @@ class CollaborationContext implements Context { * * @throws GuzzleException */ - public function userChecksTheInformationOfFileOfSpaceUsingOffice(string $user, string $file, string $space, string $app, string $viewMode = null): void { + public function userChecksTheInformationOfFileOfSpaceUsingOffice( + string $user, + string $file, + string $space, + string $app, + string $viewMode = null + ): void { $fileId = $this->spacesContext->getFileId($user, $space, $file); $response = \json_decode( CollaborationHelper::sendPOSTRequestToAppOpen( @@ -127,7 +133,12 @@ class CollaborationContext implements Context { * @return void * @throws GuzzleException */ - public function userCreatesFileInsideFolderInSpaceUsingWopiEndpoint(string $user, string $file, string $folder, string $space): void { + public function userCreatesFileInsideFolderInSpaceUsingWopiEndpoint( + string $user, + string $file, + string $folder, + string $space + ): void { $parentContainerId = $this->spacesContext->getResourceId($user, $space, $folder); $this->featureContext->setResponse( CollaborationHelper::createFile( @@ -193,7 +204,10 @@ class CollaborationContext implements Context { * @return void * @throws GuzzleException */ - public function thePublicCreatesAFileInsideTheLastSharedPublicLinkFolderWithPasswordUsingWopiEndpoint(string $file, string $password): void { + public function thePublicCreatesAFileInsideTheLastSharedPublicLinkFolderWithPasswordUsingWopiEndpoint( + string $file, + string $password + ): void { $this->createFile($file, $password); } @@ -208,7 +222,11 @@ class CollaborationContext implements Context { * @return void * @throws GuzzleException */ - public function thePublicCreatesAFileInsideFolderInTheLastSharedPublicLinkSpaceWithPasswordUsingWopiEndpoint(string $file, string $folder, string $password): void { + public function thePublicCreatesAFileInsideFolderInTheLastSharedPublicLinkSpaceWithPasswordUsingWopiEndpoint( + string $file, + string $folder, + string $password + ): void { $this->createFile($file, $password, $folder); } @@ -225,7 +243,12 @@ class CollaborationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userTriesToCheckTheInformationOfFileOfSpaceUsingOfficeWithInvalidFileId(string $user, string $file, string $space, string $app): void { + public function userTriesToCheckTheInformationOfFileOfSpaceUsingOfficeWithInvalidFileId( + string $user, + string $file, + string $space, + string $app + ): void { $response = \json_decode( CollaborationHelper::sendPOSTRequestToAppOpen( $this->spacesContext->getFileId($user, $space, $file), @@ -335,9 +358,11 @@ class CollaborationContext implements Context { * @return void * @throws Exception */ - public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table):void { + public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table): void { $rows = $table->getRows(); - $responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['mime-types']; + $responseArray = $this->featureContext->getJsonDecodedResponse( + $this->featureContext->getResponse() + )['mime-types']; $mimeTypes = \array_column($responseArray, 'mime_type'); foreach ($rows as $row) { if ($shouldOrNot === "should not") { @@ -364,10 +389,17 @@ class CollaborationContext implements Context { * * @return void */ - public function theAppListResponseShouldContainTheFollowingTemplateInformationForOffice(string $app, TableNode $table): void { + public function theAppListResponseShouldContainTheFollowingTemplateInformationForOffice( + string $app, + TableNode $table + ): void { $responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse()); - Assert::assertArrayHasKey("mime-types", $responseArray, "Expected 'mime-types' in the response but not found.\n" . print_r($responseArray, true)); + Assert::assertArrayHasKey( + "mime-types", + $responseArray, + "Expected 'mime-types' in the response but not found.\n" . print_r($responseArray, true) + ); $mimeTypes = $responseArray['mime-types']; @@ -377,7 +409,12 @@ class CollaborationContext implements Context { } foreach ($table->getColumnsHash() as $row) { - Assert::assertArrayHasKey($row['mime-type'], $mimeTypeMap, "Expected mime-type '{$row['mime-type']}' to exist in the response but it doesn't.\n" . print_r($mimeTypeMap, true)); + Assert::assertArrayHasKey( + $row['mime-type'], + $mimeTypeMap, + "Expected mime-type '{$row['mime-type']}' to exist in the response but it doesn't.\n" + . print_r($mimeTypeMap, true) + ); $mimeType = $mimeTypeMap[$row['mime-type']]; $found = false; @@ -387,7 +424,8 @@ class CollaborationContext implements Context { Assert::assertSame( $row['target-extension'], $provider['target_ext'], - "Expected 'target_ext' for $app to be '{$row['target-extension']}' but found '{$provider['target_ext']}'" + "Expected 'target_ext' for $app to be '{$row['target-extension']}'" + . " but found '{$provider['target_ext']}'" ); $found = true; break; @@ -396,8 +434,10 @@ class CollaborationContext implements Context { if (!$found) { Assert::fail( - "Expected response to contain app-provider '$app' with target-extension '{$row['target-extension']}' for mime-type '{$row['mime-type']}', but no matching provider was found.\n" . - "App Providers Found: " . print_r($mimeType['app_providers'], true) + "Expected response to contain app-provider '$app' with target-extension " + . "'{$row['target-extension']}' for mime-type '{$row['mime-type']}'," + . " but no matching provider was found.\n App Providers Found: " + . print_r($mimeType['app_providers'], true) ); } } @@ -412,7 +452,7 @@ class CollaborationContext implements Context { * @return string * @throws GuzzleException */ - public function userHasCreatedAFileInSpaceUsingWopiEndpoint(string $user, string $file):string { + public function userHasCreatedAFileInSpaceUsingWopiEndpoint(string $user, string $file): string { $parentContainerId = $this->featureContext->getFileIdForPath($user, "/"); $response = CollaborationHelper::createFile( $this->featureContext->getBaseUrl(), diff --git a/tests/acceptance/bootstrap/FavoritesContext.php b/tests/acceptance/bootstrap/FavoritesContext.php index dd163cdd50e..c38f936e12f 100644 --- a/tests/acceptance/bootstrap/FavoritesContext.php +++ b/tests/acceptance/bootstrap/FavoritesContext.php @@ -43,7 +43,7 @@ class FavoritesContext implements Context { * * @return ResponseInterface */ - public function userFavoritesElement(string $user, string $path, string $spaceId = null):ResponseInterface { + public function userFavoritesElement(string $user, string $path, string $spaceId = null): ResponseInterface { return $this->changeFavStateOfAnElement( $user, $path, @@ -60,7 +60,7 @@ class FavoritesContext implements Context { * * @return void */ - public function userFavoritesElementUsingWebDavApi(string $user, string $path):void { + public function userFavoritesElementUsingWebDavApi(string $user, string $path): void { $this->featureContext->setResponse($this->userFavoritesElement($user, $path)); } @@ -72,7 +72,7 @@ class FavoritesContext implements Context { * * @return void */ - public function userHasFavoritedElementUsingWebDavApi(string $user, string $path):void { + public function userHasFavoritedElementUsingWebDavApi(string $user, string $path): void { $this->featureContext->theHTTPStatusCodeShouldBe(207, '', $this->userFavoritesElement($user, $path)); } @@ -82,7 +82,7 @@ class FavoritesContext implements Context { * * @return ResponseInterface */ - public function userUnfavoritesElement(string $user, string $path):ResponseInterface { + public function userUnfavoritesElement(string $user, string $path): ResponseInterface { return $this->changeFavStateOfAnElement( $user, $path, @@ -99,7 +99,7 @@ class FavoritesContext implements Context { * * @return void */ - public function userUnfavoritesElementUsingWebDavApi(string $user, string $path):void { + public function userUnfavoritesElementUsingWebDavApi(string $user, string $path): void { $this->featureContext->setResponse($this->userUnfavoritesElement($user, $path)); } @@ -116,7 +116,7 @@ class FavoritesContext implements Context { string $user, string $shouldOrNot, TableNode $expectedElements - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $this->userListsFavorites($user); $this->featureContext->propfindResultShouldContainEntries( @@ -134,7 +134,7 @@ class FavoritesContext implements Context { * * @return void */ - public function userListsFavorites(string $user, ?int $limit = null):void { + public function userListsFavorites(string $user, ?int $limit = null): void { $renamedUser = $this->featureContext->getActualUsername($user); $baseUrl = $this->featureContext->getBaseUrl(); $password = $this->featureContext->getPasswordForUser($user); @@ -176,7 +176,12 @@ class FavoritesContext implements Context { * * @return void */ - public function asUserFileOrFolderShouldBeFavorited(string $user, string $path, int $expectedValue = 1, string $spaceId = null):void { + public function asUserFileOrFolderShouldBeFavorited( + string $user, + string $path, + int $expectedValue = 1, + string $spaceId = null + ): void { $property = "oc:favorite"; $this->webDavPropertiesContext->checkPropertyOfAFolder( $user, @@ -196,7 +201,7 @@ class FavoritesContext implements Context { * * @return void */ - public function asUserFileShouldNotBeFavorited(string $user, string $path):void { + public function asUserFileShouldNotBeFavorited(string $user, string $path): void { $this->asUserFileOrFolderShouldBeFavorited($user, $path, 0); } @@ -215,7 +220,7 @@ class FavoritesContext implements Context { string $path, ?int $favOrUnfav, ?string $spaceId, - ):ResponseInterface { + ): ResponseInterface { $renamedUser = $this->featureContext->getActualUsername($user); return WebDavHelper::proppatch( $this->featureContext->getBaseUrl(), @@ -242,7 +247,7 @@ class FavoritesContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context diff --git a/tests/acceptance/bootstrap/FeatureContext.php b/tests/acceptance/bootstrap/FeatureContext.php index b7144e1e97b..505080f5f36 100644 --- a/tests/acceptance/bootstrap/FeatureContext.php +++ b/tests/acceptance/bootstrap/FeatureContext.php @@ -1034,7 +1034,11 @@ class FeatureContext extends BehatVariablesContext { private function checkInvalidValidator(JsonSchema $schemaObj): void { $validators = \array_keys((array)$schemaObj->jsonSerialize()); foreach ($validators as $validator) { - Assert::assertContains(\ltrim($validator, "$"), $this->jsonSchemaValidators, "Invalid schema validator: '$validator'"); + Assert::assertContains( + \ltrim($validator, "$"), + $this->jsonSchemaValidators, + "Invalid schema validator: '$validator'" + ); } } @@ -1091,7 +1095,9 @@ class FeatureContext extends BehatVariablesContext { return; } - $hasTwoElementValidator = ($schemaObj->enum && $schemaObj->const) || ($schemaObj->enum && $schemaObj->items) || ($schemaObj->const && $schemaObj->items); + $hasTwoElementValidator = ($schemaObj->enum && $schemaObj->const) + || ($schemaObj->enum && $schemaObj->items) + || ($schemaObj->const && $schemaObj->items); Assert::assertFalse($hasTwoElementValidator, "'items', 'enum' and 'const' should not be used together"); if ($schemaObj->enum || $schemaObj->const) { // do not try to validate of enum or const is present @@ -1113,7 +1119,11 @@ class FeatureContext extends BehatVariablesContext { Assert::assertNotNull($schemaObj->$validator, \sprintf($errMsg, $validator)); } - Assert::assertEquals($schemaObj->minItems, $schemaObj->maxItems, "'minItems' and 'maxItems' should be equal for strict assertion"); + Assert::assertEquals( + $schemaObj->minItems, + $schemaObj->maxItems, + "'minItems' and 'maxItems' should be equal for strict assertion" + ); // check optional validators foreach ($optionalValidators as $validator) { @@ -1127,18 +1137,34 @@ class FeatureContext extends BehatVariablesContext { if ($schemaObj->maxItems > 1) { if (\is_array($value)) { foreach ($value as $element) { - Assert::assertNotNull($element->oneOf, "'oneOf' is required to assert more than one elements"); + Assert::assertNotNull( + $element->oneOf, + "'oneOf' is required to assert more than one elements" + ); } Assert::fail("'$validator' should be an object not an array"); } - Assert::assertFalse($value->allOf || $value->anyOf, "'allOf' and 'anyOf' are not allowed in array"); + Assert::assertFalse( + $value->allOf || $value->anyOf, + "'allOf' and 'anyOf' are not allowed in array" + ); if ($value->oneOf) { - Assert::assertNotNull($value->oneOf, "'oneOf' is required to assert more than one elements"); + Assert::assertNotNull( + $value->oneOf, + "'oneOf' is required to assert more than one elements" + ); Assert::assertTrue(\is_array($value->oneOf), "'oneOf' should be an array"); - Assert::assertEquals($schemaObj->maxItems, \count($value->oneOf), "Expected " . $schemaObj->maxItems . " 'oneOf' items but got " . \count($value->oneOf)); + Assert::assertEquals( + $schemaObj->maxItems, + \count($value->oneOf), + "Expected " . $schemaObj->maxItems . " 'oneOf' items but got " . \count($value->oneOf) + ); } } - Assert::assertTrue(\is_object($value), "'$validator' should be an object when expecting 1 element"); + Assert::assertTrue( + \is_object($value), + "'$validator' should be an object when expecting 1 element" + ); break; case "uniqueItems": if ($schemaObj->minItems > 1) { @@ -1340,7 +1366,12 @@ class FeatureContext extends BehatVariablesContext { * @throws GuzzleException * @throws JsonException */ - public function userSendsHTTPMethodToUrlWithHeaders(string $user, string $verb, string $url, TableNode $headersTable): void { + public function userSendsHTTPMethodToUrlWithHeaders( + string $user, + string $verb, + string $url, + TableNode $headersTable + ): void { $this->verifyTableNodeColumns( $headersTable, ['header', 'value'] @@ -1385,7 +1416,12 @@ class FeatureContext extends BehatVariablesContext { * * @return void */ - public function userSendsHttpMethodToUrlWithContent(string $user, string $method, string $davPath, string $content): void { + public function userSendsHttpMethodToUrlWithContent( + string $user, + string $method, + string $davPath, + string $content + ): void { $this->setResponse($this->sendingToWithDirectUrl($user, $method, $davPath, $content)); } @@ -1399,7 +1435,12 @@ class FeatureContext extends BehatVariablesContext { * * @return void */ - public function userSendsHTTPMethodToUrlWithPassword(string $user, string $verb, string $url, string $password): void { + public function userSendsHTTPMethodToUrlWithPassword( + string $user, + string $verb, + string $url, + string $password + ): void { $this->setResponse($this->sendingToWithDirectUrl($user, $verb, $url, null, $password)); } @@ -1414,7 +1455,14 @@ class FeatureContext extends BehatVariablesContext { * @return ResponseInterface * @throws GuzzleException */ - public function sendingToWithDirectUrl(string $user, string $verb, string $url, ?string $body = null, ?string $password = null, ?array $headers = null): ResponseInterface { + public function sendingToWithDirectUrl( + string $user, + string $verb, + string $url, + ?string $body = null, + ?string $password = null, + ?array $headers = null + ): ResponseInterface { $url = \ltrim($url, '/'); if (WebdavHelper::isDAVRequest($url)) { $url = WebdavHelper::prefixRemotePhp($url); @@ -1498,12 +1546,17 @@ class FeatureContext extends BehatVariablesContext { * * @return void */ - public function theHTTPStatusCodeShouldBe($expectedStatusCode, ?string $message = "", ?ResponseInterface $response = null): void { + public function theHTTPStatusCodeShouldBe( + $expectedStatusCode, + ?string $message = "", + ?ResponseInterface $response = null + ): void { $response = $response ?? $this->response; $actualStatusCode = $response->getStatusCode(); if (\is_array($expectedStatusCode)) { if ($message === "") { - $message = "HTTP status code $actualStatusCode is not one of the expected values " . \implode(" or ", $expectedStatusCode); + $message = "HTTP status code $actualStatusCode is not one of the expected values " + . \implode(" or ", $expectedStatusCode); } Assert::assertContainsEquals( @@ -2745,7 +2798,11 @@ class FeatureContext extends BehatVariablesContext { * @return void * @throws Exception */ - public function verifyTableNodeColumns(?TableNode $table, ?array $requiredHeader = [], ?array $allowedHeader = []): void { + public function verifyTableNodeColumns( + ?TableNode $table, + ?array $requiredHeader = [], + ?array $allowedHeader = [] + ): void { if ($table === null || \count($table->getHash()) < 1) { throw new Exception("Table should have at least one row."); } @@ -2830,14 +2887,17 @@ class FeatureContext extends BehatVariablesContext { public function getBodyForOCSRequest(string $method, string $property): ?string { $body = null; if ($method === 'PROPFIND') { - $body = '<' . $property . '/>'; + $body = '<' + . $property . '/>'; } elseif ($method === 'LOCK') { - $body = " <" . $property . " />"; + $body = " <" + . $property . " />"; } elseif ($method === 'PROPPATCH') { if ($property === 'favorite') { $property = '1'; } - $body = '' . $property . ''; + $body = '' + . "" . $property . ''; } if ($property === '') { $body = ''; @@ -2877,7 +2937,7 @@ class FeatureContext extends BehatVariablesContext { * @return string * @throws Exception|GuzzleException */ - public function getGroupIdByGroupName(string $groupName):string { + public function getGroupIdByGroupName(string $groupName): string { $response = GraphHelper::getGroup( $this->getBaseUrl(), $this->getStepLineRef(), diff --git a/tests/acceptance/bootstrap/FilesVersionsContext.php b/tests/acceptance/bootstrap/FilesVersionsContext.php index abe78721597..a02fb4e8dd5 100644 --- a/tests/acceptance/bootstrap/FilesVersionsContext.php +++ b/tests/acceptance/bootstrap/FilesVersionsContext.php @@ -48,7 +48,7 @@ class FilesVersionsContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context @@ -66,7 +66,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function userTriesToGetFileVersions(string $user, string $file, string $fileOwner):void { + public function userTriesToGetFileVersions(string $user, string $file, string $fileOwner): void { $this->featureContext->setResponse($this->getFileVersions($user, $file, $fileOwner)); } @@ -79,7 +79,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function userGetsFileVersions(string $user, string $file):void { + public function userGetsFileVersions(string $user, string $file): void { $this->featureContext->setResponse($this->getFileVersions($user, $file)); } @@ -92,7 +92,11 @@ class FilesVersionsContext implements Context { * * @return void */ - public function thePublicTriesToGetTheNumberOfVersionsOfFileWithPasswordUsingFileId(string $file, string $password, string $fileId): void { + public function thePublicTriesToGetTheNumberOfVersionsOfFileWithPasswordUsingFileId( + string $file, + string $password, + string $fileId + ): void { $password = $this->featureContext->getActualPassword($password); $this->featureContext->setResponse( $this->featureContext->makeDavRequest( @@ -129,7 +133,11 @@ class FilesVersionsContext implements Context { $user = $this->featureContext->getActualUsername($user); $fileOwner = $fileOwner ? $this->featureContext->getActualUsername($fileOwner) : $user; $fileId = $this->featureContext->getFileIdForPath($fileOwner, $file, $spaceId); - Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $file user $fileOwner not found (the file may not exist)"); + Assert::assertNotNull( + $fileId, + __METHOD__ + . " fileid of file $file user $fileOwner not found (the file may not exist)" + ); return $this->featureContext->makeDavRequest( $user, "PROPFIND", @@ -150,7 +158,7 @@ class FilesVersionsContext implements Context { * * @return void */ - public function userGetsTheNumberOfVersionsOfFileOfTheSpace(string $user, string $fileId):void { + public function userGetsTheNumberOfVersionsOfFileOfTheSpace(string $user, string $fileId): void { $this->featureContext->setResponse( $this->featureContext->makeDavRequest( $user, @@ -173,7 +181,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function userGetsVersionMetadataOfFile(string $user, string $file):void { + public function userGetsVersionMetadataOfFile(string $user, string $file): void { $response = $this->getFileVersionMetadata($user, $file); $this->featureContext->setResponse($response, $user); } @@ -184,10 +192,14 @@ class FilesVersionsContext implements Context { * * @return ResponseInterface */ - public function getFileVersionMetadata(string $user, string $file) : ResponseInterface { + public function getFileVersionMetadata(string $user, string $file): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $fileId = $this->featureContext->getFileIdForPath($user, $file); - Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $file user $user not found (the file may not exist)"); + Assert::assertNotNull( + $fileId, + __METHOD__ + . " fileid of file $file user $user not found (the file may not exist)" + ); $body = ' @@ -214,10 +226,14 @@ class FilesVersionsContext implements Context { * @return ResponseInterface * @throws Exception */ - public function restoreVersionIndexOfFile(string $user, int $versionIndex, string $path):ResponseInterface { + public function restoreVersionIndexOfFile(string $user, int $versionIndex, string $path): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $fileId = $this->featureContext->getFileIdForPath($user, $path); - Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)"); + Assert::assertNotNull( + $fileId, + __METHOD__ + . " fileid of file $path user $user not found (the file may not exist)" + ); $response = $this->listVersionFolder($user, $fileId, 1); $responseXmlObject = HttpRequestHelper::getResponseXml( $response, @@ -249,7 +265,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function userHasRestoredVersionIndexOfFile(string $user, int $versionIndex, string $path):void { + public function userHasRestoredVersionIndexOfFile(string $user, int $versionIndex, string $path): void { $response = $this->restoreVersionIndexOfFile($user, $versionIndex, $path); $this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response); } @@ -264,7 +280,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function userRestoresVersionIndexOfFile(string $user, int $versionIndex, string $path):void { + public function userRestoresVersionIndexOfFile(string $user, int $versionIndex, string $path): void { $response = $this->restoreVersionIndexOfFile($user, $versionIndex, $path); $this->featureContext->setResponse($response, $user); } @@ -279,7 +295,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function assertFileVersionsCount(string $user, string $fileId, int $expectedCount):void { + public function assertFileVersionsCount(string $user, string $fileId, int $expectedCount): void { $response = $this->listVersionFolder($user, $fileId, 1); $responseXmlObject = HttpRequestHelper::getResponseXml( $response, @@ -310,10 +326,14 @@ class FilesVersionsContext implements Context { string $path, string $user, int $count - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $fileId = $this->featureContext->getFileIdForPath($user, $path); - Assert::assertNotNull($fileId, __METHOD__ . ". file '$path' for user '$user' not found (the file may not exist)"); + Assert::assertNotNull( + $fileId, + __METHOD__ + . ". file '$path' for user '$user' not found (the file may not exist)" + ); $this->assertFileVersionsCount($user, $fileId, $count); } @@ -331,7 +351,7 @@ class FilesVersionsContext implements Context { string $fileId, string $user, int $count - ):void { + ): void { $this->assertFileVersionsCount($user, $fileId, $count); } @@ -351,10 +371,14 @@ class FilesVersionsContext implements Context { int $index, string $user, int $length - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $fileId = $this->featureContext->getFileIdForPath($user, $path); - Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)"); + Assert::assertNotNull( + $fileId, + __METHOD__ + . " fileid of file $path user $user not found (the file may not exist)" + ); $response = $this->listVersionFolder($user, $fileId, 1, ['d:getcontentlength']); $responseXmlObject = HttpRequestHelper::getResponseXml( $response, @@ -413,10 +437,19 @@ class FilesVersionsContext implements Context { * @return ResponseInterface * @throws Exception */ - public function downloadVersion(string $user, string $path, string $index, ?string $spaceId = null):ResponseInterface { + public function downloadVersion( + string $user, + string $path, + string $index, + ?string $spaceId = null + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $fileId = $this->featureContext->getFileIdForPath($user, $path, $spaceId); - Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)"); + Assert::assertNotNull( + $fileId, + __METHOD__ + . " fileid of file $path user $user not found (the file may not exist)" + ); $index = (int)$index; $response = $this->listVersionFolder($user, $fileId, 1); if ($response->getStatusCode() === 403) { @@ -451,7 +484,7 @@ class FilesVersionsContext implements Context { * @return void * @throws Exception */ - public function userDownloadsVersion(string $user, string $path, string $index):void { + public function userDownloadsVersion(string $user, string $path, string $index): void { $this->featureContext->setResponse($this->downloadVersion($user, $path, $index), $user); } @@ -486,7 +519,7 @@ class FilesVersionsContext implements Context { * * @return void */ - public function userGetMetaInfo(string $user, string $fileOrFileId, string $path):void { + public function userGetMetaInfo(string $user, string $fileOrFileId, string $path): void { $user = $this->featureContext->getActualUsername($user); $baseUrl = $this->featureContext->getBaseUrl(); $password = $this->featureContext->getPasswordForUser($user); @@ -538,7 +571,7 @@ class FilesVersionsContext implements Context { string $fileId, int $folderDepth, ?array $properties = null - ):ResponseInterface { + ): ResponseInterface { if (!$properties) { $properties = [ 'd:getetag' diff --git a/tests/acceptance/bootstrap/GraphContext.php b/tests/acceptance/bootstrap/GraphContext.php index cb97be9162e..d5ca5d0dc56 100644 --- a/tests/acceptance/bootstrap/GraphContext.php +++ b/tests/acceptance/bootstrap/GraphContext.php @@ -81,7 +81,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theUserChangesTheDisplayNameOfUserToUsingTheGraphApi(string $byUser, string $user, string $displayName): void { + public function theUserChangesTheDisplayNameOfUserToUsingTheGraphApi( + string $byUser, + string $user, + string $displayName + ): void { $response = $this->editUserUsingTheGraphApi($byUser, $user, null, null, null, $displayName); $this->featureContext->setResponse($response); } @@ -98,7 +102,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theUserChangesTheUserNameOfUserToUsingTheGraphApi(string $byUser, string $user, string $userName): void { + public function theUserChangesTheUserNameOfUserToUsingTheGraphApi( + string $byUser, + string $user, + string $userName + ): void { $response = $this->editUserUsingTheGraphApi($byUser, $user, $userName); $this->featureContext->setResponse($response); // need to add user to list to delete him after test @@ -189,7 +197,16 @@ class GraphContext implements Context { * @return void * @throws GuzzleException */ - public function editUserUsingTheGraphApi(string $byUser, string $user, string $userName = null, string $password = null, string $email = null, string $displayName = null, bool $accountEnabled = true, string $method="PATCH"): ResponseInterface { + public function editUserUsingTheGraphApi( + string $byUser, + string $user, + string $userName = null, + string $password = null, + string $email = null, + string $displayName = null, + bool $accountEnabled = true, + string $method="PATCH" + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $userId = $this->featureContext->getAttributeOfCreatedUser($user, 'id') ?: $user; return GraphHelper::editUser( @@ -528,8 +545,10 @@ class GraphContext implements Context { * @return array */ public function getAdminOrUserCredentials(?string $user): array { - $credentials["username"] = $user ? $this->featureContext->getActualUsername($user) : $this->featureContext->getAdminUsername(); - $credentials["password"] = $user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(); + $credentials["username"] = $user ? $this->featureContext->getActualUsername($user) + : $this->featureContext->getAdminUsername(); + $credentials["password"] = $user ? $this->featureContext->getPasswordForUser($user) + : $this->featureContext->getAdminPassword(); return $credentials; } /** @@ -574,7 +593,7 @@ class GraphContext implements Context { * @throws GuzzleException */ public function adminHasRetrievedGroupListUsingTheGraphApi(): array { - return $this->getArrayOfGroupsResponded($this->listGroups()); + return $this->getArrayOfGroupsResponded($this->listGroups()); } /** @@ -605,7 +624,10 @@ class GraphContext implements Context { * @return ResponseInterface * @throws GuzzleException */ - public function listSingleOrAllGroupsAlongWithAllMemberInformation(string $user, ?string $group = null): ResponseInterface { + public function listSingleOrAllGroupsAlongWithAllMemberInformation( + string $user, + ?string $group = null + ): ResponseInterface { $credentials = $this->getAdminOrUserCredentials($user); return GraphHelper::getSingleOrAllGroupsAlongWithMembers( @@ -759,7 +781,10 @@ class GraphContext implements Context { * * @return void */ - public function theAdministratorTriesToAddNonExistentUserToGroupUsingTheGraphAPI(string $group, ?string $byUser = null): void { + public function theAdministratorTriesToAddNonExistentUserToGroupUsingTheGraphAPI( + string $group, + ?string $byUser = null + ): void { $this->featureContext->setResponse($this->addUserToGroup($group, "nonexistent", $byUser)); } @@ -774,7 +799,10 @@ class GraphContext implements Context { * * @throws GuzzleException | Exception */ - public function theAdministratorTriesToAddUserToNonExistentGroupUsingTheGraphAPI(string $user, ?string $byUser = null): void { + public function theAdministratorTriesToAddUserToNonExistentGroupUsingTheGraphAPI( + string $user, + ?string $byUser = null + ): void { $this->featureContext->setResponse($this->addUserToGroup("nonexistent", $user, $byUser)); } @@ -799,7 +827,11 @@ class GraphContext implements Context { * * @return void */ - public function theUserTriesToAddAnotherUserToGroupUsingTheGraphAPI(string $byUser, string $user, string $group): void { + public function theUserTriesToAddAnotherUserToGroupUsingTheGraphAPI( + string $byUser, + string $user, + string $group + ): void { $this->featureContext->setResponse($this->addUserToGroup($group, $user, $byUser)); } @@ -1032,7 +1064,8 @@ class GraphContext implements Context { Assert::assertTrue( $exists, __METHOD__ - . "\nExpected user '" . $userGroup['username'] . "' to be in group '" . $userGroup['groupname'] . "'. But not found." + . "\nExpected user '" . $userGroup['username'] . "' to be in group '" + . $userGroup['groupname'] . "'. But not found." ); } } @@ -1098,12 +1131,16 @@ class GraphContext implements Context { * * @return void */ - public function theAdministratorRemovesTheFollowingUsersFromTheFollowingGroupsUsingTheGraphApi(TableNode $table): void { + public function theAdministratorRemovesTheFollowingUsersFromTheFollowingGroupsUsingTheGraphApi( + TableNode $table + ): void { $this->featureContext->verifyTableNodeColumns($table, ['username', 'groupname']); $usersGroups = $table->getColumnsHash(); foreach ($usersGroups as $userGroup) { - $this->featureContext->setResponse($this->removeUserFromGroup($userGroup['groupname'], $userGroup['username'])); + $this->featureContext->setResponse( + $this->removeUserFromGroup($userGroup['groupname'], $userGroup['username']) + ); $this->featureContext->pushToLastHttpStatusCodesArray(); } } @@ -1118,7 +1155,11 @@ class GraphContext implements Context { * @return void * @throws Exception | GuzzleException */ - public function theUserTriesToRemoveAnotherUserFromGroupUsingTheGraphAPI(string $user, string $group, ?string $byUser = null): void { + public function theUserTriesToRemoveAnotherUserFromGroupUsingTheGraphAPI( + string $user, + string $group, + ?string $byUser = null + ): void { $this->featureContext->setResponse($this->removeUserFromGroup($group, $user, $byUser)); } @@ -1132,7 +1173,10 @@ class GraphContext implements Context { * @return void * @throws GuzzleException */ - public function theUserTriesToRemoveAnotherUserFromNonExistentGroupUsingTheGraphAPI(string $user, ?string $byUser = null): void { + public function theUserTriesToRemoveAnotherUserFromNonExistentGroupUsingTheGraphAPI( + string $user, + ?string $byUser = null + ): void { $this->featureContext->setResponse($this->removeUserFromGroup('', $user, $byUser)); } @@ -1145,7 +1189,7 @@ class GraphContext implements Context { */ public function retrieveUserInformationUsingGraphApi( string $user - ):ResponseInterface { + ): ResponseInterface { $credentials = $this->getAdminOrUserCredentials($user); return GraphHelper::getOwnInformationAndGroupMemberships( $this->featureContext->getBaseUrl(), @@ -1165,7 +1209,7 @@ class GraphContext implements Context { */ public function userRetrievesHisOrHerInformationOfUserUsingGraphApi( string $user - ):void { + ): void { $response = $this->retrieveUserInformationUsingGraphApi($user); $this->featureContext->setResponse($response); } @@ -1266,7 +1310,7 @@ class GraphContext implements Context { public function retrieveUserInformationAlongWithDriveUsingGraphApi( string $byUser, ?string $user = null - ):ResponseInterface { + ): ResponseInterface { $user = $user ?? $byUser; $credentials = $this->getAdminOrUserCredentials($user); return GraphHelper::getUserWithDriveInformation( @@ -1289,7 +1333,7 @@ class GraphContext implements Context { public function retrieveUserInformationAlongWithGroupUsingGraphApi( string $byUser, ?string $user = null - ):ResponseInterface { + ): ResponseInterface { $user = $user ?? $byUser; $credentials = $this->getAdminOrUserCredentials($user); return GraphHelper::getUserWithGroupInformation( @@ -1351,7 +1395,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function addMultipleUsersToGroup(string $user, array $userIds, string $groupId): ResponseInterface { + public function addMultipleUsersToGroup( + string $user, + array $userIds, + string $groupId + ): ResponseInterface { $credentials = $this->getAdminOrUserCredentials($user); return GraphHelper::addUsersToGroup( @@ -1375,7 +1423,11 @@ class GraphContext implements Context { * @throws Exception * @throws GuzzleException */ - public function theAdministratorAddsTheFollowingUsersToAGroupInASingleRequestUsingTheGraphApi(string $user, string $group, TableNode $table): void { + public function theAdministratorAddsTheFollowingUsersToAGroupInASingleRequestUsingTheGraphApi( + string $user, + string $group, + TableNode $table + ): void { $userIds = []; $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); foreach ($table->getHash() as $row) { @@ -1397,7 +1449,11 @@ class GraphContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userTriesToAddTheFollowingUsersToAGroupAtOnceWithInvalidHostUsingTheGraphApi(string $user, string $group, TableNode $table): void { + public function userTriesToAddTheFollowingUsersToAGroupAtOnceWithInvalidHostUsingTheGraphApi( + string $user, + string $group, + TableNode $table + ): void { $userIds = []; $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $credentials = $this->getAdminOrUserCredentials($user); @@ -1436,7 +1492,11 @@ class GraphContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userTriesToAddUserToGroupWithInvalidHostUsingTheGraphApi(string $adminUser, string $user, string $group): void { + public function userTriesToAddUserToGroupWithInvalidHostUsingTheGraphApi( + string $adminUser, + string $user, + string $group + ): void { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $userId = $this->featureContext->getAttributeOfCreatedUser($user, "id"); $credentials = $this->getAdminOrUserCredentials($adminUser); @@ -1467,7 +1527,10 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddsTheFollowingUsersToANonExistingGroupAtOnceUsingTheGraphApi(string $user, TableNode $table): void { + public function theAdministratorTriesToAddsTheFollowingUsersToANonExistingGroupAtOnceUsingTheGraphApi( + string $user, + TableNode $table + ): void { $userIds = []; $groupId = WebDavHelper::generateUUIDv4(); foreach ($table->getHash() as $row) { @@ -1489,7 +1552,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddTheFollowingNonExistingUsersToAGroupAtOnceUsingTheGraphApi(string $user, string $group, TableNode $table): void { + public function theAdministratorTriesToAddTheFollowingNonExistingUsersToAGroupAtOnceUsingTheGraphApi( + string $user, + string $group, + TableNode $table + ): void { $userIds = []; $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); foreach ($table->getHash() as $row) { @@ -1512,7 +1579,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddTheFollowingUsersToAGroupAtOnceUsingTheGraphApi(string $user, string $group, TableNode $table): void { + public function theAdministratorTriesToAddTheFollowingUsersToAGroupAtOnceUsingTheGraphApi( + string $user, + string $group, + TableNode $table + ): void { $userIds = []; $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); foreach ($table->getHash() as $row) { @@ -1550,7 +1621,11 @@ class GraphContext implements Context { * @return void */ public function theResponseShouldContainTheFollowingApplicationInformation(TableNode $table): void { - Assert::assertIsArray($responseArray = ($this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse()))['value'][0]); + Assert::assertIsArray( + $responseArray = ( + $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse()) + )['value'][0] + ); foreach ($table->getHash() as $row) { $key = $row["key"]; if ($key === 'id') { @@ -1572,7 +1647,11 @@ class GraphContext implements Context { * @return void */ public function theResponseShouldContainTheFollowingAppRolesInformation(TableNode $table): void { - Assert::assertIsArray($responseArray = ($this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse()))['value'][0]); + Assert::assertIsArray( + $responseArray = ( + $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse()) + )['value'][0] + ); foreach ($table->getRows() as $row) { $foundRoleInResponse = false; foreach ($responseArray['appRoles'] as $role) { @@ -1640,7 +1719,11 @@ class GraphContext implements Context { * @return void * @throws GuzzleException */ - public function userGetsAllUsersOfFirstGroupOderSecondGroupUsingTheGraphApi(string $user, string $firstGroup, string $secondGroup) { + public function userGetsAllUsersOfFirstGroupOderSecondGroupUsingTheGraphApi( + string $user, + string $firstGroup, + string $secondGroup + ) { $response = GraphHelper::getUsersFromOneOrOtherGroup( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), @@ -1708,7 +1791,11 @@ class GraphContext implements Context { * @return void * @throws GuzzleException */ - public function userGetsAllUsersWithRoleAndMemberOfGroupUsingTheGraphApi(string $user, string $role, string $group) { + public function userGetsAllUsersWithRoleAndMemberOfGroupUsingTheGraphApi( + string $user, + string $role, + string $group + ) { $response = GraphHelper::getUsersWithFilterRolesAssignmentAndMemberOf( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), @@ -1841,7 +1928,8 @@ class GraphContext implements Context { $this->appEntity["appRoles"][$role], $response['appRoleId'], __METHOD__ - . "\nExpected rolId for role '$role'' to be '" . $this->appEntity["appRoles"][$role] . "' but got '" . $response['appRoleId'] . "'" + . "\nExpected rolId for role '$role'' to be '" . $this->appEntity["appRoles"][$role] + . "' but got '" . $response['appRoleId'] . "'" ); } @@ -1890,7 +1978,7 @@ class GraphContext implements Context { * * @return void */ - public function userSearchesForGroupUsingGraphApi(string $user, string $searchTerm):void { + public function userSearchesForGroupUsingGraphApi(string $user, string $searchTerm): void { $credentials = $this->getAdminOrUserCredentials($user); $this->featureContext->setResponse( GraphHelper::searchGroup( @@ -1953,7 +2041,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorHasAddedTheFollowingUsersToAGroupAtOnceUsingTheGraphApi(string $user, string $group, TableNode $table) { + public function theAdministratorHasAddedTheFollowingUsersToAGroupAtOnceUsingTheGraphApi( + string $user, + string $group, + TableNode $table + ) { $userIds = []; $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); foreach ($table->getHash() as $row) { @@ -1975,13 +2067,18 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddGroupToAGroupAtOnceUsingTheGraphApi(string $user, string $groupToAdd, string $group) { + public function theAdministratorTriesToAddGroupToAGroupAtOnceUsingTheGraphApi( + string $user, + string $groupToAdd, + string $group + ) { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $groupIdToAdd = $this->featureContext->getAttributeOfCreatedGroup($groupToAdd, "id"); $credentials = $this->getAdminOrUserCredentials($user); $payload = [ - "members@odata.bind" => [GraphHelper::getFullUrl($this->featureContext->getBaseUrl(), 'groups/' . $groupIdToAdd)] + "members@odata.bind" => [ + GraphHelper::getFullUrl($this->featureContext->getBaseUrl(), 'groups/' . $groupIdToAdd)] ]; $this->featureContext->setResponse( @@ -2008,7 +2105,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddAGroupToAGroupThroughPostRequestUsingTheGraphApi(string $user, string $groupToAdd, string $group) { + public function theAdministratorTriesToAddAGroupToAGroupThroughPostRequestUsingTheGraphApi( + string $user, + string $groupToAdd, + string $group + ) { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $groupIdToAdd = $this->featureContext->getAttributeOfCreatedGroup($groupToAdd, "id"); $credentials = $this->getAdminOrUserCredentials($user); @@ -2041,7 +2142,12 @@ class GraphContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userTriesToAddUserToGroupWithInvalidJsonUsingTheGraphApi(string $adminUser, string $user, string $group, string $invalidJSON): void { + public function userTriesToAddUserToGroupWithInvalidJsonUsingTheGraphApi( + string $adminUser, + string $user, + string $group, + string $invalidJSON + ): void { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $credentials = $this->getAdminOrUserCredentials($adminUser); @@ -2078,7 +2184,12 @@ class GraphContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userTriesToAddTheFollowingUsersToAGroupAtOnceWithInvalidJsonUsingTheGraphApi(string $user, string $group, string $invalidJSON, TableNode $table): void { + public function userTriesToAddTheFollowingUsersToAGroupAtOnceWithInvalidJsonUsingTheGraphApi( + string $user, + string $group, + string $invalidJSON, + TableNode $table + ): void { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $credentials = $this->getAdminOrUserCredentials($user); foreach ($table->getHash() as $row) { @@ -2116,7 +2227,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddTheFollowingUserIdWithInvalidCharacterToAGroup(string $user, string $group, TableNode $table) { + public function theAdministratorTriesToAddTheFollowingUserIdWithInvalidCharacterToAGroup( + string $user, + string $group, + TableNode $table + ) { $userIds = []; $credentials = $this->getAdminOrUserCredentials($user); $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); @@ -2146,7 +2261,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theAdministratorTriesToAddUserIdWithInvalidCharactersToAGroup(string $user, string $userId, string $group): void { + public function theAdministratorTriesToAddUserIdWithInvalidCharactersToAGroup( + string $user, + string $userId, + string $group + ): void { $credentials = $this->getAdminOrUserCredentials($user); $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $this->featureContext->setResponse( @@ -2183,7 +2302,8 @@ class GraphContext implements Context { Assert::assertEquals( 1, $count, - "Expected user '" . $user . "' to be added once to group '" . $group . "' but the user is listed '" . $count . "' times" + "Expected user '" . $user . "' to be added once to group '" + . $group . "' but the user is listed '" . $count . "' times" ); } @@ -2248,7 +2368,11 @@ class GraphContext implements Context { * @throws Exception * */ - public function downloadedJsonContentShouldContainEventTypeInItemAndShouldMatch(string $eventType, ?string $spaceType=null, PyStringNode $schemaString=null): void { + public function downloadedJsonContentShouldContainEventTypeInItemAndShouldMatch( + string $eventType, + ?string $spaceType=null, + PyStringNode $schemaString=null + ): void { $actualResponseToAssert = null; $events = $this->featureContext->getJsonDecodedResponseBodyContent()->events; foreach ($events as $event) { @@ -2307,7 +2431,11 @@ class GraphContext implements Context { * @return void * */ - public function userTriesToExportGdprReportOfAnotherUserUsingGraphApi(string $user, string $ofUser, string $path): void { + public function userTriesToExportGdprReportOfAnotherUserUsingGraphApi( + string $user, + string $ofUser, + string $path + ): void { $credentials = $this->getAdminOrUserCredentials($user); $this->featureContext->setResponse( GraphHelper::generateGDPRReport( @@ -2328,7 +2456,8 @@ class GraphContext implements Context { * @throws GuzzleException */ public function getAssignedRole(string $user): ResponseInterface { - $userId = $this->featureContext->getAttributeOfCreatedUser($user, 'id') ?: $this->featureContext->getUserIdByUserName($user); + $userId = $this->featureContext->getAttributeOfCreatedUser($user, 'id') + ?: $this->featureContext->getUserIdByUserName($user); return ( GraphHelper::getAssignedRole( $this->featureContext->getBAseUrl(), @@ -2359,7 +2488,9 @@ class GraphContext implements Context { if (!$userId && $ofUser !== $this->featureContext->getAdminUsername()) { $appRoleAssignmentId = $this->getRoleIdByRoleName("User"); } else { - $appRoleAssignmentId = $this->featureContext->getJsonDecodedResponse($this->getAssignedRole($ofUser))["value"][0]["id"]; + $appRoleAssignmentId = $this->featureContext->getJsonDecodedResponse( + $this->getAssignedRole($ofUser) + )["value"][0]["id"]; } $userId = $userId ?: $ofUser; @@ -2508,7 +2639,11 @@ class GraphContext implements Context { * @return void * @throws GuzzleException */ - public function userListsTheResourcesSharedWithThemUsingGraphApi(string $user, string $cacheStepString, string $retryOption): void { + public function userListsTheResourcesSharedWithThemUsingGraphApi( + string $user, + string $cacheStepString, + string $retryOption + ): void { if ($cacheStepString !== '') { // ENV (GRAPH_SPACES_GROUPS_CACHE_TTL | GRAPH_SPACES_USERS_CACHE_TTL) is set default to 60 sec // which means 60 sec is required to clean up all the user|group cache once they are deleted @@ -2537,7 +2672,9 @@ class GraphContext implements Context { if ($retryEnabled) { foreach ($jsonBody->value as $share) { $autoSync = $this->featureContext->getUserAutoSyncSetting($credentials['username']); - $tryAgain = !$share->{'@client.synchronize'} && $autoSync && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly(); + $tryAgain = !$share->{'@client.synchronize'} + && $autoSync + && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly(); if ($tryAgain) { $retried += 1; @@ -2676,7 +2813,11 @@ class GraphContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userUsingPasswordShouldBeAbleToCreateANewUserWithDefaultAttributes(string $byUser, string $password, string $user): void { + public function userUsingPasswordShouldBeAbleToCreateANewUserWithDefaultAttributes( + string $byUser, + string $password, + string $user + ): void { $response = GraphHelper::createUser( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), @@ -2749,7 +2890,7 @@ class GraphContext implements Context { * @throws GuzzleException * @throws Exception */ - public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $permissionRole):void { + public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $permissionRole): void { $credentials = $this->getAdminOrUserCredentials($user); $this->featureContext->setResponse( GraphHelper::getPermissionRoleDefinition( @@ -2772,7 +2913,11 @@ class GraphContext implements Context { * @return void * @throws Exception */ - public function userListsTheActivitiesForResourceOfSpaceUsingTheGraphAPI(string $user, string $resource, string $spaceName): void { + public function userListsTheActivitiesForResourceOfSpaceUsingTheGraphAPI( + string $user, + string $resource, + string $spaceName + ): void { $resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource); $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), @@ -2792,7 +2937,10 @@ class GraphContext implements Context { * * @return void */ - public function userTriesToListTheActivitiesOfFolderWithShareMountIdPointIdUsingTheGraphApi(string $user, string $folder): void { + public function userTriesToListTheActivitiesOfFolderWithShareMountIdPointIdUsingTheGraphApi( + string $user, + string $folder + ): void { $resourceId = GraphHelper::getShareMountId( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), @@ -2820,7 +2968,12 @@ class GraphContext implements Context { * * @return void */ - public function userTriesToListActivitiesOfFileFromSpaceOwnedByUserUsingTheGraphApi(string $user, string $file, string $owner, string $spaceName): void { + public function userTriesToListActivitiesOfFileFromSpaceOwnedByUserUsingTheGraphApi( + string $user, + string $file, + string $owner, + string $spaceName + ): void { $resourceId = $this->featureContext->spacesContext->getResourceId($owner, $spaceName, $file); $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), @@ -2861,7 +3014,11 @@ class GraphContext implements Context { * * @return void */ - public function thePublicTriesToCheckTheActivitiesOfSpaceOwnedByUserWithPasswordUsingGraphApi(string $spaceName, string $user, string $password): void { + public function thePublicTriesToCheckTheActivitiesOfSpaceOwnedByUserWithPasswordUsingGraphApi( + string $spaceName, + string $user, + string $password + ): void { $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), @@ -2882,7 +3039,12 @@ class GraphContext implements Context { * * @return void */ - public function thePublicTriesToCheckTheActivitiesOfResourceFromSpaceOwnedByUserWithPasswordUsingGraphApi(string $resource, string $space, string $owner, string $password): void { + public function thePublicTriesToCheckTheActivitiesOfResourceFromSpaceOwnedByUserWithPasswordUsingGraphApi( + string $resource, + string $space, + string $owner, + string $password + ): void { $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), @@ -2904,7 +3066,13 @@ class GraphContext implements Context { * * @return void */ - public function userListsTheActivitiesForFolderOfSpaceWithDepthOrLimitUsingTheGraphApi(string $user, string $resource, string $spaceName, string $filterType, string $filterValue): void { + public function userListsTheActivitiesForFolderOfSpaceWithDepthOrLimitUsingTheGraphApi( + string $user, + string $resource, + string $spaceName, + string $filterType, + string $filterValue + ): void { $resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource); $response = GraphHelper::getActivities( $this->featureContext->getBaseUrl(), @@ -2932,7 +3100,8 @@ class GraphContext implements Context { foreach ($table->getHash() as $index => $expectedValue) { $actualActivity = $activities[$index]; $expectedActivity = $expectedValue['resource'] . ":" . $expectedValue['message']; - $actualActivity = $actualActivity->template->variables->resource->name . ":" . $actualActivity->template->message; + $actualActivity = $actualActivity->template->variables->resource->name + . ":" . $actualActivity->template->message; Assert::assertEquals($expectedActivity, $actualActivity, "Activity didn't match"); } } diff --git a/tests/acceptance/bootstrap/NotificationContext.php b/tests/acceptance/bootstrap/NotificationContext.php index 0aa84873087..e12e5a26292 100644 --- a/tests/acceptance/bootstrap/NotificationContext.php +++ b/tests/acceptance/bootstrap/NotificationContext.php @@ -36,14 +36,14 @@ class NotificationContext implements Context { /** * @return array[] */ - public function getNotificationIds():array { + public function getNotificationIds(): array { return $this->notificationIds; } /** * @return array[] */ - public function getLastNotificationId():array { + public function getLastNotificationId(): array { return \end($this->notificationIds); } @@ -95,7 +95,7 @@ class NotificationContext implements Context { * @return void * @throws Exception */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context @@ -109,7 +109,7 @@ class NotificationContext implements Context { * * @return ResponseInterface */ - public function listAllNotifications(string $user):ResponseInterface { + public function listAllNotifications(string $user): ResponseInterface { $this->setUserRecipient($user); $language = SettingsHelper::getLanguageSettingValue( $this->featureContext->getBaseUrl(), @@ -138,7 +138,7 @@ class NotificationContext implements Context { * * @return void */ - public function userListAllNotifications(string $user):void { + public function userListAllNotifications(string $user): void { $response = $this->listAllNotifications($user); $this->featureContext->setResponse($response); $this->featureContext->pushToLastHttpStatusCodesArray(); @@ -151,7 +151,7 @@ class NotificationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function deleteAllNotifications(string $user):ResponseInterface { + public function deleteAllNotifications(string $user): ResponseInterface { $response = $this->listAllNotifications($user); if (isset($this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data)) { $responseBody = $this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data; @@ -172,7 +172,7 @@ class NotificationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userDeletesAllNotifications(string $user):void { + public function userDeletesAllNotifications(string $user): void { $response = $this->deleteAllNotifications($user); $this->featureContext->setResponse($response); } @@ -186,7 +186,7 @@ class NotificationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userHasDeletedAllNotifications(string $user):void { + public function userHasDeletedAllNotifications(string $user): void { $response = $this->deleteAllNotifications($user); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); } @@ -202,7 +202,7 @@ class NotificationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userDeletesNotificationOfResourceAndSubject(string $user, string $resource, string $subject):void { + public function userDeletesNotificationOfResourceAndSubject(string $user, string $resource, string $subject): void { $response = $this->listAllNotifications($user); $this->filterNotificationsBySubjectAndResource($subject, $resource, $response); $this->featureContext->setResponse($this->userDeletesNotification($user)); @@ -217,7 +217,7 @@ class NotificationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userDeletesNotification(string $user):ResponseInterface { + public function userDeletesNotification(string $user): ResponseInterface { $this->setUserRecipient($user); $payload["ids"] = $this->getNotificationIds(); return OcsApiHelper::sendRequest( @@ -324,7 +324,10 @@ class NotificationContext implements Context { * * @return object */ - public function filterResponseAccordingToNotificationSubject(string $subject, ?ResponseInterface $response = null): object { + public function filterResponseAccordingToNotificationSubject( + string $subject, + ?ResponseInterface $response = null + ): object { $response = $response ?? $this->featureContext->getResponse(); if (isset($this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data)) { $responseBody = $this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data; @@ -351,7 +354,11 @@ class NotificationContext implements Context { * * @return array */ - public function filterNotificationsBySubjectAndResource(string $subject, string $resource, ?ResponseInterface $response = null): array { + public function filterNotificationsBySubjectAndResource( + string $subject, + string $resource, + ?ResponseInterface $response = null + ): array { $filteredNotifications = []; $response = $response ?? $this->featureContext->getResponse(); $responseObject = $this->featureContext->getJsonDecodedResponseBodyContent($response); @@ -362,7 +369,10 @@ class NotificationContext implements Context { $notifications = $responseObject->ocs->data; foreach ($notifications as $notification) { - if (isset($notification->subject) && $notification->subject === $subject && isset($notification->messageRichParameters->resource->name) && $notification->messageRichParameters->resource->name === $resource) { + if (isset($notification->subject) && $notification->subject === $subject + && isset($notification->messageRichParameters->resource->name) + && $notification->messageRichParameters->resource->name === $resource + ) { $this->notificationIds[] = $notification->notification_id; $filteredNotifications[] = $notification; } @@ -380,7 +390,7 @@ class NotificationContext implements Context { * @return void * @throws Exception */ - public function userShouldGetANotificationWithMessage(string $user, string $subject, TableNode $table):void { + public function userShouldGetANotificationWithMessage(string $user, string $subject, TableNode $table): void { $count = 0; // Sometimes the test might try to get the notifications before the server has created the notification. // To prevent the test from failing because of that, try to list the notifications again @@ -392,9 +402,15 @@ class NotificationContext implements Context { $response = $this->listAllNotifications($user); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); ++$count; - } while (!isset($this->filterResponseAccordingToNotificationSubject($subject, $response)->message) && $count <= 5); + } while (!isset($this->filterResponseAccordingToNotificationSubject($subject, $response)->message) + && $count <= 5 + ); if (isset($this->filterResponseAccordingToNotificationSubject($subject, $response)->message)) { - $actualMessage = str_replace(["\r", "\n"], " ", $this->filterResponseAccordingToNotificationSubject($subject, $response)->message); + $actualMessage = str_replace( + ["\r", "\n"], + " ", + $this->filterResponseAccordingToNotificationSubject($subject, $response)->message + ); } else { throw new \Exception("Notification was not found even after retrying for 5 seconds."); } @@ -417,7 +433,12 @@ class NotificationContext implements Context { * @return void * @throws Exception */ - public function userShouldGetNotificationForResourceWithMessage(string $user, string $resource, string $subject, TableNode $table):void { + public function userShouldGetNotificationForResourceWithMessage( + string $user, + string $resource, + string $subject, + TableNode $table + ): void { $response = $this->listAllNotifications($user); $notification = $this->filterNotificationsBySubjectAndResource($subject, $resource, $response); @@ -432,9 +453,15 @@ class NotificationContext implements Context { $response = $this->userDeletesNotification($user); $this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response); } elseif (\count($notification) === 0) { - throw new \Exception("Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n" . print_r($notification, true)); + throw new \Exception( + "Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n" + . print_r($notification, true) + ); } else { - throw new \Exception("Response contains more than one notification with resource '$resource' and subject '$subject'.\n" . print_r($notification, true)); + throw new \Exception( + "Response contains more than one notification with resource '$resource' and subject '$subject'.\n" + . print_r($notification, true) + ); } } @@ -447,10 +474,19 @@ class NotificationContext implements Context { * * @return void */ - public function userShouldNotHaveANotificationRelatedToResourceWithSubject(string $user, string $resource, string $subject):void { + public function userShouldNotHaveANotificationRelatedToResourceWithSubject( + string $user, + string $resource, + string $subject + ): void { $response = $this->listAllNotifications($user); $filteredResponse = $this->filterNotificationsBySubjectAndResource($subject, $resource, $response); - Assert::assertCount(0, $filteredResponse, "Response should not contain notification related to resource '$resource' with subject '$subject' but found" . print_r($filteredResponse, true)); + Assert::assertCount( + 0, + $filteredResponse, + "Response should not contain notification related to resource '$resource' with subject '$subject' but found" + . print_r($filteredResponse, true) + ); } /** @@ -464,7 +500,12 @@ class NotificationContext implements Context { * @return void * @throws Exception */ - public function userShouldHaveReceivedTheFollowingEmailFromUserAboutTheShareOfProjectSpace(string $user, string $sender, string $spaceName, PyStringNode $content):void { + public function userShouldHaveReceivedTheFollowingEmailFromUserAboutTheShareOfProjectSpace( + string $user, + string $sender, + string $spaceName, + PyStringNode $content + ): void { $rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw()); $this->featureContext->setResponse( GraphHelper::getMySpaces( @@ -501,7 +542,11 @@ class NotificationContext implements Context { * @return void * @throws Exception */ - public function userShouldHaveReceivedTheFollowingEmailFromUser(string $user, string $sender, PyStringNode $content):void { + public function userShouldHaveReceivedTheFollowingEmailFromUser( + string $user, + string $sender, + PyStringNode $content + ): void { $rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw()); $expectedEmailBodyContent = $this->featureContext->substituteInLineCodes( $rawExpectedEmailBodyContent, @@ -520,7 +565,11 @@ class NotificationContext implements Context { * @return void * @throws Exception */ - public function userShouldHaveReceivedTheFollowingEmailFromUserIgnoringWhitespaces(string $user, string $sender, PyStringNode $content):void { + public function userShouldHaveReceivedTheFollowingEmailFromUserIgnoringWhitespaces( + string $user, + string $sender, + PyStringNode $content + ): void { $rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw()); $expectedEmailBodyContent = $this->featureContext->substituteInLineCodes( $rawExpectedEmailBodyContent, @@ -537,7 +586,11 @@ class NotificationContext implements Context { * @return void * @throws GuzzleException */ - public function assertEmailContains(string $user, string $expectedEmailBodyContent, $ignoreWhiteSpace = false):void { + public function assertEmailContains( + string $user, + string $expectedEmailBodyContent, + $ignoreWhiteSpace = false + ): void { $address = $this->featureContext->getEmailAddressForUser($user); $this->featureContext->pushEmailRecipientAsMailBox($address); $actualEmailBodyContent = EmailHelper::getBodyOfLastEmail($address, $this->featureContext->getStepLineRef()); @@ -548,7 +601,8 @@ class NotificationContext implements Context { Assert::assertStringContainsString( $expectedEmailBodyContent, $actualEmailBodyContent, - "The email address '$address' should have received an email with the body containing $expectedEmailBodyContent + "The email address '$address' should have received an" + . "email with the body containing $expectedEmailBodyContent but the received email is $actualEmailBodyContent" ); } @@ -560,7 +614,7 @@ class NotificationContext implements Context { * * @return void */ - public function clearInbucketMessages():void { + public function clearInbucketMessages(): void { try { if (!empty($this->featureContext->emailRecipients)) { foreach ($this->featureContext->emailRecipients as $emailRecipient) { @@ -594,9 +648,10 @@ class NotificationContext implements Context { ?string $user = null, ?string $deprovision_date = "2043-07-04T11:23:12Z", ?string $deprovision_date_format= "2006-01-02T15:04:05Z07:00" - ):ResponseInterface { + ): ResponseInterface { $payload["type"] = "deprovision"; - $payload["data"] = ["deprovision_date" => $deprovision_date, "deprovision_date_format" => $deprovision_date_format]; + $payload["data"] = [ + "deprovision_date" => $deprovision_date, "deprovision_date_format" => $deprovision_date_format]; return OcsApiHelper::sendRequest( $this->featureContext->getBaseUrl(), $user ? $this->featureContext->getActualUsername($user) : $this->featureContext->getAdminUsername(), @@ -636,7 +691,10 @@ class NotificationContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat($deprovision_date, $deprovision_date_format) { + public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat( + $deprovision_date, + $deprovision_date_format + ) { $response = $this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format); $this->featureContext->setResponse($response); $this->featureContext->pushToLastHttpStatusCodesArray(); @@ -647,7 +705,7 @@ class NotificationContext implements Context { * * @return void */ - public function userHasCreatedDeprovisioningNotification():void { + public function userHasCreatedDeprovisioningNotification(): void { $response = $this->userCreatesDeprovisioningNotification(); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); } @@ -660,7 +718,7 @@ class NotificationContext implements Context { * * @return void */ - public function userDeletesDeprovisioningNotification(?string $user = null):void { + public function userDeletesDeprovisioningNotification(?string $user = null): void { $payload["ids"] = ["deprovision"]; $response = OcsApiHelper::sendRequest( diff --git a/tests/acceptance/bootstrap/OCSContext.php b/tests/acceptance/bootstrap/OCSContext.php index 2a0ee2f0b0a..73b58ffd9ff 100644 --- a/tests/acceptance/bootstrap/OCSContext.php +++ b/tests/acceptance/bootstrap/OCSContext.php @@ -47,7 +47,7 @@ class OCSContext implements Context { * * @return void */ - public function theUserSendsToOcsApiEndpoint(string $verb, string $url):void { + public function theUserSendsToOcsApiEndpoint(string $verb, string $url): void { $response = $this->theUserSendsToOcsApiEndpointWithBody($verb, $url); $this->featureContext->setResponse($response); } @@ -63,7 +63,7 @@ class OCSContext implements Context { * * @return void */ - public function userSendsToOcsApiEndpoint(string $user, string $verb, string $url, ?string $password = null):void { + public function userSendsToOcsApiEndpoint(string $user, string $verb, string $url, ?string $password = null): void { $response = $this->sendRequestToOcsEndpoint( $user, $verb, @@ -91,7 +91,7 @@ class OCSContext implements Context { ?TableNode $body = null, ?string $password = null, ?array $headers = null - ):ResponseInterface { + ): ResponseInterface { /** * array of the data to be sent in the body. * contains $body data converted to an array @@ -134,7 +134,7 @@ class OCSContext implements Context { string $verb, string $url, ?TableNode $body - ):ResponseInterface { + ): ResponseInterface { $admin = $this->featureContext->getAdminUsername(); return $this->sendRequestToOcsEndpoint( $admin, @@ -151,7 +151,11 @@ class OCSContext implements Context { * * @return ResponseInterface */ - public function theUserSendsToOcsApiEndpointWithBody(string $verb, string $url, ?TableNode $body = null):ResponseInterface { + public function theUserSendsToOcsApiEndpointWithBody( + string $verb, + string $url, + ?TableNode $body = null + ): ResponseInterface { return $this->sendRequestToOcsEndpoint( $this->featureContext->getCurrentUser(), $verb, @@ -177,7 +181,7 @@ class OCSContext implements Context { string $url, ?TableNode $body = null, ?string $password = null - ):void { + ): void { $response = $this->sendRequestToOcsEndpoint( $user, $verb, @@ -202,7 +206,7 @@ class OCSContext implements Context { string $verb, string $url, ?string $password = null - ):void { + ): void { $this->featureContext->setResponse( $this->sendRequestToOcsEndpoint( $this->featureContext->getAdminUsername(), @@ -230,7 +234,7 @@ class OCSContext implements Context { string $verb, string $url, TableNode $headersTable - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $password = $this->featureContext->getPasswordForUser($user); $this->featureContext->setResponse( @@ -259,7 +263,7 @@ class OCSContext implements Context { string $verb, string $url, TableNode $headersTable - ):void { + ): void { $user = $this->featureContext->getAdminUsername(); $password = $this->featureContext->getPasswordForUser($user); $this->featureContext->setResponse( @@ -290,7 +294,7 @@ class OCSContext implements Context { string $url, string $password, TableNode $headersTable - ):void { + ): void { $this->featureContext->setResponse( $this->sendRequestToOcsEndpoint( $this->featureContext->getAdminUsername(), @@ -316,7 +320,7 @@ class OCSContext implements Context { string $verb, string $url, ?TableNode $body - ):void { + ): void { $response = $this->adminSendsHttpMethodToOcsApiEndpointWithBody( $verb, $url, @@ -334,7 +338,7 @@ class OCSContext implements Context { * * @return void */ - public function theUserSendsHTTPMethodToOcsApiEndpointWithBody(string $verb, string $url, TableNode $body):void { + public function theUserSendsHTTPMethodToOcsApiEndpointWithBody(string $verb, string $url, TableNode $body): void { $response = $this->theUserSendsToOcsApiEndpointWithBody( $verb, $url, @@ -358,7 +362,7 @@ class OCSContext implements Context { string $url, string $password, TableNode $body - ):void { + ): void { $admin = $this->featureContext->getAdminUsername(); $response = $this->sendRequestToOcsEndpoint( $admin, @@ -387,7 +391,7 @@ class OCSContext implements Context { string $url, string $password, TableNode $body - ):void { + ): void { $response = $this->sendRequestToOcsEndpoint( $user, $verb, @@ -408,7 +412,11 @@ class OCSContext implements Context { * @return void * @throws Exception */ - public function theOCSStatusCodeShouldBe(string $statusCode, string $message = "", ?ResponseInterface $response = null):void { + public function theOCSStatusCodeShouldBe( + string $statusCode, + string $message = "", + ?ResponseInterface $response = null + ): void { $statusCodes = explode(",", $statusCode); $response = $response ?? $this->featureContext->getResponse(); $responseStatusCode = $this->getOCSResponseStatusCode( @@ -416,7 +424,8 @@ class OCSContext implements Context { ); if (\is_array($statusCodes)) { if ($message === "") { - $message = "OCS status code is not any of the expected values " . \implode(",", $statusCodes) . " got " . $responseStatusCode; + $message = "OCS status code is not any of the expected values " + . \implode(",", $statusCodes) . " got " . $responseStatusCode; } Assert::assertContainsEquals( $responseStatusCode, @@ -446,7 +455,7 @@ class OCSContext implements Context { * @return void * @throws Exception */ - public function theOcsStatusCodeShouldBeOr(string $statusCode1, string $statusCode2):void { + public function theOcsStatusCodeShouldBeOr(string $statusCode1, string $statusCode2): void { $statusCodes = [$statusCode1,$statusCode1]; $response = $this->featureContext->getResponse(); $responseStatusCode = $this->getOCSResponseStatusCode( @@ -455,7 +464,8 @@ class OCSContext implements Context { Assert::assertContainsEquals( $responseStatusCode, $statusCodes, - "OCS status code is not any of the expected values " . \implode(",", $statusCodes) . " got " . $responseStatusCode + "OCS status code is not any of the expected values " + . \implode(",", $statusCodes) . " got " . $responseStatusCode ); $this->featureContext->emptyLastOCSStatusCodesArray(); } @@ -471,7 +481,7 @@ class OCSContext implements Context { * * @return void */ - public function theOCSStatusMessageShouldBe(string $statusMessage, ?string $language = null):void { + public function theOCSStatusMessageShouldBe(string $statusMessage, ?string $language = null): void { $language = TranslationHelper::getLanguage($language); $statusMessage = $this->getActualStatusMessage($statusMessage, $language); @@ -496,7 +506,7 @@ class OCSContext implements Context { * * @return void */ - public function theOCSStatusMessageAboutUserShouldBe(string $user, string $statusMessage):void { + public function theOCSStatusMessageAboutUserShouldBe(string $user, string $statusMessage): void { $user = \strtolower($this->featureContext->getActualUsername($user)); $statusMessage = $this->featureContext->substituteInLineCodes( $statusMessage, @@ -533,7 +543,7 @@ class OCSContext implements Context { */ public function theOCSStatusMessageShouldBePyString( PyStringNode $statusMessage - ):void { + ): void { Assert::assertEquals( $statusMessage->getRaw(), $this->getOCSResponseStatusMessage( @@ -554,7 +564,7 @@ class OCSContext implements Context { * @return string * @throws Exception */ - public function getOCSResponseStatusCode(ResponseInterface $response):string { + public function getOCSResponseStatusCode(ResponseInterface $response): string { try { $jsonResponse = $this->featureContext->getJsonDecodedResponseBodyContent($response); } catch (JsonException $e) { @@ -596,7 +606,7 @@ class OCSContext implements Context { * * @return string */ - public function getOCSResponseStatusMessage(ResponseInterface $response):string { + public function getOCSResponseStatusMessage(ResponseInterface $response): string { return (string) HttpRequestHelper::getResponseXml($response, __METHOD__)->meta[0]->message; } @@ -608,7 +618,7 @@ class OCSContext implements Context { * * @return string */ - public function getActualStatusMessage(string $statusMessage, ?string $language = null):string { + public function getActualStatusMessage(string $statusMessage, ?string $language = null): string { if ($language !== null) { $multiLingualMessage = \json_decode( \file_get_contents(__DIR__ . "/../fixtures/multiLanguageErrors.json"), @@ -632,7 +642,10 @@ class OCSContext implements Context { * @return void * @throws Exception */ - public function assertOCSResponseIndicatesSuccess(?string $message = "", ?ResponseInterface $response = null):void { + public function assertOCSResponseIndicatesSuccess( + ?string $message = "", + ?ResponseInterface $response = null + ): void { $response = $response ?? $this->featureContext->getResponse(); $this->featureContext->theHTTPStatusCodeShouldBe('200', $message, $response); if ($this->featureContext->getOcsApiVersion() === 1) { @@ -652,7 +665,7 @@ class OCSContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context diff --git a/tests/acceptance/bootstrap/OcmContext.php b/tests/acceptance/bootstrap/OcmContext.php index 90181a35987..89e95a70ff2 100644 --- a/tests/acceptance/bootstrap/OcmContext.php +++ b/tests/acceptance/bootstrap/OcmContext.php @@ -56,7 +56,7 @@ class OcmContext implements Context { * @return string * @throws Exception */ - public function getLastFederatedInvitationToken():string { + public function getLastFederatedInvitationToken(): string { if (empty($this->invitationToken)) { throw new Exception(__METHOD__ . " token not found"); } @@ -286,7 +286,11 @@ class OcmContext implements Context { */ public function userHasDeletedFederatedConnectionWithUser(string $user, string $ocmUser): void { $response = $this->deleteConnection($user, $ocmUser); - $this->featureContext->theHTTPStatusCodeShouldBe(200, "failed while deleting connection with user $ocmUser", $response); + $this->featureContext->theHTTPStatusCodeShouldBe( + 200, + "failed while deleting connection with user $ocmUser", + $response + ); } /** diff --git a/tests/acceptance/bootstrap/Provisioning.php b/tests/acceptance/bootstrap/Provisioning.php index 487b6e2aa36..ca96d55a06d 100644 --- a/tests/acceptance/bootstrap/Provisioning.php +++ b/tests/acceptance/bootstrap/Provisioning.php @@ -59,7 +59,7 @@ trait Provisioning { * * @return boolean */ - public function isLocalAdminGroup(string $groupname):bool { + public function isLocalAdminGroup(string $groupname): bool { return ($groupname === "admin"); } @@ -72,28 +72,28 @@ trait Provisioning { * * @return string */ - public function normalizeUsername(?string $username):string { + public function normalizeUsername(?string $username): string { return \strtolower((string)$username); } /** * @return array */ - public function getCreatedUsers():array { + public function getCreatedUsers(): array { return $this->createdUsers; } /** * @return array */ - public function getAllCreatedUsers():array { + public function getAllCreatedUsers(): array { return array_merge($this->createdUsers, $this->createdRemoteUsers); } /** * @return array */ - public function getCreatedGroups():array { + public function getCreatedGroups(): array { return $this->createdGroups; } @@ -105,7 +105,7 @@ trait Provisioning { * * @return string */ - public function getUserDisplayName(string $username):string { + public function getUserDisplayName(string $username): string { $normalizedUsername = $this->normalizeUsername($username); $users = $this->getAllCreatedUsers(); if (isset($users[$normalizedUsername]['displayname'])) { @@ -169,7 +169,7 @@ trait Provisioning { * @return string password * @throws Exception */ - public function getUserPassword(string $username):string { + public function getUserPassword(string $username): string { $normalizedUsername = $this->normalizeUsername($username); if ($normalizedUsername === $this->getAdminUsername()) { $password = $this->getAdminPassword(); @@ -197,7 +197,7 @@ trait Provisioning { */ public function userHasBeenCreatedWithDefaultAttributes( string $user - ):void { + ): void { $this->userHasBeenCreated(["userName" => $user]); } @@ -211,7 +211,7 @@ trait Provisioning { */ public function userHasBeenCreatedWithDefaultAttributesAndNotInitialized( TableNode $table - ):void { + ): void { $this->usersHaveBeenCreated($table, true, false); } @@ -225,7 +225,7 @@ trait Provisioning { * @return void * @throws Exception|GuzzleException */ - public function theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles(TableNode $table):void { + public function theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles(TableNode $table): void { $this->usersHaveBeenCreated($table); } @@ -253,7 +253,7 @@ trait Provisioning { * @return boolean * @throws Exception */ - public function theGroupShouldBeAbleToBeDeleted(string $groupname):bool { + public function theGroupShouldBeAbleToBeDeleted(string $groupname): bool { if (\array_key_exists($groupname, $this->createdGroups)) { return $this->createdGroups[$groupname]['possibleToDelete'] ?? true; } @@ -274,7 +274,7 @@ trait Provisioning { * * @return void */ - public function importLdifFile(string $path):void { + public function importLdifFile(string $path): void { $ldifData = \file_get_contents($path); $this->importLdifData($ldifData); } @@ -286,7 +286,7 @@ trait Provisioning { * * @return void */ - public function importLdifData(string $ldifData):void { + public function importLdifData(string $ldifData): void { $items = Laminas\Ldap\Ldif\Encoder::decode($ldifData); if (isset($items['dn'])) { //only one item in the ldif data @@ -314,7 +314,7 @@ trait Provisioning { * @throws Exception * @throws \LdapException */ - public function connectToLdap(array $suiteParameters):void { + public function connectToLdap(array $suiteParameters): void { $this->ldapBaseDN = OcisHelper::getBaseDN(); $this->ldapUsersOU = OcisHelper::getUsersOU(); $this->ldapGroupsOU = OcisHelper::getGroupsOU(); @@ -365,7 +365,7 @@ trait Provisioning { * @return array * @throws JsonException */ - public function buildUsersAttributesArray(bool $setDefaultAttributes, array $table):array { + public function buildUsersAttributesArray(bool $setDefaultAttributes, array $table): array { $usersAttributes = []; foreach ($table as $row) { $userAttribute['userid'] = $this->getActualUsername($row['username']); @@ -412,7 +412,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function createLdapUser(array $setting):void { + public function createLdapUser(array $setting): void { $ou = $this->ldapUsersOU ; // Some special characters need to be escaped in LDAP DN and attributes // The special characters allowed in a username (UID) are +_.@- @@ -455,7 +455,11 @@ trait Provisioning { } catch (LdapException $e) { if (\str_contains($e->getMessage(), "Already exists")) { $this->ldap->delete( - "uid=" . ldap_escape($entry['uid'], "", LDAP_ESCAPE_DN) . ",ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN, + "uid=" . ldap_escape( + $entry['uid'], + "", + LDAP_ESCAPE_DN + ) . ",ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN, ); OcisHelper::deleteRevaUserData([$entry['uid']]); $this->ldap->add($newDN, $entry); @@ -472,7 +476,7 @@ trait Provisioning { * @throws Exception * @throws LdapException */ - public function createLdapGroup(string $group):void { + public function createLdapGroup(string $group): void { $baseDN = $this->getLdapBaseDN(); $newDN = 'cn=' . $group . ',ou=' . $this->ldapGroupsOU . ',' . $baseDN; $entry = []; @@ -496,7 +500,8 @@ trait Provisioning { } catch (LdapException $e) { if (\str_contains($e->getMessage(), "Already exists")) { $this->ldap->delete( - "cn=" . ldap_escape($group, "", LDAP_ESCAPE_DN) . ",ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN, + "cn=" . ldap_escape($group, "", LDAP_ESCAPE_DN) + . ",ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN, ); $this->ldap->add($newDN, $entry); } @@ -510,7 +515,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function deleteLdapUsersAndGroups():void { + public function deleteLdapUsersAndGroups(): void { foreach ($this->ldapCreatedUsers as $user) { $this->ldap->delete( "uid=" . ldap_escape($user, "", LDAP_ESCAPE_DN) . ",ou=" . $this->ldapUsersOU . "," . $this->ldapBaseDN, @@ -519,7 +524,8 @@ trait Provisioning { } foreach ($this->ldapCreatedGroups as $group) { $this->ldap->delete( - "cn=" . ldap_escape($group, "", LDAP_ESCAPE_DN) . ",ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN, + "cn=" . ldap_escape($group, "", LDAP_ESCAPE_DN) + . ",ou=" . $this->ldapGroupsOU . "," . $this->ldapBaseDN, ); $this->rememberThatGroupIsNotExpectedToExist($group); } @@ -667,7 +673,7 @@ trait Provisioning { * * @return void */ - public function resetUserPasswordAsAdminUsingTheProvisioningApi(string $username, ?string $password):void { + public function resetUserPasswordAsAdminUsingTheProvisioningApi(string $username, ?string $password): void { $this->userResetUserPasswordUsingProvisioningApi( $this->getAdminUsername(), $username, @@ -682,7 +688,11 @@ trait Provisioning { * * @return void */ - public function userResetUserPasswordUsingProvisioningApi(?string $user, ?string $username, ?string $password):void { + public function userResetUserPasswordUsingProvisioningApi( + ?string $user, + ?string $username, + ?string $password + ): void { $targetUsername = $this->getActualUsername($username); $password = $this->getActualPassword($password); $this->userTriesToResetUserPasswordUsingTheProvisioningApi( @@ -700,7 +710,11 @@ trait Provisioning { * * @return void */ - public function userTriesToResetUserPasswordUsingTheProvisioningApi(?string $user, ?string $username, ?string $password):void { + public function userTriesToResetUserPasswordUsingTheProvisioningApi( + ?string $user, + ?string $username, + ?string $password + ): void { $password = $this->getActualPassword($password); $bodyTable = new TableNode([['key', 'password'], ['value', $password]]); $this->ocsContext->sendRequestToOcsEndpoint( @@ -719,7 +733,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theAdminDeletesUserUsingTheProvisioningApi(string $user):void { + public function theAdminDeletesUserUsingTheProvisioningApi(string $user): void { $user = $this->getActualUsername($user); $this->setResponse($this->deleteUser($user)); $this->pushToLastHttpStatusCodesArray(); @@ -733,7 +747,7 @@ trait Provisioning { * @return void * @throws JsonException */ - public function userShouldExist(string $user):void { + public function userShouldExist(string $user): void { Assert::assertTrue( $this->userExists($user), "User '$user' should exist but does not exist" @@ -748,7 +762,7 @@ trait Provisioning { * @return void * @throws JsonException */ - public function userShouldNotExist(string $user):void { + public function userShouldNotExist(string $user): void { $user = $this->getActualUsername($user); Assert::assertFalse( $this->userExists($user), @@ -766,7 +780,7 @@ trait Provisioning { * @throws Exception * @throws GuzzleException */ - public function groupShouldExist(string $group):void { + public function groupShouldExist(string $group): void { Assert::assertTrue( $this->groupExists($group), "Group '$group' should exist but does not exist" @@ -782,7 +796,7 @@ trait Provisioning { * @throws Exception * @throws GuzzleException */ - public function groupShouldNotExist(string $group):void { + public function groupShouldNotExist(string $group): void { Assert::assertFalse( $this->groupExists($group), "Group '$group' should not exist but does exist" @@ -799,7 +813,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theseGroupsShouldNotExist(string $shouldOrNot, TableNode $table):void { + public function theseGroupsShouldNotExist(string $shouldOrNot, TableNode $table): void { $should = ($shouldOrNot !== "not"); $this->verifyTableNodeColumns($table, ['groupname']); if ($this->isTestingWithLdap()) { @@ -826,7 +840,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function userHasBeenDeleted(string $user):void { + public function userHasBeenDeleted(string $user): void { $user = $this->getActualUsername($user); if ($this->userExists($user)) { if ($this->isTestingWithLdap() && \in_array($user, $this->ldapCreatedUsers)) { @@ -853,7 +867,7 @@ trait Provisioning { * * @return void */ - public function theseUsersHaveBeenInitialized(TableNode $table):void { + public function theseUsersHaveBeenInitialized(TableNode $table): void { foreach ($table as $row) { if (!isset($row ['password'])) { $password = $this->getPasswordForUser($row ['username']); @@ -872,7 +886,7 @@ trait Provisioning { * * @return ResponseInterface */ - public function getAllGroups():ResponseInterface { + public function getAllGroups(): ResponseInterface { $fullUrl = $this->getBaseUrl() . "/ocs/v$this->ocsApiVersion.php/cloud/groups"; return HttpRequestHelper::get( $fullUrl, @@ -888,7 +902,7 @@ trait Provisioning { * * @return void */ - public function userGetsAllTheGroupsOfUser(string $user, string $otherUser):void { + public function userGetsAllTheGroupsOfUser(string $user, string $otherUser): void { $actualOtherUser = $this->getActualUsername($otherUser); $fullUrl = $this->getBaseUrl() . "/ocs/v$this->ocsApiVersion.php/cloud/users/$actualOtherUser/groups"; $actualUser = $this->getActualUsername($user); @@ -909,7 +923,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function userGetsTheListOfAllUsersUsingTheProvisioningApi(string $user):void { + public function userGetsTheListOfAllUsersUsingTheProvisioningApi(string $user): void { $this->featureContext->setResponse( $this->userGetsTheListOfAllUsers($user) ); @@ -920,7 +934,7 @@ trait Provisioning { * * @return ResponseInterface */ - public function userGetsTheListOfAllUsers(string $user):ResponseInterface { + public function userGetsTheListOfAllUsers(string $user): ResponseInterface { $fullUrl = $this->getBaseUrl() . "/ocs/v$this->ocsApiVersion.php/cloud/users"; $actualUser = $this->getActualUsername($user); $actualPassword = $this->getUserPassword($actualUser); @@ -941,7 +955,7 @@ trait Provisioning { * * @return void */ - public function initializeUser(string $user, string $password):void { + public function initializeUser(string $user, string $password): void { $url = $this->getBaseUrl() . "/graph/v1.0/users/$user"; if (OcisHelper::isTestingOnReva()) { @@ -979,7 +993,7 @@ trait Provisioning { ?string $email = null, ?string $userId = null, bool $shouldExist = true - ):void { + ): void { $user = $this->getActualUsername($user); $normalizedUsername = $this->normalizeUsername($user); $userData = [ @@ -1021,7 +1035,7 @@ trait Provisioning { public function rememberUserPassword( string $user, string $password - ):void { + ): void { $normalizedUsername = $this->normalizeUsername($user); if ($this->currentServer === 'LOCAL') { if (\array_key_exists($normalizedUsername, $this->createdUsers)) { @@ -1040,7 +1054,7 @@ trait Provisioning { * * @return void */ - public function updateUsernameInCreatedUserList(string $oldUserName, string $newUserName) :void { + public function updateUsernameInCreatedUserList(string $oldUserName, string $newUserName): void { $normalizedUsername = $this->normalizeUsername($oldUserName); $normalizeNewUserName = $this->normalizeUsername($newUserName); if (\array_key_exists($normalizedUsername, $this->createdUsers)) { @@ -1064,7 +1078,7 @@ trait Provisioning { * * @return void */ - public function rememberThatUserIsNotExpectedToExist(string $user):void { + public function rememberThatUserIsNotExpectedToExist(string $user): void { $user = $this->getActualUsername($user); $normalizedUsername = $this->normalizeUsername($user); if (\array_key_exists($normalizedUsername, $this->createdUsers)) { @@ -1085,7 +1099,7 @@ trait Provisioning { public function userHasBeenCreated( array $userData, string $byUser = null - ):void { + ): void { $userId = null; $user = $userData["userName"]; @@ -1167,7 +1181,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function adminRemovesUserFromGroupUsingTheProvisioningApi(string $user, string $group):void { + public function adminRemovesUserFromGroupUsingTheProvisioningApi(string $user, string $group): void { $user = $this->getActualUsername($user); if (OcisHelper::isTestingOnReva()) { $this->response = UserHelper::removeUserFromGroup( @@ -1199,7 +1213,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theExtraGroupsShouldBe(TableNode $groupsList):void { + public function theExtraGroupsShouldBe(TableNode $groupsList): void { $this->verifyTableNodeColumnsCount($groupsList, 1); $groups = $groupsList->getRows(); $groupsSimplified = $this->simplifyArray($groups); @@ -1227,7 +1241,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function cleanupGroup(string $group):void { + public function cleanupGroup(string $group): void { try { if ($this->isTestingWithLdap()) { $this->deleteLdapGroup($group); @@ -1259,7 +1273,7 @@ trait Provisioning { * @return bool * @throws JsonException */ - public function userExists(string $user):bool { + public function userExists(string $user): bool { $path = (!OcisHelper::isTestingOnReva()) ? "/graph/v1.0" : "/ocs/v2.php/cloud"; @@ -1294,7 +1308,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function userShouldBelongToGroup(string $user, string $group):void { + public function userShouldBelongToGroup(string $user, string $group): void { $user = $this->getActualUsername($user); if (OcisHelper::isTestingOnReva()) { $this->userGetsAllTheGroupsOfUser($this->getAdminUsername(), $user); @@ -1331,7 +1345,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theTheFollowingUserShouldNotBelongToTheFollowingGroup(TableNode $table):void { + public function theTheFollowingUserShouldNotBelongToTheFollowingGroup(TableNode $table): void { $this->verifyTableNodeColumns($table, ["username", "groupname"]); $rows = $table->getHash(); foreach ($rows as $row) { @@ -1366,7 +1380,7 @@ trait Provisioning { * * @return void */ - public function groupShouldNotContainUser(string $group, string $username):void { + public function groupShouldNotContainUser(string $group, string $username): void { $username = $this->getActualUsername($username); $fullUrl = $this->getBaseUrl() . "/ocs/v2.php/cloud/groups/$group"; $response = HttpRequestHelper::get( @@ -1387,7 +1401,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function adminAddsUserToGroupUsingTheProvisioningApi(string $user, string $group):void { + public function adminAddsUserToGroupUsingTheProvisioningApi(string $user, string $group): void { $response = $this->graphContext->addUserToGroup($group, $user); $this->setResponse($response); } @@ -1401,7 +1415,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function userHasBeenAddedToGroup(string $user, string $group):void { + public function userHasBeenAddedToGroup(string $user, string $group): void { $user = $this->getActualUsername($user); if ($this->isTestingWithLdap()) { try { @@ -1428,7 +1442,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theFollowingUserHaveBeenAddedToTheFollowingGroup(TableNode $table):void { + public function theFollowingUserHaveBeenAddedToTheFollowingGroup(TableNode $table): void { $this->verifyTableNodeColumns($table, ['username', 'groupname']); foreach ($table as $row) { $user = $row['username']; @@ -1465,7 +1479,7 @@ trait Provisioning { bool $shouldExist = true, bool $possibleToDelete = true, ?string $id = null - ):void { + ): void { $groupData = [ "shouldExist" => $shouldExist, "possibleToDelete" => $possibleToDelete @@ -1491,7 +1505,7 @@ trait Provisioning { * * @return void */ - public function rememberThatGroupIsNotExpectedToExist(string $group):void { + public function rememberThatGroupIsNotExpectedToExist(string $group): void { if (\array_key_exists($group, $this->createdGroups)) { $this->createdGroups[$group]['shouldExist'] = false; $this->createdGroups[$group]['possibleToDelete'] = false; @@ -1507,7 +1521,7 @@ trait Provisioning { * @throws Exception * @throws GuzzleException */ - public function groupHasBeenCreated(string $group):void { + public function groupHasBeenCreated(string $group): void { $this->createTheGroup($group); Assert::assertTrue( $this->groupExists($group), @@ -1524,7 +1538,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theseGroupsHaveBeenCreated(TableNode $table):void { + public function theseGroupsHaveBeenCreated(TableNode $table): void { $this->verifyTableNodeColumns($table, ['groupname'], ['comment']); foreach ($table as $row) { $this->createTheGroup($row['groupname']); @@ -1540,7 +1554,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function createTheGroup(string $group, ?string $method = null):void { + public function createTheGroup(string $group, ?string $method = null): void { //guess yourself if ($method === null) { if ($this->isTestingWithLdap()) { @@ -1594,7 +1608,7 @@ trait Provisioning { string $entry, string $value, bool $append = false - ):void { + ): void { $ldapEntry = $this->ldap->getEntry($entry . "," . $this->ldapBaseDN); Laminas\Ldap\Attribute::setAttribute($ldapEntry, $attribute, $value, $append); $this->ldap->update($entry . "," . $this->ldapBaseDN, $ldapEntry); @@ -1608,7 +1622,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function addUserToLdapGroup(string $user, string $group, ?string $ou = null):void { + public function addUserToLdapGroup(string $user, string $group, ?string $ou = null): void { if ($ou === null) { $ou = $this->getLdapGroupsOU(); } @@ -1635,7 +1649,7 @@ trait Provisioning { * * @return void */ - public function deleteValueFromLdapAttribute(string $value, string $attribute, string $entry):void { + public function deleteValueFromLdapAttribute(string $value, string $attribute, string $entry): void { $this->ldap->deleteAttributes( $entry . "," . $this->ldapBaseDN, [$attribute => [$value]] @@ -1650,7 +1664,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function removeUserFromLdapGroup(string $user, string $group, ?string $ou = null):void { + public function removeUserFromLdapGroup(string $user, string $group, ?string $ou = null): void { if ($ou === null) { $ou = $this->getLdapGroupsOU(); } @@ -1675,7 +1689,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function deleteTheLdapEntry(string $entry):void { + public function deleteTheLdapEntry(string $entry): void { $this->ldap->delete($entry . "," . $this->ldapBaseDN); } @@ -1687,7 +1701,7 @@ trait Provisioning { * @throws LdapException * @throws Exception */ - public function deleteLdapGroup(string $group, ?string $ou = null):void { + public function deleteLdapGroup(string $group, ?string $ou = null): void { if ($ou === null) { $ou = $this->getLdapGroupsOU(); } @@ -1706,7 +1720,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function deleteLdapUser(?string $username, ?string $ou = null):void { + public function deleteLdapUser(?string $username, ?string $ou = null): void { if (!\in_array($username, $this->ldapCreatedUsers)) { throw new Error( "User " . $username . " was not created using Ldap and does not exist as an Ldap User" @@ -1732,12 +1746,20 @@ trait Provisioning { * @return void * @throws Exception */ - public function adminHasDisabledUserUsingTheProvisioningApi(?string $user):void { + public function adminHasDisabledUserUsingTheProvisioningApi(?string $user): void { $user = $this->getActualUsername($user); if (OcisHelper::isTestingOnReva()) { $response = $this->disableOrEnableUser($this->getAdminUsername(), $user, 'disable'); } else { - $response = $this->graphContext->editUserUsingTheGraphApi($this->getAdminUsername(), $user, null, null, null, null, false); + $response = $this->graphContext->editUserUsingTheGraphApi( + $this->getAdminUsername(), + $user, + null, + null, + null, + null, + false + ); } Assert::assertEquals( 200, @@ -1754,7 +1776,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function deleteUser(string $user):ResponseInterface { + public function deleteUser(string $user): ResponseInterface { // Always try to delete the user if (OcisHelper::isTestingOnReva()) { $response = UserHelper::deleteUser( @@ -1781,7 +1803,7 @@ trait Provisioning { * @throws Exception * @throws GuzzleException */ - public function groupHasBeenDeleted(string $group):void { + public function groupHasBeenDeleted(string $group): void { if ($this->isTestingWithLdap()) { $this->deleteLdapGroup($group); } else { @@ -1802,7 +1824,7 @@ trait Provisioning { * @throws Exception * @throws GuzzleException */ - public function groupExists(string $group):bool { + public function groupExists(string $group): bool { if ($this->isTestingWithLdap()) { $baseDN = $this->getLdapBaseDN(); $newDN = 'cn=' . $group . ',ou=' . $this->ldapGroupsOU . ',' . $baseDN; @@ -1834,7 +1856,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function adminHasRemovedUserFromGroup(string $user, string $group):void { + public function adminHasRemovedUserFromGroup(string $user, string $group): void { $user = $this->getActualUsername($user); if ($this->isTestingWithLdap() && !$this->isLocalAdminGroup($group) @@ -1874,7 +1896,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theUsersShouldBe(TableNode $usersList):void { + public function theUsersShouldBe(TableNode $usersList): void { $this->verifyTableNodeColumnsCount($usersList, 1); $users = $usersList->getRows(); $usersSimplified = \array_map( @@ -1904,7 +1926,7 @@ trait Provisioning { * @return array * @throws Exception */ - public function getArrayOfUsersResponded(ResponseInterface $resp):array { + public function getArrayOfUsersResponded(ResponseInterface $resp): array { $listCheckedElements = HttpRequestHelper::getResponseXml($resp, __METHOD__)->data[0]->users[0]->element; return \json_decode(\json_encode($listCheckedElements), true); } @@ -1917,7 +1939,7 @@ trait Provisioning { * @return array * @throws Exception */ - public function getArrayOfGroupsResponded(ResponseInterface $resp):array { + public function getArrayOfGroupsResponded(ResponseInterface $resp): array { $listCheckedElements = HttpRequestHelper::getResponseXml($resp, __METHOD__)->data[0]->groups[0]->element; return \json_decode(\json_encode($listCheckedElements), true); @@ -1931,7 +1953,7 @@ trait Provisioning { * @return array * @throws Exception */ - public function getArrayOfAppsResponded(ResponseInterface $resp):array { + public function getArrayOfAppsResponded(ResponseInterface $resp): array { $listCheckedElements = HttpRequestHelper::getResponseXml($resp, __METHOD__)->data[0]->apps[0]->element; return \json_decode(\json_encode($listCheckedElements), true); } @@ -1942,7 +1964,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function theApiShouldNotReturnAnyData():void { + public function theApiShouldNotReturnAnyData(): void { $responseData = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]; Assert::assertEmpty( $responseData, @@ -1956,7 +1978,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function afterScenario():void { + public function afterScenario(): void { if (OcisHelper::isTestingOnReva()) { OcisHelper::deleteRevaUserData($this->getCreatedUsers()); } @@ -1973,7 +1995,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function cleanupDatabaseUsers():void { + public function cleanupDatabaseUsers(): void { $previousServer = $this->currentServer; $this->usingServer('LOCAL'); foreach ($this->createdUsers as $userData) { @@ -2003,7 +2025,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function cleanupDatabaseGroups():void { + public function cleanupDatabaseGroups(): void { $previousServer = $this->currentServer; $this->usingServer('LOCAL'); foreach ($this->createdGroups as $group => $groupData) { @@ -2036,7 +2058,7 @@ trait Provisioning { * @return void * @throws Exception */ - public function rememberGroupsThatExistAtTheStartOfTheScenario():void { + public function rememberGroupsThatExistAtTheStartOfTheScenario(): void { $this->startingGroups = $this->getArrayOfGroupsResponded($this->getAllGroups()); } diff --git a/tests/acceptance/bootstrap/PublicWebDavContext.php b/tests/acceptance/bootstrap/PublicWebDavContext.php index e0c9dd5bff5..76a1f74f8d6 100644 --- a/tests/acceptance/bootstrap/PublicWebDavContext.php +++ b/tests/acceptance/bootstrap/PublicWebDavContext.php @@ -43,7 +43,7 @@ class PublicWebDavContext implements Context { * * @return ResponseInterface */ - public function downloadPublicFileWithRange(string $range, ?string $password = ""):ResponseInterface { + public function downloadPublicFileWithRange(string $range, ?string $password = ""): ResponseInterface { // In this case a single file has been shared as a public link. // Even if that file is somewhere down inside a folder(s), when // accessing it as a public link using the public webDAV API @@ -66,7 +66,7 @@ class PublicWebDavContext implements Context { * * @return void */ - public function downloadPublicFile():void { + public function downloadPublicFile(): void { $response = $this->downloadPublicFileWithRange(""); $this->featureContext->setResponse($response); } @@ -79,7 +79,7 @@ class PublicWebDavContext implements Context { * * @return void */ - public function downloadPublicFileWithPassword(string $password):void { + public function downloadPublicFileWithPassword(string $password): void { $response = $this->downloadPublicFileWithRange("", $password); $this->featureContext->setResponse($response); } @@ -92,7 +92,10 @@ class PublicWebDavContext implements Context { * * @return void */ - public function userTriesToDownloadFileFromPublicLinkUsingBasicAuthAndPublicWebdav(string $user, string $path): void { + public function userTriesToDownloadFileFromPublicLinkUsingBasicAuthAndPublicWebdav( + string $user, + string $path + ): void { $response = $this->downloadFromPublicLinkAsUser($path, $user); $this->featureContext->setResponse($response); } @@ -104,7 +107,9 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicDeletesFileFolderFromTheLastPublicLinkShareUsingThePublicWebdavApi(string $fileName):void { + public function thePublicDeletesFileFolderFromTheLastPublicLinkShareUsingThePublicWebdavApi( + string $fileName + ): void { $response = $this->deleteFileFromPublicShare( $fileName ); @@ -119,7 +124,9 @@ class PublicWebDavContext implements Context { * @return ResponseInterface */ public function deleteFileFromPublicShare(string $fileName, string $password = ""): ResponseInterface { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( WebDavHelper::DAV_VERSION_NEW, $token, @@ -151,7 +158,10 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicHasDeletedFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(string $file, string $password): void { + public function thePublicHasDeletedFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi( + string $file, + string $password + ): void { $response = $this->deleteFileFromPublicShare($file, $password); $this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response); } @@ -164,7 +174,10 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicDeletesFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi(string $file, string $password): void { + public function thePublicDeletesFileFromTheLastLinkShareWithPasswordUsingPublicWebdavApi( + string $file, + string $password + ): void { $this->featureContext->setResponse( $this->deleteFileFromPublicShare($file, $password) ); @@ -178,8 +191,14 @@ class PublicWebDavContext implements Context { * * @return ResponseInterface */ - public function renameFileFromPublicShare(string $fileName, string $toFileName, ?string $password = ""):ResponseInterface { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + public function renameFileFromPublicShare( + string $fileName, + string $toFileName, + ?string $password = "" + ): ResponseInterface { + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( WebDavHelper::DAV_VERSION_NEW, $token, @@ -215,7 +234,11 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswordAndOldPublicWebdavApi(string $fileName, string $toName, string $password):void { + public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswordAndOldPublicWebdavApi( + string $fileName, + string $toName, + string $password + ): void { $this->featureContext->setResponse( $this->renameFileFromPublicShare($fileName, $toName, $password) ); @@ -231,7 +254,10 @@ class PublicWebDavContext implements Context { * * @return void */ - public function publicDownloadsFileFromInsideLastPublicSharedFolderWithPassword(string $path, string $password = ""):void { + public function publicDownloadsFileFromInsideLastPublicSharedFolderWithPassword( + string $path, + string $password = "" + ): void { $response = $this->downloadFileFromPublicFolder( $path, $password, @@ -249,7 +275,9 @@ class PublicWebDavContext implements Context { */ public function downloadFromPublicLinkAsUser(string $path, string $user): ResponseInterface { $path = \ltrim($path, "/"); - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( $this->featureContext->getDavPathVersion(), @@ -281,7 +309,7 @@ class PublicWebDavContext implements Context { string $password, string $range, bool $shareNg = false - ):ResponseInterface { + ): ResponseInterface { $path = \ltrim($path, "/"); $password = $this->featureContext->getActualPassword($password); if ($shareNg) { @@ -320,7 +348,7 @@ class PublicWebDavContext implements Context { * * @return ResponseInterface */ - public function publicUploadFile(string $source):ResponseInterface { + public function publicUploadFile(string $source): ResponseInterface { return $this->publicUploadContent( \basename($source), '', @@ -344,7 +372,7 @@ class PublicWebDavContext implements Context { string $baseUrl, string $source, string $destination - ):ResponseInterface { + ): ResponseInterface { $fullSourceUrl = "$baseUrl/$source"; $fullDestUrl = WebDavHelper::sanitizeUrl( "$baseUrl/$destination" @@ -369,8 +397,10 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicCopiesFileUsingTheWebDAVApi(string $source, string $destination):void { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + public function thePublicCopiesFileUsingTheWebDAVApi(string $source, string $destination): void { + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( WebDavHelper::DAV_VERSION_NEW, $token, @@ -395,7 +425,7 @@ class PublicWebDavContext implements Context { * * @return ResponseInterface */ - public function publiclyUploadingContentAutoRename(string $filename, string $body = 'test'):ResponseInterface { + public function publiclyUploadingContentAutoRename(string $filename, string $body = 'test'): ResponseInterface { return $this->publicUploadContent($filename, '', $body, true); } @@ -407,7 +437,7 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicUploadsFileWithContentWithAutoRenameMode(string $filename, string $body = 'test'):void { + public function thePublicUploadsFileWithContentWithAutoRenameMode(string $filename, string $body = 'test'): void { $response = $this->publiclyUploadingContentAutoRename($filename, $body); $this->featureContext->setResponse($response); } @@ -420,7 +450,10 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicHasUploadedFileWithContentWithAutoRenameMode(string $filename, string $body = 'test'):void { + public function thePublicHasUploadedFileWithContentWithAutoRenameMode( + string $filename, + string $body = 'test' + ): void { $response = $this->publiclyUploadingContentAutoRename($filename, $body); $this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response); } @@ -436,7 +469,7 @@ class PublicWebDavContext implements Context { string $filename, string $password = '', string $body = 'test', - ):ResponseInterface { + ): ResponseInterface { return $this->publicUploadContent( $filename, $password, @@ -455,7 +488,11 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicHasUploadedFileWithContentAndPasswordToLastLinkShareUsingPublicWebdavApi(string $filename, string $content = 'test', string $password = ''): void { + public function thePublicHasUploadedFileWithContentAndPasswordToLastLinkShareUsingPublicWebdavApi( + string $filename, + string $content = 'test', + string $password = '' + ): void { $response = $this->publiclyUploadingContentWithPassword( $filename, $password, @@ -477,7 +514,7 @@ class PublicWebDavContext implements Context { string $filename, string $password, string $body, - ):void { + ): void { $response = $this->publiclyUploadingContentWithPassword( $filename, $password, @@ -494,7 +531,7 @@ class PublicWebDavContext implements Context { * * @return void */ - public function thePublicOverwritesFileWithContentUsingWebDavApi(string $filename, string $body):void { + public function thePublicOverwritesFileWithContentUsingWebDavApi(string $filename, string $body): void { $response = $this->publicUploadContent($filename, '', $body); $this->featureContext->setResponse($response); } @@ -510,7 +547,7 @@ class PublicWebDavContext implements Context { public function thePublicUploadsFileWithContentUsingThePublicWebDavApi( string $filename, string $body = 'test' - ):void { + ): void { $response = $this->publicUploadContent($filename, '', $body); $this->featureContext->setResponse($response); $this->featureContext->pushToLastStatusCodesArrays(); @@ -541,7 +578,7 @@ class PublicWebDavContext implements Context { public function checkLastPublicSharedFileWithPasswordDownload( string $password, string $expectedContent - ):void { + ): void { $response = $this->downloadPublicFileWithRange( "", $password @@ -568,7 +605,7 @@ class PublicWebDavContext implements Context { public function shouldNotBeAbleToDownloadFileInsidePublicSharedFolder( string $path, string $expectedHttpCode = "401" - ):void { + ): void { $response = $this->downloadFileFromPublicFolder( $path, "", @@ -589,7 +626,7 @@ class PublicWebDavContext implements Context { public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPassword( string $path, string $password - ):void { + ): void { $response = $this->downloadFileFromPublicFolder( $path, $password, @@ -613,7 +650,7 @@ class PublicWebDavContext implements Context { string $path, string $password, string $content - ):void { + ): void { $response = $this->downloadFileFromPublicFolder( $path, $password, @@ -638,7 +675,7 @@ class PublicWebDavContext implements Context { string $path, string $password, string $content - ):void { + ): void { $response = $this->downloadFileFromPublicFolder( $path, $password, @@ -664,7 +701,7 @@ class PublicWebDavContext implements Context { string $path, string $password, string $expectedHttpCode = "401" - ):void { + ): void { $response = $this->downloadFileFromPublicFolder( $path, $password, @@ -687,7 +724,7 @@ class PublicWebDavContext implements Context { string $path, string $password, string $expectedHttpCode = "401" - ):void { + ): void { $this->tryingToDownloadUsingWebDAVAPI( $path, "new", @@ -712,7 +749,7 @@ class PublicWebDavContext implements Context { string $range = "", string $expectedHttpCode = "401", bool $shareNg = false - ):void { + ): void { $response = $this->downloadFileFromPublicFolder( $path, $password, @@ -734,7 +771,7 @@ class PublicWebDavContext implements Context { public function publiclyUploadingShouldToSharedFileShouldFail( string $password, string $expectedHttpCode - ):void { + ): void { $filename = (string)$this->featureContext->getLastCreatedPublicShare()->file_target; $response = $this->publicUploadContent( @@ -756,7 +793,7 @@ class PublicWebDavContext implements Context { public function publiclyUploadingWithPasswordShouldNotWork( string $password, string $expectedHttpCode = null - ):void { + ): void { $response = $this->publicUploadContent( 'whateverfilefortesting.txt', $password @@ -779,7 +816,7 @@ class PublicWebDavContext implements Context { public function publiclyUploadingIntoFolderWithPasswordShouldWork( string $filename, string $password - ):void { + ): void { $response = $this->publicUploadContent( $filename, $password @@ -796,7 +833,7 @@ class PublicWebDavContext implements Context { * @return void * @throws Exception */ - public function publiclyUploadingShouldWork(string $password):void { + public function publiclyUploadingShouldWork(string $password): void { $path = "whateverfilefortesting-publicWebDAVAPI.txt"; $content = "test"; @@ -832,7 +869,7 @@ class PublicWebDavContext implements Context { public function publiclyUploadingToPublicLinkSharedFileShouldWork( string $password, string $shouldOrNot, - ):void { + ): void { $content = "test"; $should = ($shouldOrNot !== "not"); $path = (string) $this->featureContext->getLastCreatedPublicShare()->path; @@ -880,7 +917,7 @@ class PublicWebDavContext implements Context { public function thePublicUploadsFileToInsideLastLinkSharedFolderUsingThePublicWebdavApi( string $source, string $destination, - ):void { + ): void { $content = \file_get_contents( $this->featureContext->acceptanceTestsDirLocation() . $source ); @@ -906,7 +943,7 @@ class PublicWebDavContext implements Context { string $source, string $destination, string $password - ):void { + ): void { $content = \file_get_contents( $this->featureContext->acceptanceTestsDirLocation() . $source ); @@ -932,7 +969,7 @@ class PublicWebDavContext implements Context { string $fileName, string $password, string $mtime - ):void { + ): void { $mtime = new DateTime($mtime); $mtime = $mtime->format('U'); @@ -955,8 +992,10 @@ class PublicWebDavContext implements Context { public function publicCreatesFolderUsingPassword( string $destination, string $password - ):ResponseInterface { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + ): ResponseInterface { + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( $this->featureContext->getDavPathVersion(), $token, @@ -990,7 +1029,7 @@ class PublicWebDavContext implements Context { * * @return void */ - public function publicCreatesFolder(string $destination):void { + public function publicCreatesFolder(string $destination): void { $this->featureContext->setResponse($this->publicCreatesFolderUsingPassword($destination, '')); } @@ -1005,7 +1044,7 @@ class PublicWebDavContext implements Context { public function publicShouldBeAbleToCreateFolderWithPassword( string $foldername, string $password - ):void { + ): void { $response = $this->publicCreatesFolderUsingPassword($foldername, $password); $this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response); } @@ -1023,7 +1062,7 @@ class PublicWebDavContext implements Context { string $foldername, string $password, string $expectedHttpCode - ):void { + ): void { $response = $this->publicCreatesFolderUsingPassword($foldername, $password); $this->featureContext->theHTTPStatusCodeShouldBe( $expectedHttpCode, @@ -1045,8 +1084,10 @@ class PublicWebDavContext implements Context { public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldBe( string $fileName, string $mtime - ):void { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + ): void { + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $baseUrl = $this->featureContext->getBaseUrl(); $mtime = \explode(" ", $mtime); \array_pop($mtime); @@ -1074,7 +1115,7 @@ class PublicWebDavContext implements Context { public function theMtimeOfFileInTheLastSharedPublicLinkUsingTheWebdavApiShouldNotBe( string $fileName, string $mtime - ):void { + ): void { $token = $this->featureContext->getLastCreatedPublicShareToken(); $baseUrl = $this->featureContext->getBaseUrl(); Assert::assertNotEquals( @@ -1105,7 +1146,7 @@ class PublicWebDavContext implements Context { string $body = 'test', bool $autoRename = false, array $additionalHeaders = [], - ):?ResponseInterface { + ): ?ResponseInterface { $password = $this->featureContext->getActualPassword($password); if ($this->featureContext->isUsingSharingNG()) { $token = $this->featureContext->shareNgGetLastCreatedLinkShareToken(); @@ -1157,7 +1198,7 @@ class PublicWebDavContext implements Context { private function getUsernameForPublicWebdavApi( string $token, string $password - ):?string { + ): ?string { if ($password !== '') { $userName = 'public'; } else { @@ -1173,7 +1214,7 @@ class PublicWebDavContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context @@ -1189,7 +1230,7 @@ class PublicWebDavContext implements Context { * @return void * @throws GuzzleException */ - public function publicSendsRequestToLastPublicShare(string $method, ?string $password = ''):void { + public function publicSendsRequestToLastPublicShare(string $method, ?string $password = ''): void { if ($method === "PROPFIND") { $body = ' @@ -1205,7 +1246,9 @@ class PublicWebDavContext implements Context { } else { $body = null; } - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( WebDavHelper::DAV_VERSION_NEW, $token, diff --git a/tests/acceptance/bootstrap/SearchContext.php b/tests/acceptance/bootstrap/SearchContext.php index f5d1c864d46..d09e4af16a9 100644 --- a/tests/acceptance/bootstrap/SearchContext.php +++ b/tests/acceptance/bootstrap/SearchContext.php @@ -84,7 +84,11 @@ class SearchContext implements Context { $spaceId = $this->featureContext->spacesContext->getSpaceIdByName($user, $scope); $pattern .= " scope:$spaceId"; } else { - $resourceID = $this->featureContext->spacesContext->getResourceId($user, $spaceName ?? "Personal", $scope); + $resourceID = $this->featureContext->spacesContext->getResourceId( + $user, + $spaceName ?? "Personal", + $scope + ); $pattern .= " scope:$resourceID"; } } diff --git a/tests/acceptance/bootstrap/SettingsContext.php b/tests/acceptance/bootstrap/SettingsContext.php index 5f40f16e0b4..ab5838526aa 100644 --- a/tests/acceptance/bootstrap/SettingsContext.php +++ b/tests/acceptance/bootstrap/SettingsContext.php @@ -263,7 +263,11 @@ class SettingsContext implements Context { $assignmentResponse = $this->featureContext->getJsonDecodedResponseBodyContent($response); if (isset($assignmentResponse->assignments[0]->roleId)) { $actualRoleId = $assignmentResponse->assignments[0]->roleId; - Assert::assertEquals($this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role), $actualRoleId, "user $user has no role $role"); + Assert::assertEquals( + $this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role), + $actualRoleId, + "user $user has no role $role" + ); } else { Assert::fail("Response should contain user role but not found.\n" . json_encode($assignmentResponse)); } @@ -279,8 +283,14 @@ class SettingsContext implements Context { * @throws Exception */ public function theSettingApiResponseShouldHaveTheRole(string $role): void { - $assignmentRoleId = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())["assignments"][0]["roleId"]; - Assert::assertEquals($this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role), $assignmentRoleId, "user has no role $role"); + $assignmentRoleId = $this->featureContext->getJsonDecodedResponse( + $this->featureContext->getResponse() + )["assignments"][0]["roleId"]; + Assert::assertEquals( + $this->getRoleIdByRoleName($this->featureContext->getAdminUserName(), $role), + $assignmentRoleId, + "user has no role $role" + ); } /** diff --git a/tests/acceptance/bootstrap/ShareesContext.php b/tests/acceptance/bootstrap/ShareesContext.php index 1a20483772a..b5fac502fa7 100644 --- a/tests/acceptance/bootstrap/ShareesContext.php +++ b/tests/acceptance/bootstrap/ShareesContext.php @@ -46,7 +46,7 @@ class ShareesContext implements Context { * * @return void */ - public function theUserGetsTheShareesWithParameters(TableNode $body):void { + public function theUserGetsTheShareesWithParameters(TableNode $body): void { $this->featureContext->setResponse( $this->getShareesWithParameters( $this->featureContext->getCurrentUser(), @@ -63,7 +63,7 @@ class ShareesContext implements Context { * * @return void */ - public function userGetsTheShareesWithParameters(string $user, TableNode $body):void { + public function userGetsTheShareesWithParameters(string $user, TableNode $body): void { $this->featureContext->setResponse( $this->getShareesWithParameters( $user, @@ -81,7 +81,7 @@ class ShareesContext implements Context { * @return void * @throws Exception */ - public function theShareesReturnedShouldBe(string $shareeType, TableNode $shareesList):void { + public function theShareesReturnedShouldBe(string $shareeType, TableNode $shareesList): void { $this->featureContext->verifyTableNodeColumnsCount($shareesList, 4); $sharees = $shareesList->getRows(); $respondedArray = $this->getArrayOfShareesResponded( @@ -104,7 +104,7 @@ class ShareesContext implements Context { * @return void * @throws Exception */ - public function theShareesReturnedShouldInclude(string $shareeType, TableNode $shareesList):void { + public function theShareesReturnedShouldInclude(string $shareeType, TableNode $shareesList): void { $this->featureContext->verifyTableNodeColumnsCount($shareesList, 3); $sharees = $shareesList->getRows(); $respondedArray = $this->getArrayOfShareesResponded( @@ -127,7 +127,7 @@ class ShareesContext implements Context { * * @return void */ - public function theShareesReturnedShouldBeEmpty(string $shareeType):void { + public function theShareesReturnedShouldBeEmpty(string $shareeType): void { $respondedArray = $this->getArrayOfShareesResponded( $this->featureContext->getResponse(), $shareeType @@ -155,7 +155,7 @@ class ShareesContext implements Context { public function getArrayOfShareesResponded( ResponseInterface $response, string $shareeType - ):array { + ): array { $elements = HttpRequestHelper::getResponseXml($response, __METHOD__)->data; $elements = \json_decode(\json_encode($elements), true); if (\strpos($shareeType, 'exact ') === 0) { @@ -229,7 +229,7 @@ class ShareesContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context diff --git a/tests/acceptance/bootstrap/Sharing.php b/tests/acceptance/bootstrap/Sharing.php index 6d3091b5ea5..b2250d3d522 100755 --- a/tests/acceptance/bootstrap/Sharing.php +++ b/tests/acceptance/bootstrap/Sharing.php @@ -90,14 +90,14 @@ trait Sharing { /** * @return string */ - public function getLastCreatedPublicShareToken():string { + public function getLastCreatedPublicShareToken(): string { return (string) $this->getLastCreatedPublicShare()->token; } /** * @return SimpleXMLElement|null */ - public function getLastCreatedPublicShare():?SimpleXMLElement { + public function getLastCreatedPublicShare(): ?SimpleXMLElement { return \end($this->createdPublicShares); } @@ -122,7 +122,7 @@ trait Sharing { /** * @return ResponseInterface|null */ - public function shareNgGetLastCreatedLinkShare():?ResponseInterface { + public function shareNgGetLastCreatedLinkShare(): ?ResponseInterface { return \end($this->shareNgCreatedLinkShares); } @@ -138,7 +138,7 @@ trait Sharing { /** * @return ResponseInterface|null */ - public function shareNgGetLastCreatedUserGroupShare():?ResponseInterface { + public function shareNgGetLastCreatedUserGroupShare(): ?ResponseInterface { return \end($this->shareNgCreatedUserGroupShares); } @@ -169,7 +169,7 @@ trait Sharing { /** * @return void */ - public function emptyCreatedPublicShares():void { + public function emptyCreatedPublicShares(): void { $this->createdPublicShares = []; } @@ -183,7 +183,7 @@ trait Sharing { /** * @return float|null */ - public function getLocalLastShareTime():?float { + public function getLocalLastShareTime(): ?float { return $this->localLastShareTime; } @@ -192,7 +192,7 @@ trait Sharing { * * @return string */ - public function getSharesEndpointPath(?string $postfix = ''):string { + public function getSharesEndpointPath(?string $postfix = ''): string { return "/apps/files_sharing/api/v$this->sharingApiVersion/shares$postfix"; } @@ -213,7 +213,11 @@ trait Sharing { public function shareNgGetLastCreatedLinkShareToken(): string { $lastResponse = $this->shareNgGetLastCreatedLinkShare(); if (!isset($this->getJsonDecodedResponse($lastResponse)['link']['webUrl'])) { - throw new Error('Response did not contain share id ' . $this->getJsonDecodedResponse($lastResponse)['link']['webUrl'] . ' for the created public link'); + throw new Error( + 'Response did not contain share id ' + . $this->getJsonDecodedResponse($lastResponse)['link']['webUrl'] + . ' for the created public link' + ); } $last_created_link_webURL = $this->getJsonDecodedResponse($lastResponse)['link']['webUrl']; return substr(strrchr($last_created_link_webURL, "/"), 1); @@ -237,7 +241,7 @@ trait Sharing { * * @return string[] */ - private function splitPermissionsString(string $str):array { + private function splitPermissionsString(string $str): array { $str = \trim($str); $permissions = \array_map('trim', \explode(',', $str)); @@ -270,7 +274,7 @@ trait Sharing { * * @throws Exception */ - public function getServerShareTimeFromLastResponse():int { + public function getServerShareTimeFromLastResponse(): int { $stime = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->xpath("//stime"); if ($stime) { return (int) $stime[0]; @@ -281,7 +285,7 @@ trait Sharing { /** * @return void */ - private function waitToCreateShare():void { + private function waitToCreateShare(): void { if (($this->localLastShareTime !== null) && ((\microtime(true) - $this->localLastShareTime) < 1) ) { @@ -341,8 +345,14 @@ trait Sharing { $bodyRows['name'] = \array_key_exists('name', $bodyRows) ? $bodyRows['name'] : null; $bodyRows['shareWith'] = \array_key_exists('shareWith', $bodyRows) ? $bodyRows['shareWith'] : null; $bodyRows['shareWith'] = $this->getActualUsername($bodyRows['shareWith']); - $bodyRows['publicUpload'] = \array_key_exists('publicUpload', $bodyRows) ? $bodyRows['publicUpload'] === 'true' : null; - $bodyRows['password'] = \array_key_exists('password', $bodyRows) ? $this->getActualPassword($bodyRows['password']) : null; + $bodyRows['publicUpload'] = \array_key_exists( + 'publicUpload', + $bodyRows + ) ? $bodyRows['publicUpload'] === 'true' : null; + $bodyRows['password'] = \array_key_exists( + 'password', + $bodyRows + ) ? $this->getActualPassword($bodyRows['password']) : null; if (\array_key_exists('permissions', $bodyRows)) { if (\is_numeric($bodyRows['permissions'])) { @@ -390,7 +400,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userCreatesAShareWithSettings(string $user, ?TableNode $body):void { + public function userCreatesAShareWithSettings(string $user, ?TableNode $body): void { $user = $this->getActualUsername($user); $response = $this->createShareWithSettings( $user, @@ -441,7 +451,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userCreatesAPublicLinkShareWithSettings(string $user, TableNode $body):void { + public function userCreatesAPublicLinkShareWithSettings(string $user, TableNode $body): void { $this->setResponse($this->createPublicLinkShare($user, $body)); $this->pushToLastStatusCodesArrays(); } @@ -455,7 +465,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userHasCreatedAPublicLinkShareWithSettings(string $user, TableNode $body):void { + public function userHasCreatedAPublicLinkShareWithSettings(string $user, TableNode $body): void { $response = $this->createPublicLinkShare($user, $body); $this->theHTTPStatusCodeShouldBe(200, "", $response); $this->ocsContext->theOCSStatusCodeShouldBe("100,200", "", $response); @@ -470,7 +480,7 @@ trait Sharing { * @return void * @throws Exception */ - public function theUserCreatesAPublicLinkShareWithSettings(TableNode $body):void { + public function theUserCreatesAPublicLinkShareWithSettings(TableNode $body): void { $this->setResponse($this->createPublicLinkShare($this->currentUser, $body)); $this->pushToLastStatusCodesArrays(); } @@ -483,7 +493,7 @@ trait Sharing { * @return void * @throws Exception */ - public function theUserHasCreatedAPublicLinkShareWithSettings(TableNode $body):void { + public function theUserHasCreatedAPublicLinkShareWithSettings(TableNode $body): void { $response = $this->createPublicLinkShare($this->currentUser, $body); $this->theHTTPStatusCodeShouldBe(200, "", $response); $this->ocsContext->theOCSStatusCodeShouldBe("100,200", "", $response); @@ -530,7 +540,7 @@ trait Sharing { * * @return void */ - public function userCreatesAPublicLinkShareOf(string $user, string $path):void { + public function userCreatesAPublicLinkShareOf(string $user, string $path): void { $response = $this->createAPublicShare($user, $path); $this->setResponse($response); } @@ -543,7 +553,7 @@ trait Sharing { * * @return void */ - public function userHasCreatedAPublicLinkShareOf(string $user, string $path):void { + public function userHasCreatedAPublicLinkShareOf(string $user, string $path): void { $response = $this->createAPublicShare($user, $path); $this->theHTTPStatusCodeShouldBe(200, "", $response); $this->ocsContext->theOCSStatusCodeShouldBe("100,200", "", $response); @@ -562,7 +572,7 @@ trait Sharing { string $user, string $path, $permissions - ):void { + ): void { $response = $this->createAPublicShare($user, $path, true, null, $permissions); $this->setResponse($response); } @@ -580,7 +590,7 @@ trait Sharing { string $user, string $path, $permissions - ):void { + ): void { $response = $this->createAPublicShare($user, $path, true, null, $permissions); $this->theHTTPStatusCodeShouldBe(200, "", $response); $this->ocsContext->theOCSStatusCodeShouldBe("100,200", "", $response); @@ -597,7 +607,7 @@ trait Sharing { string $user, string $path, string $expiryDate - ):void { + ): void { $this->createAPublicShare( $user, $path, @@ -622,7 +632,7 @@ trait Sharing { string $user, string $path, string $expiryDate - ):void { + ): void { $this->createPublicLinkShareOfResourceWithExpiry( $user, $path, @@ -643,7 +653,7 @@ trait Sharing { string $user, string $path, string $expiryDate - ):void { + ): void { $this->createPublicLinkShareOfResourceWithExpiry( $user, $path, @@ -661,7 +671,7 @@ trait Sharing { * @return void * @throws Exception */ - public function shouldNotBeAbleToCreatePublicLinkShare(string $sharer, string $filepath):void { + public function shouldNotBeAbleToCreatePublicLinkShare(string $sharer, string $filepath): void { $this->createAPublicShare($sharer, $filepath); Assert::assertEquals( 404, @@ -679,7 +689,7 @@ trait Sharing { * @return ResponseInterface * @throws Exception */ - public function updateLastShareByCurrentUser(?TableNode $body):ResponseInterface { + public function updateLastShareByCurrentUser(?TableNode $body): ResponseInterface { return $this->updateLastShareWithSettings($this->currentUser, $body); } @@ -691,7 +701,7 @@ trait Sharing { * @return void * @throws Exception */ - public function theUserUpdatesTheLastShareWith(?TableNode $body):void { + public function theUserUpdatesTheLastShareWith(?TableNode $body): void { $this->setResponse($this->updateLastShareByCurrentUser($body)); } @@ -703,7 +713,7 @@ trait Sharing { * @return void * @throws Exception */ - public function theUserHasUpdatedTheLastShareWith(?TableNode $body):void { + public function theUserHasUpdatedTheLastShareWith(?TableNode $body): void { $response = $this->updateLastShareByCurrentUser($body); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); } @@ -718,7 +728,8 @@ trait Sharing { */ public function getLastCreatedUserGroupShareId(?string $user = null): string { if ($user === null) { - $shareId = $this->isUsingSharingNG() ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShare()->id; + $shareId = $this->isUsingSharingNG() + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShare()->id; return (string) $shareId; } $createdShares = $this->getCreatedUserGroupShares(); @@ -742,14 +753,16 @@ trait Sharing { ?TableNode $body, ?string $shareOwner = null, ?bool $updateLastPublicLink = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); if ($updateLastPublicLink) { - $share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareID() : (string) $this->getLastCreatedPublicShare()->id; + $share_id = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareID() : (string) $this->getLastCreatedPublicShare()->id; } else { if ($shareOwner === null) { - $share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + $share_id = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); } else { $share_id = $this->getLastCreatedUserGroupShareId($shareOwner); } @@ -794,7 +807,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userUpdatesTheLastShareWith(string $user, ?TableNode $body):void { + public function userUpdatesTheLastShareWith(string $user, ?TableNode $body): void { $this->setResponse($this->updateLastShareWithSettings($user, $body)); $this->pushToLastStatusCodesArrays(); } @@ -808,7 +821,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userUpdatesTheLastPublicLinkShareWith(string $user, ?TableNode $body):void { + public function userUpdatesTheLastPublicLinkShareWith(string $user, ?TableNode $body): void { $this->response = $this->updateLastShareWithSettings($user, $body, null, true); $this->pushToLastStatusCodesArrays(); } @@ -822,7 +835,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userHasUpdatedTheLastShareWith(string $user, ?TableNode $body):void { + public function userHasUpdatedTheLastShareWith(string $user, ?TableNode $body): void { $response = $this->updateLastShareWithSettings($user, $body); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); } @@ -836,7 +849,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userHasUpdatedTheLastPublicLinkShareWith(string $user, ?TableNode $body):void { + public function userHasUpdatedTheLastPublicLinkShareWith(string $user, ?TableNode $body): void { $response = $this->updateLastShareWithSettings($user, $body, null, true); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); } @@ -851,7 +864,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userHasUpdatedTheLastShareOfWith(string $user, string $shareOwner, ?TableNode $body):void { + public function userHasUpdatedTheLastShareOfWith(string $user, string $shareOwner, ?TableNode $body): void { $response = $this->updateLastShareWithSettings($user, $body, $shareOwner); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); if ($this->ocsApiVersion == 1) { @@ -951,7 +964,7 @@ trait Sharing { string $value, string $contentExpected, bool $expectSuccess = true - ):bool { + ): bool { if (($contentExpected === "ANY_VALUE") || (($contentExpected === "A_TOKEN") && (\strlen($value) === 15)) || (($contentExpected === "A_NUMBER") && \is_numeric($value)) @@ -979,7 +992,12 @@ trait Sharing { * @return bool * @throws Exception */ - public function isFieldInResponse(string $field, ?string $contentExpected, bool $expectSuccess = true, ?SimpleXMLElement $data = null):bool { + public function isFieldInResponse( + string $field, + ?string $contentExpected, + bool $expectSuccess = true, + ?SimpleXMLElement $data = null + ): bool { if ($data === null) { $data = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]; } @@ -1052,7 +1070,7 @@ trait Sharing { * * @return void */ - public function checkNoFilesFoldersInResponse():void { + public function checkNoFilesFoldersInResponse(): void { $data = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]; Assert::assertIsObject($data, __METHOD__ . " data not found in response XML"); Assert::assertCount(0, $data); @@ -1065,7 +1083,7 @@ trait Sharing { * * @return void */ - public function checkCountFilesFoldersInResponse(string $count):void { + public function checkCountFilesFoldersInResponse(string $count): void { $count = (int) $count; $data = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]; Assert::assertIsObject($data, __METHOD__ . " data not found in response XML"); @@ -1080,7 +1098,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkSharedFileInResponse(string $filename):void { + public function checkSharedFileInResponse(string $filename): void { $filename = "/" . \ltrim($filename, '/'); Assert::assertTrue( $this->isFieldInResponse('file_target', "$filename"), @@ -1096,7 +1114,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkSharedFileNotInResponse(string $filename):void { + public function checkSharedFileNotInResponse(string $filename): void { $filename = "/" . \ltrim($filename, '/'); Assert::assertFalse( $this->isFieldInResponse('file_target', "$filename", false), @@ -1112,7 +1130,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkSharedFileAsPathInResponse(string $filename):void { + public function checkSharedFileAsPathInResponse(string $filename): void { $filename = "/" . \ltrim($filename, '/'); Assert::assertTrue( $this->isFieldInResponse('path', "$filename"), @@ -1128,7 +1146,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkSharedFileAsPathNotInResponse(string $filename):void { + public function checkSharedFileAsPathNotInResponse(string $filename): void { $filename = "/" . \ltrim($filename, '/'); Assert::assertFalse( $this->isFieldInResponse('path', "$filename", false), @@ -1145,7 +1163,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkSharedUserOrGroupInResponse(string $type, string $user):void { + public function checkSharedUserOrGroupInResponse(string $type, string $user): void { if ($type === 'user') { $user = $this->getActualUsername($user); } @@ -1164,7 +1182,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkSharedUserOrGroupNotInResponse(string $userOrGroup):void { + public function checkSharedUserOrGroupNotInResponse(string $userOrGroup): void { Assert::assertFalse( $this->isFieldInResponse('share_with', "$userOrGroup", false), "'share_with' value '$userOrGroup' was unexpectedly found in response" @@ -1213,7 +1231,7 @@ trait Sharing { string $filepath, string $sharee, $permissions = null - ):void { + ): void { $response = $this->createAUserShare( $sharer, $filepath, @@ -1241,7 +1259,7 @@ trait Sharing { string $sharee, TableNode $table, $permissions = null - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -1274,7 +1292,7 @@ trait Sharing { string $filepath, string $sharee, $permissions = null - ):void { + ): void { $response = $this->createAUserShare( $sharer, $filepath, @@ -1299,7 +1317,7 @@ trait Sharing { string $sharer, string $filepath, $permissions = null - ):void { + ): void { $admin = $this->getAdminUsername(); $response = $this->createAUserShare( $sharer, @@ -1350,7 +1368,7 @@ trait Sharing { string $filepath, string $user2, $permissions = null - ):void { + ): void { $user2 = $this->getActualUsername($user2); $response = $this->createAUserShare( $this->getCurrentUser(), @@ -1376,7 +1394,7 @@ trait Sharing { string $filepath, string $group, $permissions = null - ):void { + ): void { $response = $this->createAGroupShare( $this->currentUser, $filepath, @@ -1401,7 +1419,7 @@ trait Sharing { string $filepath, string $group, $permissions = null - ):void { + ): void { $response = $this->createAGroupShare( $this->currentUser, $filepath, @@ -1534,7 +1552,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userTriesToUpdateTheLastShareUsingTheSharingApiWith(string $user, ?TableNode $body):void { + public function userTriesToUpdateTheLastShareUsingTheSharingApiWith(string $user, ?TableNode $body): void { $this->response = $this->updateLastShareWithSettings($user, $body); } @@ -1547,7 +1565,10 @@ trait Sharing { * @return void * @throws Exception */ - public function userTriesToUpdateTheLastPublicLinkShareUsingTheSharingApiWith(string $user, ?TableNode $body):void { + public function userTriesToUpdateTheLastPublicLinkShareUsingTheSharingApiWith( + string $user, + ?TableNode $body + ): void { $this->response = $this->updateLastShareWithSettings($user, $body, null, true); } @@ -1570,7 +1591,7 @@ trait Sharing { string $userOrGroupShareType, string $sharee, $permissions = null - ):void { + ): void { $sharee = $this->getActualUsername($sharee); $response = $this->createShare( $sharer, @@ -1607,7 +1628,7 @@ trait Sharing { string $userOrGroupShareType, string $sharee, $permissions = null - ):void { + ): void { $sharee = $this->getActualUsername($sharee); $response = $this->createShare( $sharer, @@ -1631,7 +1652,7 @@ trait Sharing { * * @return void */ - public function theUserDeletesLastShareUsingTheSharingAPI():void { + public function theUserDeletesLastShareUsingTheSharingAPI(): void { $this->setResponse($this->deleteLastShareUsingSharingApiByCurrentUser()); } @@ -1640,7 +1661,7 @@ trait Sharing { * * @return void */ - public function theUserHasDeletedLastShareUsingTheSharingAPI():void { + public function theUserHasDeletedLastShareUsingTheSharingAPI(): void { $response = $this->deleteLastShareUsingSharingApiByCurrentUser(); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); } @@ -1652,15 +1673,21 @@ trait Sharing { * * @return ResponseInterface */ - public function deleteLastShareUsingSharingApi(string $user, string $sharer = null, bool $deleteLastPublicLink = false):ResponseInterface { + public function deleteLastShareUsingSharingApi( + string $user, + string $sharer = null, + bool $deleteLastPublicLink = false + ): ResponseInterface { $user = $this->getActualUsername($user); if ($deleteLastPublicLink) { $shareId = (string) $this->getLastCreatedPublicShare()->id; } else { if ($sharer === null) { - $shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + $shareId = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); } else { - $shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId($sharer); + $shareId = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId($sharer); } } $url = $this->getSharesEndpointPath("/$shareId"); @@ -1674,7 +1701,7 @@ trait Sharing { /** * @return ResponseInterface */ - public function deleteLastShareUsingSharingApiByCurrentUser():ResponseInterface { + public function deleteLastShareUsingSharingApiByCurrentUser(): ResponseInterface { return $this->deleteLastShareUsingSharingApi($this->currentUser); } @@ -1686,7 +1713,7 @@ trait Sharing { * * @return void */ - public function userDeletesLastShareUsingTheSharingApi(string $user):void { + public function userDeletesLastShareUsingTheSharingApi(string $user): void { $this->setResponse($this->deleteLastShareUsingSharingApi($user)); $this->pushToLastStatusCodesArrays(); } @@ -1699,7 +1726,7 @@ trait Sharing { * * @return void */ - public function userDeletesLastPublicLinkShareUsingTheSharingApi(string $user):void { + public function userDeletesLastPublicLinkShareUsingTheSharingApi(string $user): void { $this->setResponse($this->deleteLastShareUsingSharingApi($user, null, true)); $this->pushToLastStatusCodesArrays(); } @@ -1713,7 +1740,7 @@ trait Sharing { * * @return void */ - public function userDeletesLastShareOfUserUsingTheSharingApi(string $user, string $sharer):void { + public function userDeletesLastShareOfUserUsingTheSharingApi(string $user, string $sharer): void { $this->setResponse($this->deleteLastShareUsingSharingApi($user, $sharer)); $this->pushToLastStatusCodesArrays(); } @@ -1725,7 +1752,7 @@ trait Sharing { * * @return void */ - public function userHasDeletedLastShareUsingTheSharingApi(string $user):void { + public function userHasDeletedLastShareUsingTheSharingApi(string $user): void { $response = $this->deleteLastShareUsingSharingApi($user); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); } @@ -1739,9 +1766,11 @@ trait Sharing { */ public function getLastShareInfo(string $user, string $shareType, ?string $language = null): ResponseInterface { if ($shareType !== "link") { - $shareId = $this->isUsingSharingNg() ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + $shareId = $this->isUsingSharingNg() + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); } else { - $shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareID() : (string) $this->getLastCreatedPublicShare()->id; + $shareId = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareID() : (string) $this->getLastCreatedPublicShare()->id; } if ($shareId === null) { throw new Exception( @@ -1761,7 +1790,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userGetsInfoOfLastShareUsingTheSharingApi(string $user):void { + public function userGetsInfoOfLastShareUsingTheSharingApi(string $user): void { $response = $this->getLastShareInfo($user, "user"); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -1776,7 +1805,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userGetsInfoOfLastPublicLinkShareUsingTheSharingApi(string $user):void { + public function userGetsInfoOfLastPublicLinkShareUsingTheSharingApi(string $user): void { $response = $this->getLastShareInfo($user, "link"); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -1814,7 +1843,7 @@ trait Sharing { * * @return ResponseInterface */ - public function getShareData(string $user, string $share_id, ?string $language = null):ResponseInterface { + public function getShareData(string $user, string $share_id, ?string $language = null): ResponseInterface { $user = $this->getActualUsername($user); $url = $this->getSharesEndpointPath("/$share_id"); $headers = []; @@ -1836,7 +1865,7 @@ trait Sharing { * * @return ResponseInterface */ - public function getSharedWithMeShares(string $user):ResponseInterface { + public function getSharedWithMeShares(string $user): ResponseInterface { $user = $this->getActualUsername($user); $url = "/apps/files_sharing/api/v1/shares?shared_with_me=true"; return $this->ocsContext->sendRequestToOcsEndpoint( @@ -1853,7 +1882,7 @@ trait Sharing { * * @return void */ - public function userGetsAllTheSharesSharedWithHimUsingTheSharingApi(string $user):void { + public function userGetsAllTheSharesSharedWithHimUsingTheSharingApi(string $user): void { $this->setResponse($this->getSharedWithMeShares($user)); } @@ -1866,10 +1895,11 @@ trait Sharing { * @return void * @throws Exception */ - public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table):void { + public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table): void { $user = $this->getActualUsername($user); $this->verifyTableNodeRows($table, [], $this->shareResponseFields); - $share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + $share_id = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); $response = $this->getShareData($user, $share_id); $this->theHTTPStatusCodeShouldBe( @@ -1898,7 +1928,11 @@ trait Sharing { * * @return void */ - public function userGetsFilteredSharesSharedWithHimUsingTheSharingApi(string $user, string $pending, string $shareType):void { + public function userGetsFilteredSharesSharedWithHimUsingTheSharingApi( + string $user, + string $pending, + string $shareType + ): void { $user = $this->getActualUsername($user); if ($pending === "pending") { $pendingClause = "&state=" . SharingHelper::SHARE_STATES['pending']; @@ -1931,7 +1965,10 @@ trait Sharing { * * @return void */ - public function userGetsAllSharesSharedWithHimFromFileOrFolderUsingTheProvisioningApi(string $user, string $path):void { + public function userGetsAllSharesSharedWithHimFromFileOrFolderUsingTheProvisioningApi( + string $user, + string $path + ): void { $user = $this->getActualUsername($user); $url = "/apps/files_sharing/api/" . "v$this->sharingApiVersion/shares?shared_with_me=true&path=$path"; @@ -1975,7 +2012,7 @@ trait Sharing { * * @return void */ - public function userGetsAllSharesSharedByHimUsingTheSharingApi(string $user):void { + public function userGetsAllSharesSharedByHimUsingTheSharingApi(string $user): void { $this->setResponse($this->getAllshares($user)); } @@ -1984,7 +2021,7 @@ trait Sharing { * * @return void */ - public function theAdministratorGetsAllSharesSharedByHimUsingTheSharingApi():void { + public function theAdministratorGetsAllSharesSharedByHimUsingTheSharingApi(): void { $this->setResponse($this->getAllShares($this->getAdminUsername())); } @@ -1996,7 +2033,7 @@ trait Sharing { * * @return void */ - public function userGetsFilteredSharesSharedByHimUsingTheSharingApi(string $user, string $shareType):void { + public function userGetsFilteredSharesSharedByHimUsingTheSharingApi(string $user, string $shareType): void { if ($shareType === 'public link') { $shareType = 'public_link'; } @@ -2016,7 +2053,7 @@ trait Sharing { * * @return void */ - public function userGetsAllTheSharesFromTheFileUsingTheSharingApi(string $user, string $path):void { + public function userGetsAllTheSharesFromTheFileUsingTheSharingApi(string $user, string $path): void { $this->setResponse($this->getAllShares($user, "?path=$path")); } @@ -2031,7 +2068,7 @@ trait Sharing { public function userGetsAllTheSharesWithResharesFromTheFileUsingTheSharingApi( string $user, string $path - ):void { + ): void { $this->setResponse($this->getAllShares($user, "?reshares=true&path=$path")); } @@ -2043,7 +2080,7 @@ trait Sharing { * * @return void */ - public function userGetsAllTheSharesInsideTheFolderUsingTheSharingApi(string $user, string $path):void { + public function userGetsAllTheSharesInsideTheFolderUsingTheSharingApi(string $user, string $path): void { $this->setResponse($this->getAllShares($user, "?path=$path&subfiles=true")); } @@ -2059,7 +2096,7 @@ trait Sharing { public function theResponseWhenUserGetsInfoOfLastPublicLinkShareShouldInclude( string $user, ?TableNode $body - ):void { + ): void { $user = $this->getActualUsername($user); $this->verifyTableNodeRows($body, [], $this->shareResponseFields); $this->getShareData($user, (string) $this->getLastCreatedPublicShare()->id); @@ -2089,7 +2126,7 @@ trait Sharing { public function informationOfLastShareShouldInclude( string $user, TableNode $body - ):void { + ): void { $user = $this->getActualUsername($user); $shareId = $this->getLastCreatedUserGroupShareId($user); $this->getShareData($user, $shareId); @@ -2119,7 +2156,7 @@ trait Sharing { string $fileName, string $type, TableNode $body - ):void { + ): void { $user = $this->getActualUsername($user); $this->verifyTableNodeColumnsCount($body, 2); $fileName = $fileName[0] === "/" ? $fileName : '/' . $fileName; @@ -2166,8 +2203,9 @@ trait Sharing { * @return void * @throws Exception */ - public function checkingLastShareIDIsIncluded():void { - $shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + public function checkingLastShareIDIsIncluded(): void { + $shareId = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); if (!$this->isFieldInResponse('id', $shareId)) { Assert::fail( "Share id $shareId not found in response" @@ -2181,8 +2219,9 @@ trait Sharing { * @return void * @throws Exception */ - public function checkLastShareIDIsNotIncluded():void { - $shareId = $this->isUsingSharingNG() ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + public function checkLastShareIDIsNotIncluded(): void { + $shareId = $this->isUsingSharingNG() + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); if ($this->isFieldInResponse('id', $shareId, false)) { Assert::fail( "Share id $shareId has been found in response" @@ -2196,7 +2235,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkLastPublicLinkShareIDIsNotIncluded():void { + public function checkLastPublicLinkShareIDIsNotIncluded(): void { $shareId = (string) $this->getLastCreatedPublicShare()->id; if ($this->isFieldInResponse('id', $shareId, false)) { Assert::fail( @@ -2211,7 +2250,7 @@ trait Sharing { * * @return void */ - public function responseShouldNotContainAnyShareIds(ResponseInterface $response):void { + public function responseShouldNotContainAnyShareIds(ResponseInterface $response): void { $data = HttpRequestHelper::getResponseXml($response, __METHOD__)->data[0]; $fieldIsSet = false; $receivedShareCount = 0; @@ -2243,10 +2282,11 @@ trait Sharing { * @return void * @throws Exception */ - public function userShouldNotSeeShareIdOfLastShare(string $user):void { + public function userShouldNotSeeShareIdOfLastShare(string $user): void { $response = $this->getSharedWithMeShares($user); $this->theHTTPStatusCodeShouldBe(200, "", $response); - $shareId = $this->isUsingSharingNG() ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); + $shareId = $this->isUsingSharingNG() + ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); if ($this->isFieldInResponse('id', $shareId, false)) { Assert::fail( "Share id $shareId has been found in response" @@ -2261,7 +2301,7 @@ trait Sharing { * * @return void */ - public function userShouldNotHaveAnyReceivedShares(string $user):void { + public function userShouldNotHaveAnyReceivedShares(string $user): void { $response = $this->getSharedWithMeShares($user); $this->theHTTPStatusCodeShouldBe(200, "", $response); $this->responseShouldNotContainAnyShareIds($response); @@ -2274,7 +2314,7 @@ trait Sharing { * * @return void */ - public function checkingTheResponseEntriesCount(int $count):void { + public function checkingTheResponseEntriesCount(int $count): void { $actualCount = \count(HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]); Assert::assertEquals( $count, @@ -2292,7 +2332,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkFields(string $user, ?TableNode $body):void { + public function checkFields(string $user, ?TableNode $body): void { $this->checkTheFields($user, $body); } @@ -2303,7 +2343,7 @@ trait Sharing { * * @return void */ - public function checkTheFields(string $user, ?TableNode $body, ?ResponseInterface $response = null):void { + public function checkTheFields(string $user, ?TableNode $body, ?ResponseInterface $response = null): void { $response = $response ?? $this->getResponse(); $data = HttpRequestHelper::getResponseXml($response, __METHOD__)->data[0]; $this->verifyTableNodeColumnsCount($body, 2); @@ -2342,7 +2382,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkFieldsOfSpaceSharingResponse(string $user, string $space, ?TableNode $body):void { + public function checkFieldsOfSpaceSharingResponse(string $user, string $space, ?TableNode $body): void { $this->verifyTableNodeColumnsCount($body, 2); $bodyRows = $body->getRowsHash(); @@ -2406,7 +2446,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkFieldsOfLastResponseToUser(string $sharer, string $sharee, ?TableNode $body):void { + public function checkFieldsOfLastResponseToUser(string $sharer, string $sharee, ?TableNode $body): void { $this->checkTheFieldsOfLastResponseToUser($sharer, $sharee, $body); } @@ -2417,13 +2457,29 @@ trait Sharing { * * @return void */ - public function checkTheFieldsOfLastResponseToUser(string $sharer, string $sharee, ?TableNode $body):void { + public function checkTheFieldsOfLastResponseToUser(string $sharer, string $sharee, ?TableNode $body): void { $this->verifyTableNodeColumnsCount($body, 2); $bodyRows = $body->getRowsHash(); foreach ($bodyRows as $field => $value) { - if (\in_array($field, ["displayname_owner", "displayname_file_owner", "owner", "uid_owner", "uid_file_owner", "additional_info_owner", "additional_info_file_owner"])) { + if (\in_array( + $field, + [ + "displayname_owner", + "displayname_file_owner", + "owner", + "uid_owner", + "uid_file_owner", + "additional_info_owner", + "additional_info_file_owner" + ] + ) + ) { $value = $this->substituteInLineCodes($value, $sharer); - } elseif (\in_array($field, ["share_with", "share_with_displayname", "user", "share_with_additional_info"])) { + } elseif (\in_array( + $field, + ["share_with", "share_with_displayname", "user", "share_with_additional_info"] + ) + ) { $value = $this->substituteInLineCodes($value, $sharee); } $value = $this->replaceValuesFromTable($field, $value); @@ -2439,7 +2495,7 @@ trait Sharing { * * @return void */ - public function theFieldsOfTheLastResponseShouldBeEmpty():void { + public function theFieldsOfTheLastResponseShouldBeEmpty(): void { $data = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]; Assert::assertEquals( \count($data->element), @@ -2454,7 +2510,7 @@ trait Sharing { * * @throws Exception */ - public function getSharingAttributesFromLastResponse():string { + public function getSharingAttributesFromLastResponse(): string { $responseXmlObject = HttpRequestHelper::getResponseXml($this->response, __METHOD__)->data[0]; $actualAttributesElement = $responseXmlObject->xpath('//attributes'); @@ -2479,7 +2535,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkingAttributesInLastShareResponse(TableNode $attributes):void { + public function checkingAttributesInLastShareResponse(TableNode $attributes): void { $this->verifyTableNodeColumns($attributes, ['scope', 'key', 'enabled']); $attributes = $attributes->getHash(); @@ -2540,7 +2596,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userDownloadsFailWithMessage(string $fileName, string $user, PyStringNode $errorMessage):void { + public function userDownloadsFailWithMessage(string $fileName, string $user, PyStringNode $errorMessage): void { $user = $this->getActualUsername($user); $response = $this->downloadFileAsUserUsingPassword($user, $fileName); $receivedErrorMessage = HttpRequestHelper::getResponseXml($response, __METHOD__)->xpath('//s:message'); @@ -2561,7 +2617,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkFieldsNotInResponse(?TableNode $body):void { + public function checkFieldsNotInResponse(?TableNode $body): void { $this->verifyTableNodeColumnsCount($body, 2); $bodyRows = $body->getRowsHash(); @@ -2589,7 +2645,7 @@ trait Sharing { * * @return SimpleXMLElement */ - public function getShares(string $user, string $path):SimpleXMLElement { + public function getShares(string $user, string $path): SimpleXMLElement { $response = OcsApiHelper::sendRequest( $this->getBaseUrl(), $user, @@ -2613,7 +2669,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkPublicShares(string $user, string $path, ?TableNode $TableNode):void { + public function checkPublicShares(string $user, string $path, ?TableNode $TableNode): void { $user = $this->getActualUsername($user); $response = $this->getShares($user, $path); @@ -2662,7 +2718,7 @@ trait Sharing { * @return void * @throws Exception */ - public function checkPublicSharesAreEmpty(string $user, string $path):void { + public function checkPublicSharesAreEmpty(string $user, string $path): void { $user = $this->getActualUsername($user); $response = $this->getShares($user, $path); //It shouldn't have public shares @@ -2683,7 +2739,7 @@ trait Sharing { * * @return string|null */ - public function getPublicShareIDByName(string $user, string $path, string $name):?string { + public function getPublicShareIDByName(string $user, string $path, string $name): ?string { $response = $this->getShares($user, $path); foreach ($response as $elementResponded) { if ((string) $elementResponded->name[0] === $name) { @@ -2704,7 +2760,7 @@ trait Sharing { string $user, string $name, string $path - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $share_id = $this->getPublicShareIDByName($user, $path, $name); $url = $this->getSharesEndpointPath("/$share_id"); @@ -2728,7 +2784,7 @@ trait Sharing { string $user, string $name, string $path - ):void { + ): void { $response = $this->deletePublicLinkShareUsingTheSharingApi( $user, $name, @@ -2750,7 +2806,7 @@ trait Sharing { string $user, string $name, string $path - ):void { + ): void { $response = $this->deletePublicLinkShareUsingTheSharingApi( $user, $name, @@ -2768,7 +2824,13 @@ trait Sharing { * * @return ResponseInterface */ - public function reactToShareOfferedBy(string $user, string $action, string $share, string $offeredBy, ?string $state = ''):ResponseInterface { + public function reactToShareOfferedBy( + string $user, + string $action, + string $share, + string $offeredBy, + ?string $state = '' + ): ResponseInterface { $user = $this->getActualUsername($user); $offeredBy = $this->getActualUsername($offeredBy); @@ -2830,7 +2892,13 @@ trait Sharing { * @return void * @throws Exception */ - public function userReactsToShareOfferedBy(string $user, string $action, string $share, string $offeredBy, ?string $state = ''):void { + public function userReactsToShareOfferedBy( + string $user, + string $action, + string $share, + string $offeredBy, + ?string $state = '' + ): void { $response = $this->reactToShareOfferedBy( $user, $action, @@ -2853,7 +2921,13 @@ trait Sharing { * @return void * @throws Exception */ - public function userAcceptsTheAlreadyAcceptedShareOfferedByUsingTheSharingApi(string $user, string $action, string $share, string $offeredBy, ?string $state = ''):void { + public function userAcceptsTheAlreadyAcceptedShareOfferedByUsingTheSharingApi( + string $user, + string $action, + string $share, + string $offeredBy, + ?string $state = '' + ): void { $response = $this->reactToShareOfferedBy( $user, $action, @@ -2875,7 +2949,12 @@ trait Sharing { * @return void * @throws Exception */ - public function userReactsToTheFollowingSharesOfferedBy(string $user, string $action, string $offeredBy, TableNode $table):void { + public function userReactsToTheFollowingSharesOfferedBy( + string $user, + string $action, + string $offeredBy, + TableNode $table + ): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -2902,7 +2981,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userReactsToShareWithShareIDOfferedBy(string $user, string $action, string $share_id):void { + public function userReactsToShareWithShareIDOfferedBy(string $user, string $action, string $share_id): void { $user = $this->getActualUsername($user); $shareId = $this->substituteInLineCodes($share_id, $user); @@ -2935,7 +3014,12 @@ trait Sharing { * @return void * @throws Exception */ - public function userHasReactedToShareOfferedBy(string $user, string $action, string $share, string $offeredBy):void { + public function userHasReactedToShareOfferedBy( + string $user, + string $action, + string $share, + string $offeredBy + ): void { $response = $this->reactToShareOfferedBy( $user, $action, @@ -2966,7 +3050,7 @@ trait Sharing { * @return void * @throws Exception */ - public function userAcceptsThePendingShareOfferedBy(string $user, string $share, string $offeredBy):void { + public function userAcceptsThePendingShareOfferedBy(string $user, string $share, string $offeredBy): void { $response = $this->reactToShareOfferedBy($user, 'accepts', $share, $offeredBy, 'pending'); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -3043,7 +3127,7 @@ trait Sharing { * @return void * @throws Exception */ - public function assertSharesOfUserAreInState(string $user, string $state, TableNode $table):void { + public function assertSharesOfUserAreInState(string $user, string $state, TableNode $table): void { $this->verifyTableNodeColumns($table, ["path"], $this->shareResponseFields); $usersShares = $this->getAllSharesSharedWithUser($user, $state); foreach ($table as $row) { @@ -3079,7 +3163,7 @@ trait Sharing { * @return void * @throws Exception */ - public function assertNoSharesOfUserAreInState(string $user, string $state):void { + public function assertNoSharesOfUserAreInState(string $user, string $state): void { $usersShares = $this->getAllSharesSharedWithUser($user, $state); Assert::assertEmpty( $usersShares, @@ -3141,7 +3225,7 @@ trait Sharing { * @return void * @throws Exception */ - public function assertThatNoSharesAreSharedWithUser(string $user):void { + public function assertThatNoSharesAreSharedWithUser(string $user): void { $usersShares = $this->getAllSharesSharedWithUser($user); Assert::assertEmpty( $usersShares, @@ -3157,7 +3241,10 @@ trait Sharing { * * @return ResponseInterface|null */ - public function userGetsTheLastShareWithTheShareIdUsingTheSharingApi(string $user, string $share_id): ?ResponseInterface { + public function userGetsTheLastShareWithTheShareIdUsingTheSharingApi( + string $user, + string $share_id + ): ?ResponseInterface { $user = $this->getActualUsername($user); $share_id = $this->substituteInLineCodes($share_id, $user); $url = $this->getSharesEndpointPath("/$share_id"); @@ -3228,7 +3315,7 @@ trait Sharing { * * @return ResponseInterface */ - public function getPublicPreviewOfFile(string $fileName, string $token):ResponseInterface { + public function getPublicPreviewOfFile(string $fileName, string $token): ResponseInterface { $baseUrl = $this->getBaseUrl(); $davPath = WebdavHelper::getDavPath($this->getDavPathVersion(), $token, "public-files"); $url = "$baseUrl/$davPath/$fileName?preview=1"; @@ -3245,8 +3332,9 @@ trait Sharing { * * @return void */ - public function thePublicAccessesThePreviewOfTheSharedFileUsingTheSharingApi(string $path):void { - $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); + public function thePublicAccessesThePreviewOfTheSharedFileUsingTheSharingApi(string $path): void { + $token = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $response = $this->getPublicPreviewOfFile($path, $token); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -3262,13 +3350,14 @@ trait Sharing { */ public function thePublicAccessesThePreviewOfTheFollowingSharedFileUsingTheSharingApi( TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); $this->emptyLastHTTPStatusCodesArray(); $this->emptyLastOCSStatusCodesArray(); foreach ($paths as $path) { - $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); + $token = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $response = $this->getPublicPreviewOfFile($path["path"], $token); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -3286,7 +3375,7 @@ trait Sharing { string $user, string $shareServer, ?string $password = "" - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $userPassword = $this->getPasswordForUser($user); @@ -3336,7 +3425,7 @@ trait Sharing { * * @return void */ - public function userHasAddedPublicShareCreatedByUser(string $user, string $shareServer):void { + public function userHasAddedPublicShareCreatedByUser(string $user, string $shareServer): void { $this->saveLastSharedPublicLinkShare($user, $shareServer); $resBody = json_decode($this->response->getBody()->getContents()); @@ -3371,7 +3460,12 @@ trait Sharing { * * @return array */ - public function preparePublicQuickLinkPayload(string $user, string $path, string $type, int $permissions = 1): array { + public function preparePublicQuickLinkPayload( + string $user, + string $path, + string $type, + int $permissions = 1 + ): array { return [ "permissions" => $permissions, "expireDate" => "", @@ -3400,7 +3494,7 @@ trait Sharing { * @return void * @throws Exception */ - public function theUserHasCreatedAReadOnlyPublicLinkForFileFolder(string $user, string $type, string $path):void { + public function theUserHasCreatedAReadOnlyPublicLinkForFileFolder(string $user, string $type, string $path): void { $user = $this->getActualUsername($user); $userPassword = $this->getPasswordForUser($user); @@ -3426,7 +3520,7 @@ trait Sharing { * * @return void */ - public function userAddsPublicShareCreatedByUser(string $user, string $shareServer):void { + public function userAddsPublicShareCreatedByUser(string $user, string $shareServer): void { $this->setResponse($this->saveLastSharedPublicLinkShare($user, $shareServer)); } @@ -3436,7 +3530,7 @@ trait Sharing { * @return void * @throws ResponseInterface */ - public function expireLastCreatedPublicLinkShare():ResponseInterface { + public function expireLastCreatedPublicLinkShare(): ResponseInterface { $shareId = (string) $this->getLastCreatedPublicShare()->id; return $this->expireShare($shareId); } @@ -3449,7 +3543,7 @@ trait Sharing { * @return ResponseInterface * @throws GuzzleException */ - public function expireShare(string $shareId = null):ResponseInterface { + public function expireShare(string $shareId = null): ResponseInterface { $adminUser = $this->getAdminUsername(); if ($shareId === null) { $shareId = $this->getLastCreatedUserGroupShareId(); @@ -3473,7 +3567,7 @@ trait Sharing { * @return void * @throws GuzzleException */ - public function theAdministratorHasExpiredTheLastCreatedShare():void { + public function theAdministratorHasExpiredTheLastCreatedShare(): void { $this->expireShare(); $httpStatus = $this->getResponse()->getStatusCode(); Assert::assertSame( @@ -3499,7 +3593,7 @@ trait Sharing { * @return void * @throws GuzzleException */ - public function theAdministratorHasExpiredTheLastCreatedPublicLinkShare():void { + public function theAdministratorHasExpiredTheLastCreatedPublicLinkShare(): void { $this->expireLastCreatedPublicLinkShare(); $httpStatus = $this->getResponse()->getStatusCode(); Assert::assertSame( @@ -3525,7 +3619,7 @@ trait Sharing { * @return void * @throws GuzzleException */ - public function theAdministratorExpiresTheLastCreatedShare():void { + public function theAdministratorExpiresTheLastCreatedShare(): void { $this->setResponse($this->expireShare()); } @@ -3535,7 +3629,7 @@ trait Sharing { * @return void * @throws GuzzleException */ - public function theAdministratorExpiresTheLastCreatedPublicLinkShare():void { + public function theAdministratorExpiresTheLastCreatedPublicLinkShare(): void { $this->setResponse($this->expireLastCreatedPublicLinkShare()); } @@ -3547,7 +3641,7 @@ trait Sharing { * * @return string */ - public function replaceValuesFromTable(string $field, string $value):string { + public function replaceValuesFromTable(string $field, string $value): string { if (\substr($field, 0, 10) === "share_with") { $value = \str_replace( "REMOTE", @@ -3587,7 +3681,7 @@ trait Sharing { /** * @return array of common sharing capability settings for testing */ - protected function getCommonSharingConfigs():array { + protected function getCommonSharingConfigs(): array { return [ [ 'capabilitiesApp' => 'files_sharing', diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 9c7e0182a01..d18d6abc616 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -87,7 +87,8 @@ class SharingNgContext implements Context { $bodyRows['quickLink'] = $bodyRows['quickLink'] ?? false; $bodyRows['displayName'] = $bodyRows['displayName'] ?? null; - $bodyRows['expirationDateTime'] = \array_key_exists('expirationDateTime', $bodyRows) ? \date('Y-m-d', \strtotime($bodyRows['expirationDateTime'])) . 'T14:00:00.000Z' : null; + $bodyRows['expirationDateTime'] = \array_key_exists('expirationDateTime', $bodyRows) + ? \date('Y-m-d', \strtotime($bodyRows['expirationDateTime'])) . 'T14:00:00.000Z' : null; $bodyRows['password'] = $bodyRows['password'] ?? null; $body = [ 'type' => $bodyRows['permissionsRole'], @@ -150,11 +151,18 @@ class SharingNgContext implements Context { * @param string $fileOrFolder (file|folder) * @param string $space * @param string|null $resource + * @param string|null $query * * @return ResponseInterface * @throws GuzzleException */ - public function getPermissionsList(string $user, string $fileOrFolder, string $space, ?string $resource = ''):ResponseInterface { + public function getPermissionsList( + string $user, + string $fileOrFolder, + string $space, + ?string $resource = '', + ?string $query = null + ): ResponseInterface { $spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"]; if ($fileOrFolder === 'folder') { @@ -169,7 +177,8 @@ class SharingNgContext implements Context { $user, $this->featureContext->getPasswordForUser($user), $spaceId, - $itemId + $itemId, + $query ); } @@ -184,7 +193,12 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userGetsPermissionsListForResourceOfTheSpaceUsingTheGraphAPI(string $user, string $fileOrFolder, string $resource, string $space):void { + public function userGetsPermissionsListForResourceOfTheSpaceUsingTheGraphAPI( + string $user, + string $fileOrFolder, + string $resource, + string $space + ): void { $this->featureContext->setResponse( $this->getPermissionsList($user, $fileOrFolder, $space, $resource) ); @@ -199,7 +213,7 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userListsThePermissionsOfSpaceUsingTheGraphApi(string $user, string $space):void { + public function userListsThePermissionsOfSpaceUsingTheGraphApi(string $user, string $space): void { $this->featureContext->setResponse( $this->getPermissionsList($user, 'folder', $space) ); @@ -215,7 +229,11 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi(string $user, string $space, string $spaceOwner):void { + public function userTriesToListThePermissionsOfSpaceUsingPermissionsEndpointOfTheGraphApi( + string $user, + string $space, + string $spaceOwner + ): void { $spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"]; $itemId = $this->spacesContext->getResourceId($spaceOwner, $space, ''); @@ -287,7 +305,12 @@ class SharingNgContext implements Context { if ($shareType === "user") { $shareeId = $this->featureContext->getAttributeOfCreatedUser($sharee, 'id'); if ($federatedShare) { - $shareeId = ($this->featureContext->ocmContext->getAcceptedUserByName($user, $sharee))['user_id']; + $shareeId = ( + $this->featureContext->ocmContext->getAcceptedUserByName( + $user, + $sharee + ) + )['user_id']; } } elseif ($shareType === "group") { $shareeId = $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id'); @@ -333,7 +356,11 @@ class SharingNgContext implements Context { * @throws GuzzleException * @throws Exception */ - public function sendDriveShareInvitation(string $user, TableNode $table, bool $federatedShare = false): ResponseInterface { + public function sendDriveShareInvitation( + string $user, + TableNode $table, + bool $federatedShare = false + ): ResponseInterface { $shareeIds = []; $rows = $table->getRowsHash(); if ($rows['space'] === 'Personal' || $rows['space'] === 'Shares') { @@ -396,7 +423,11 @@ class SharingNgContext implements Context { */ public function userHasSentTheFollowingResourceShareInvitation(string $user, TableNode $table): void { $rows = $table->getRowsHash(); - Assert::assertArrayHasKey("resource", $rows, "'resource' should be provided in the data-table while sharing a resource"); + Assert::assertArrayHasKey( + "resource", + $rows, + "'resource' should be provided in the data-table while sharing a resource" + ); $response = $this->sendShareInvitation($user, $rows); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); } @@ -411,9 +442,16 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userHasSentTheFollowingResourceShareInvitationToFederatedUser(string $user, TableNode $table): void { + public function userHasSentTheFollowingResourceShareInvitationToFederatedUser( + string $user, + TableNode $table + ): void { $rows = $table->getRowsHash(); - Assert::assertArrayHasKey("resource", $rows, "'resource' should be provided in the data-table while sharing a resource"); + Assert::assertArrayHasKey( + "resource", + $rows, + "'resource' should be provided in the data-table while sharing a resource" + ); $response = $this->sendShareInvitation($user, $rows, null, true); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); } @@ -430,7 +468,11 @@ class SharingNgContext implements Context { */ public function userHasSentTheFollowingShareShareInvitation(string $user, TableNode $table): void { $rows = $table->getRowsHash(); - Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space"); + Assert::assertArrayNotHasKey( + "resource", + $rows, + "'resource' should not be provided in the data-table while sharing a space" + ); $response = $this->sendDriveShareInvitation($user, $table); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); } @@ -448,7 +490,11 @@ class SharingNgContext implements Context { */ public function userSendsTheFollowingResourceShareInvitationUsingTheGraphApi(string $user, TableNode $table): void { $rows = $table->getRowsHash(); - Assert::assertArrayHasKey("resource", $rows, "'resource' should be provided in the data-table while sharing a resource"); + Assert::assertArrayHasKey( + "resource", + $rows, + "'resource' should be provided in the data-table while sharing a resource" + ); $this->featureContext->setResponse( $this->sendShareInvitation($user, $rows) ); @@ -464,9 +510,16 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userSendsTheFollowingResourceShareInvitationToFederatedUserUsingTheGraphApi(string $user, TableNode $table): void { + public function userSendsTheFollowingResourceShareInvitationToFederatedUserUsingTheGraphApi( + string $user, + TableNode $table + ): void { $rows = $table->getRowsHash(); - Assert::assertArrayHasKey("resource", $rows, "'resource' should be provided in the data-table while sharing a resource"); + Assert::assertArrayHasKey( + "resource", + $rows, + "'resource' should be provided in the data-table while sharing a resource" + ); $this->featureContext->setResponse( $this->sendShareInvitation($user, $rows, null, true) ); @@ -482,9 +535,16 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userSendsTheFollowingSpaceShareInvitationUsingPermissionsEndpointOfTheGraphApi(string $user, TableNode $table): void { + public function userSendsTheFollowingSpaceShareInvitationUsingPermissionsEndpointOfTheGraphApi( + string $user, + TableNode $table + ): void { $rows = $table->getRowsHash(); - Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space"); + Assert::assertArrayNotHasKey( + "resource", + $rows, + "'resource' should not be provided in the data-table while sharing a space" + ); $this->featureContext->setResponse( $this->sendShareInvitation($user, $rows) ); @@ -500,9 +560,16 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingPermissionsEndpointOfTheGraphApi(string $user, TableNode $table): void { + public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingPermissionsEndpointOfTheGraphApi( + string $user, + TableNode $table + ): void { $rows = $table->getRowsHash(); - Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space"); + Assert::assertArrayNotHasKey( + "resource", + $rows, + "'resource' should not be provided in the data-table while sharing a space" + ); $this->featureContext->setResponse( $this->sendShareInvitation($user, $rows, null, true) ); @@ -555,7 +622,12 @@ class SharingNgContext implements Context { * * @return void */ - public function userUpdatesTheSpaceShareForUserOrGroupWithFollowingUsingGraphApi(string $user, string $shareType, string $sharee, TableNode $table) { + public function userUpdatesTheSpaceShareForUserOrGroupWithFollowingUsingGraphApi( + string $user, + string $shareType, + string $sharee, + TableNode $table + ) { $permissionID = ""; if ($shareType === "user") { $permissionID = "u:" . $this->featureContext->getAttributeOfCreatedUser($sharee, 'id'); @@ -600,7 +672,8 @@ class SharingNgContext implements Context { } if (\array_key_exists('expirationDateTime', $bodyRows)) { - $body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) ? null : $bodyRows['expirationDateTime']; + $body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) + ? null : $bodyRows['expirationDateTime']; } return GraphHelper::updateShare( @@ -626,7 +699,11 @@ class SharingNgContext implements Context { * @throws JsonException * @throws GuzzleException */ - public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi(string $user, string $fileId, TableNode $table): void { + public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi( + string $user, + string $fileId, + TableNode $table + ): void { $rows = $table->getRowsHash(); $this->featureContext->setResponse( $this->sendShareInvitation($user, $rows, $fileId) @@ -642,7 +719,7 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userCreatesAPublicLinkShareWithSettings(string $user, TableNode $body):void { + public function userCreatesAPublicLinkShareWithSettings(string $user, TableNode $body): void { $response = $this->createLinkShare($user, $body); $this->featureContext->setResponse($response); } @@ -656,7 +733,10 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userCreatesTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi(string $user, TableNode $body):void { + public function userCreatesTheFollowingSpaceLinkShareUsingPermissionsEndpointOfTheGraphApi( + string $user, + TableNode $body + ): void { $this->featureContext->setResponse($this->createLinkShare($user, $body)); } @@ -671,7 +751,11 @@ class SharingNgContext implements Context { */ public function userHasCreatedTheFollowingResourceLinkShare(string $user, TableNode $body): void { $rows = $body->getRowsHash(); - Assert::assertArrayHasKey("resource", $rows, "'resource' should be provided in the data-table while sharing a resource"); + Assert::assertArrayHasKey( + "resource", + $rows, + "'resource' should be provided in the data-table while sharing a resource" + ); $response = $this->createLinkShare($user, $body); $this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response); $this->featureContext->shareNgAddToCreatedLinkShares($response); @@ -688,7 +772,11 @@ class SharingNgContext implements Context { */ public function userHasCreatedTheFollowingLinkShare(string $user, TableNode $body): void { $rows = $body->getRowsHash(); - Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space"); + Assert::assertArrayNotHasKey( + "resource", + $rows, + "'resource' should not be provided in the data-table while sharing a space" + ); $response = $this->createDriveLinkShare($user, $body); $this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response); $this->featureContext->shareNgAddToCreatedLinkShares($response); @@ -703,7 +791,7 @@ class SharingNgContext implements Context { * @return void * @throws Exception|GuzzleException */ - public function userHasUpdatedLastPublicLinkShare(string $user, TableNode $body):void { + public function userHasUpdatedLastPublicLinkShare(string $user, TableNode $body): void { $response = $this->updateLinkShare( $user, $body, @@ -721,7 +809,10 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi(string $user, TableNode $body):void { + public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi( + string $user, + TableNode $body + ): void { $this->featureContext->setResponse( $this->updateLinkShare( $user, @@ -755,7 +846,8 @@ class SharingNgContext implements Context { } if (\array_key_exists('expirationDateTime', $bodyRows)) { - $body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) ? null : $bodyRows['expirationDateTime']; + $body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) + ? null : $bodyRows['expirationDateTime']; } if (\array_key_exists('displayName', $bodyRows)) { @@ -818,13 +910,17 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userHasSetTheFollowingPasswordForTheLastLinkShare(string $user, TableNode $body):void { + public function userHasSetTheFollowingPasswordForTheLastLinkShare(string $user, TableNode $body): void { $response = $this->setLinkSharePassword( $user, $body, $this->featureContext->shareNgGetLastCreatedLinkShareID() ); - $this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while setting public share link password!", $response); + $this->featureContext->theHTTPStatusCodeShouldBe( + 200, + "Failed while setting public share link password!", + $response + ); } /** @@ -836,7 +932,10 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(string $user, TableNode $body):void { + public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi( + string $user, + TableNode $body + ): void { $this->featureContext->setResponse( $this->setLinkSharePassword( $user, @@ -867,7 +966,8 @@ class SharingNgContext implements Context { ?string $recipient = null ): ResponseInterface { $spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"]; - $itemId = (isset($resource)) ? $this->spacesContext->getResourceId($sharer, $space, $resource) : $this->spacesContext->getResourceId($sharer, $space, $space); + $itemId = (isset($resource)) ? $this->spacesContext->getResourceId($sharer, $space, $resource) + : $this->spacesContext->getResourceId($sharer, $space, $space); $permissionID = ""; @@ -1043,7 +1143,7 @@ class SharingNgContext implements Context { string $sharer, string $resource, string $space - ):void { + ): void { $this->featureContext->setResponse( $this->removeAccessToSpaceItem($sharer, 'link', $space, $resource) ); @@ -1086,7 +1186,7 @@ class SharingNgContext implements Context { public function userRemovesLinkFromSpaceUsingRootEndpointOfGraphAPI( string $sharer, string $space - ):void { + ): void { $this->featureContext->setResponse( $this->removeAccessToSpace($sharer, 'link', $space) ); @@ -1146,7 +1246,7 @@ class SharingNgContext implements Context { * @return void * @throws Exception|GuzzleException */ - public function userHasDisabledSyncOfLastSharedResource(string $user):void { + public function userHasDisabledSyncOfLastSharedResource(string $user): void { $shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); $shareSpaceId = GraphHelper::SHARES_SPACE_ID; $itemId = $shareSpaceId . '!' . $shareItemId; @@ -1158,7 +1258,11 @@ class SharingNgContext implements Context { $itemId, $shareSpaceId, ); - $this->featureContext->theHTTPStatusCodeShouldBe(204, __METHOD__ . " could not disable sync of last share", $response); + $this->featureContext->theHTTPStatusCodeShouldBe( + 204, + __METHOD__ . " could not disable sync of last share", + $response + ); } /** @@ -1170,7 +1274,7 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userDisablesSyncOfShareUsingTheGraphApi(string $user):void { + public function userDisablesSyncOfShareUsingTheGraphApi(string $user): void { $shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); $shareSpaceId = GraphHelper::SHARES_SPACE_ID; $itemId = $shareSpaceId . '!' . $shareItemId; @@ -1197,7 +1301,7 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userHidesTheSharedResourceUsingTheGraphApi(string $user):void { + public function userHidesTheSharedResourceUsingTheGraphApi(string $user): void { $shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); $response = $this->hideOrUnhideSharedResource($user, $shareItemId); $this->featureContext->setResponse($response); @@ -1212,7 +1316,7 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userHasHiddenTheShare(string $user):void { + public function userHasHiddenTheShare(string $user): void { $shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); $response = $this->hideOrUnhideSharedResource($user, $shareItemId); $this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response); @@ -1227,7 +1331,7 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userUnhidesTheSharedResourceUsingTheGraphApi(string $user):void { + public function userUnhidesTheSharedResourceUsingTheGraphApi(string $user): void { $shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); $response = $this->hideOrUnhideSharedResource($user, $shareItemId, false); $this->featureContext->setResponse($response); @@ -1244,7 +1348,12 @@ class SharingNgContext implements Context { * @return void * @throws Exception */ - public function userEnablesSyncOfShareUsingTheGraphApi(string $user, string $share, string $offeredBy, string $space):void { + public function userEnablesSyncOfShareUsingTheGraphApi( + string $user, + string $share, + string $offeredBy, + string $space + ): void { $share = ltrim($share, '/'); $itemId = $this->spacesContext->getResourceId($offeredBy, $space, $share); $shareSpaceId = GraphHelper::SHARES_SPACE_ID; @@ -1271,7 +1380,7 @@ class SharingNgContext implements Context { * @return void * @throws Exception|GuzzleException */ - public function userTriesToEnableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource):void { + public function userTriesToEnableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource): void { $shareSpaceId = GraphHelper::SHARES_SPACE_ID; $itemId = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource; @@ -1295,7 +1404,7 @@ class SharingNgContext implements Context { * @return void * @throws Exception|GuzzleException */ - public function userTriesToDisableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource):void { + public function userTriesToDisableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource): void { $shareSpaceId = GraphHelper::SHARES_SPACE_ID; $shareID = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource; $itemId = $shareSpaceId . '!' . $shareID; @@ -1392,7 +1501,7 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userShouldHaveSyncEnabledOrDisabledForShare(string $user, string $status, string $resource):void { + public function userShouldHaveSyncEnabledOrDisabledForShare(string $user, string $status, string $resource): void { $this->waitAndCheckShareSyncStatus($user, $resource, $status); } @@ -1406,11 +1515,15 @@ class SharingNgContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles(string $user, TableNode $table): void { + public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles( + string $user, + TableNode $table + ): void { $listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent(); if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) { Assert::fail( - "The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n" . $listPermissionResponse + "The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n" + . $listPermissionResponse ); } Assert::assertNotEmpty( @@ -1431,8 +1544,13 @@ class SharingNgContext implements Context { foreach ($allowedPermissionRoles as $role) { //we should be able to send share invitation for each of the role allowed for the files/folders which are listed in permissions (allowed) $roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id); - $responseSendInvitation = $this->sendShareInvitation($user, array_merge($rows, ['permissionsRole' => $roleAllowed])); - $jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent($responseSendInvitation); + $responseSendInvitation = $this->sendShareInvitation( + $user, + array_merge($rows, ['permissionsRole' => $roleAllowed]) + ); + $jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent( + $responseSendInvitation + ); $httpsStatusCode = $responseSendInvitation->getStatusCode(); if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) { // remove the share so that the same user can be share for the next allowed roles @@ -1440,7 +1558,8 @@ class SharingNgContext implements Context { Assert::assertEquals(204, $removePermissionsResponse->getStatusCode()); } else { $areAllSendInvitationSuccessFullForAllowedRoles = false; - $shareInvitationRequestResult .= "\tShare invitation for " . $resourceDetail . "' with role '" . $roleAllowed . "' failed and was not allowed.\n"; + $shareInvitationRequestResult .= "\tShare invitation for " . $resourceDetail + . "' with role '" . $roleAllowed . "' failed and was not allowed.\n"; } } Assert::assertTrue($areAllSendInvitationSuccessFullForAllowedRoles, $shareInvitationRequestResult); @@ -1457,7 +1576,7 @@ class SharingNgContext implements Context { * @throws GuzzleException * */ - public function userListsThePermissionsOfDriveUsingRootEndPointOFTheGraphApi(string $user, string $space):void { + public function userListsThePermissionsOfDriveUsingRootEndPointOFTheGraphApi(string $user, string $space): void { $spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"]; $response = GraphHelper::getDrivePermissionsList( @@ -1479,7 +1598,10 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userSendsTheFollowingShareInvitationUsingRootEndPointTheGraphApi(string $user, TableNode $table):void { + public function userSendsTheFollowingShareInvitationUsingRootEndPointTheGraphApi( + string $user, + TableNode $table + ): void { $response = $this->sendDriveShareInvitation($user, $table); $this->featureContext->setResponse($response); } @@ -1493,7 +1615,10 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userSendsTheFollowingShareInvitationToFederatedUserUsingRootEndPointTheGraphApi(string $user, TableNode $table):void { + public function userSendsTheFollowingShareInvitationToFederatedUserUsingRootEndPointTheGraphApi( + string $user, + TableNode $table + ): void { $response = $this->sendDriveShareInvitation($user, $table, true); $this->featureContext->setResponse($response); } @@ -1507,7 +1632,10 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userUpdatesTheLastDriveShareWithTheFollowingUsingRootEndpointOfTheGraphApi(string $user, TableNode $table): void { + public function userUpdatesTheLastDriveShareWithTheFollowingUsingRootEndpointOfTheGraphApi( + string $user, + TableNode $table + ): void { $bodyRows = $table->getRowsHash(); $permissionID = match ($bodyRows['shareType']) { 'user' => 'u:' . $this->featureContext->getAttributeOfCreatedUser($bodyRows['sharee'], 'id'), @@ -1523,7 +1651,8 @@ class SharingNgContext implements Context { } if (\array_key_exists('expirationDateTime', $bodyRows)) { - $body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) ? null : $bodyRows['expirationDateTime']; + $body['expirationDateTime'] = empty($bodyRows['expirationDateTime']) + ? null : $bodyRows['expirationDateTime']; } $this->featureContext->setResponse( @@ -1548,9 +1677,16 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi(string $user, TableNode $body): void { + public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi( + string $user, + TableNode $body + ): void { $rows = $body->getRowsHash(); - Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space"); + Assert::assertArrayNotHasKey( + "resource", + $rows, + "'resource' should not be provided in the data-table while sharing a space" + ); $response = $this->createDriveLinkShare($user, $body); $this->featureContext->setResponse($response); @@ -1565,9 +1701,16 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userSetsTheFollowingPasswordForTheLastSpaceLinkShareUsingRootEndpointOfTheGraphAPI(string $user, TableNode $body): void { + public function userSetsTheFollowingPasswordForTheLastSpaceLinkShareUsingRootEndpointOfTheGraphAPI( + string $user, + TableNode $body + ): void { $rows = $body->getRowsHash(); - Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while setting password in space shared link"); + Assert::assertArrayNotHasKey( + "resource", + $rows, + "'resource' should not be provided in the data-table while setting password in space shared link" + ); Assert::assertArrayHasKey("password", $rows, "'password' is missing in the data-table"); $body = [ @@ -1599,7 +1742,11 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userTriesToRemoveShareLinkOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(string $user, string $space, string $spaceOwner): void { + public function userTriesToRemoveShareLinkOfSpaceOwnedByUsingRootEndpointOfTheGraphApi( + string $user, + string $space, + string $spaceOwner + ): void { $permissionID = $this->featureContext->shareNgGetLastCreatedLinkShareID(); $spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"]; @@ -1638,10 +1785,18 @@ class SharingNgContext implements Context { foreach ($responseBody['value'] as $value) { switch ($shareType) { case $shareType === 'link': - Assert::assertArrayNotHasKey('link', $value, $space . ' space should not have any link permissions but found ' . print_r($value, true)); + Assert::assertArrayNotHasKey( + 'link', + $value, + $space . ' space should not have any link permissions but found ' . print_r($value, true) + ); break; case $shareType === "share": - Assert::assertArrayNotHasKey('grantedToV2', $value, $space . ' space should not have any share permissions but found ' . print_r($value, true)); + Assert::assertArrayNotHasKey( + 'grantedToV2', + $value, + $space . ' space should not have any share permissions but found ' . print_r($value, true) + ); break; default: Assert::fail('Invalid share type has been specified'); @@ -1657,12 +1812,18 @@ class SharingNgContext implements Context { * * @return void * @throws GuzzleException + * @codingStandardsIgnoreStart */ - public function userShouldBeAbleToSendTheFollowingSpaceShareInvitationWithAllAllowedPermissionRolesUsingRootEndpointOFTheGraphApi(string $user, TableNode $table): void { + public function userShouldBeAbleToSendTheFollowingSpaceShareInvitationWithAllAllowedPermissionRolesUsingRootEndpointOFTheGraphApi( + // @codingStandardsIgnoreEnd + string $user, + TableNode $table + ): void { $listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent(); if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) { Assert::fail( - "The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n" . $listPermissionResponse + "The following response does not contain '@libre.graph.permissions.roles.allowedValues' property:\n" + . $listPermissionResponse ); } Assert::assertNotEmpty( @@ -1682,8 +1843,13 @@ class SharingNgContext implements Context { foreach ($allowedPermissionRoles as $role) { // we should be able to send share invitation for each of the roles allowed which are listed in permissions (allowed) $roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id); - $responseSendInvitation = $this->sendDriveShareInvitation($user, new TableNode(array_merge($table->getTable(), [['permissionsRole', $roleAllowed]]))); - $jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent($responseSendInvitation); + $responseSendInvitation = $this->sendDriveShareInvitation( + $user, + new TableNode(array_merge($table->getTable(), [['permissionsRole', $roleAllowed]])) + ); + $jsonResponseSendInvitation = $this->featureContext->getJsonDecodedResponseBodyContent( + $responseSendInvitation + ); $httpsStatusCode = $responseSendInvitation->getStatusCode(); if ($httpsStatusCode === 200 && !empty($jsonResponseSendInvitation->value)) { // remove the share so that the same user can be share for the next allowed roles @@ -1691,7 +1857,8 @@ class SharingNgContext implements Context { Assert::assertEquals(204, $removePermissionsResponse->getStatusCode()); } else { $areAllSendInvitationSuccessFullForAllowedRoles = false; - $shareInvitationRequestResult .= "\tShare invitation for " . $space . "' with role '" . $roleAllowed . "' failed and was not allowed.\n"; + $shareInvitationRequestResult .= "\tShare invitation for " . $space . "' with role '" + . $roleAllowed . "' failed and was not allowed.\n"; } } Assert::assertTrue($areAllSendInvitationSuccessFullForAllowedRoles, $shareInvitationRequestResult); @@ -1707,7 +1874,11 @@ class SharingNgContext implements Context { * @return void * @throws GuzzleException */ - public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTheGraphApi(string $user, string $space, string $spaceOwner): void { + public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTheGraphApi( + string $user, + string $space, + string $spaceOwner + ): void { $spaceId = ($this->spacesContext->getSpaceByName($spaceOwner, $space))["id"]; $response = GraphHelper::getDrivePermissionsList( @@ -1728,8 +1899,13 @@ class SharingNgContext implements Context { * * @return void */ - public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi(string $user, string $space):void { - $this->featureContext->setResponse($this->removeAccessToSpaceItem($user, 'link', $space, '')); + public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi( + string $user, + string $space + ): void { + $this->featureContext->setResponse( + $this->removeAccessToSpaceItem($user, 'link', $space, '') + ); } /** @@ -1745,7 +1921,14 @@ class SharingNgContext implements Context { * @throws JsonException * @throws Exception */ - public function checkIfShareExists(string $share, string $sharee, string $sharer, string $space, bool $shouldExist = true, bool $federatedShare = false): void { + public function checkIfShareExists( + string $share, + string $sharee, + string $sharer, + string $space, + bool $shouldExist = true, + bool $federatedShare = false + ): void { $share = \ltrim($share, "/"); if (\strtolower($space) === "personal") { $remoteDriveAlias = "personal/" . \strtolower($sharer); @@ -1765,11 +1948,18 @@ class SharingNgContext implements Context { $driveList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value; $foundShareMountpoint = false; foreach ($driveList as $drive) { - if ($drive->driveType === "mountpoint" && $drive->name === $share && $drive->root->remoteItem->driveAlias === $remoteDriveAlias) { + if ($drive->driveType === "mountpoint" + && $drive->name === $share + && $drive->root->remoteItem->driveAlias === $remoteDriveAlias + ) { $foundShareMountpoint = true; } } - Assert::assertSame($shouldExist, $foundShareMountpoint, "Share mountpoint '$share' was not found in the drives list."); + Assert::assertSame( + $shouldExist, + $foundShareMountpoint, + "Share mountpoint '$share' was not found in the drives list." + ); } // check share in shared-with-me list @@ -1793,7 +1983,11 @@ class SharingNgContext implements Context { break; } } - Assert::assertSame($shouldExist, $foundShareInSharedWithMe, "Share '$share' was not found in the shared-with-me list"); + Assert::assertSame( + $shouldExist, + $foundShareInSharedWithMe, + "Share '$share' was not found in the shared-with-me list" + ); } /** @@ -1807,7 +2001,13 @@ class SharingNgContext implements Context { * * @return void */ - public function userShouldHaveShareSharedByUserFromSpace(string $sharee, string $shouldOrNot, string $share, string $sharer, string $space): void { + public function userShouldHaveShareSharedByUserFromSpace( + string $sharee, + string $shouldOrNot, + string $share, + string $sharer, + string $space + ): void { $this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should"); } @@ -1822,7 +2022,13 @@ class SharingNgContext implements Context { * * @return void */ - public function userShouldOrShouldNotHaveFederatedShareSharedByUserFromSpace(string $sharee, string $shouldOrNot, string $share, string $sharer, string $space): void { + public function userShouldOrShouldNotHaveFederatedShareSharedByUserFromSpace( + string $sharee, + string $shouldOrNot, + string $share, + string $sharer, + string $space + ): void { $this->checkIfShareExists($share, $sharee, $sharer, $space, $shouldOrNot === "should", true); } @@ -1837,7 +2043,13 @@ class SharingNgContext implements Context { * * @return void */ - public function userHasSharedTheFollowingFilesFromSpaceWithUserAndRole(string $sharer, string $space, string $sharee, string $role, TableNode $table):void { + public function userHasSharedTheFollowingFilesFromSpaceWithUserAndRole( + string $sharer, + string $space, + string $sharee, + string $role, + TableNode $table + ): void { $rows = $table->getRows(); foreach ($rows as $row) { if (isset($row[0])) { @@ -1861,7 +2073,7 @@ class SharingNgContext implements Context { * * @return void */ - public function theJsonResponseShouldContainTheFollowingShares(TableNode $table):void { + public function theJsonResponseShouldContainTheFollowingShares(TableNode $table): void { $responseBody = $this->featureContext->getJsonDecodedResponseBodyContent(); $resourceNames = []; @@ -1882,4 +2094,29 @@ class SharingNgContext implements Context { ); } } + + /** + * @When /^user "([^"]*)" gets the allowed roles for federated user of (folder|file) "([^"]*)" from the space "([^"]*)" using the Graph API$/ + * + * @param string $user + * @param string $fileOrFolder (file|folder) + * @param string $resource + * @param string $space + * + * @return void + * @throws Exception + */ + public function userGetsFederatedPermissionsListForFileOfTheSpaceUsingTheGraphApi( + string $user, + string $fileOrFolder, + string $resource, + string $space + ): void { + $query = '$filter=@libre.graph.permissions.roles.allowedValues' + . '/rolePermissions/any(p:contains(p/condition,+\'@Subject.UserType=="Federated"\'))' + . '&$select=@libre.graph.permissions.roles.allowedValues'; + $this->featureContext->setResponse( + $this->getPermissionsList($user, $fileOrFolder, $space, $resource, $query) + ); + } } diff --git a/tests/acceptance/bootstrap/SpacesContext.php b/tests/acceptance/bootstrap/SpacesContext.php index 3cc044b71c4..fb8979b2f70 100644 --- a/tests/acceptance/bootstrap/SpacesContext.php +++ b/tests/acceptance/bootstrap/SpacesContext.php @@ -203,7 +203,8 @@ class SpacesContext implements Context { $this->$listSpacesFn($user); $spaces = $this->getAvailableSpaces(); - $tryAgain = !\array_key_exists($spaceName, $spaces) && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly(); + $tryAgain = !\array_key_exists($spaceName, $spaces) + && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly(); if ($tryAgain) { $retried += 1; echo "Space '$spaceName' not found for user '$user', retrying ($retried)...\n"; @@ -213,7 +214,10 @@ class SpacesContext implements Context { } while ($tryAgain); Assert::assertArrayHasKey($spaceName, $spaces, "Space with name '$spaceName' for user '$user' not found"); - Assert::assertNotEmpty($spaces[$spaceName]["root"]["webDavUrl"], "WebDavUrl for space with name '$spaceName' for user '$user' not found"); + Assert::assertNotEmpty( + $spaces[$spaceName]["root"]["webDavUrl"], + "WebDavUrl for space with name '$spaceName' for user '$user' not found" + ); return $spaces[$spaceName]; } @@ -275,7 +279,12 @@ class SpacesContext implements Context { * @return ResponseInterface * @throws GuzzleException */ - public function getFileData(string $user, string $spaceName, string $fileName, bool $federatedShare = false): ResponseInterface { + public function getFileData( + string $user, + string $spaceName, + string $fileName, + bool $federatedShare = false + ): ResponseInterface { $baseUrl = $this->featureContext->getBaseUrl(); if ($federatedShare) { @@ -373,7 +382,15 @@ class SpacesContext implements Context { "files", WebDavHelper::DAV_VERSION_SPACES ); - $responseArray = json_decode(json_encode(HttpRequestHelper::getResponseXml($response, __METHOD__)->xpath("//d:response/d:propstat/d:prop/oc:privatelink")), true, 512, JSON_THROW_ON_ERROR); + $responseArray = json_decode( + json_encode( + HttpRequestHelper::getResponseXml($response, __METHOD__) + ->xpath("//d:response/d:propstat/d:prop/oc:privatelink") + ), + true, + 512, + JSON_THROW_ON_ERROR + ); Assert::assertNotEmpty($responseArray, "the PROPFIND response for $spaceName is empty"); return $responseArray[0][0]; } @@ -539,7 +556,11 @@ class SpacesContext implements Context { * @throws GuzzleException * @throws Exception */ - public function listAllAvailableSpacesOfUser(string $user, string $query = '', array $headers = []): ResponseInterface { + public function listAllAvailableSpacesOfUser( + string $user, + string $query = '', + array $headers = [] + ): ResponseInterface { $response = GraphHelper::getMySpaces( $this->featureContext->getBaseUrl(), $user, @@ -580,7 +601,10 @@ class SpacesContext implements Context { * @throws GuzzleException * @throws Exception */ - public function theUserListsAllHisAvailableSpacesWithHeadersUsingTheGraphApi(string $user, TableNode $headersTable): void { + public function theUserListsAllHisAvailableSpacesWithHeadersUsingTheGraphApi( + string $user, + TableNode $headersTable + ): void { $this->featureContext->verifyTableNodeColumns( $headersTable, ['header', 'value'] @@ -645,7 +669,11 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function theUserLooksUpTheSingleSpaceUsingTheGraphApiByUsingItsId(string $user, string $spaceName, string $ownerUser = ''): void { + public function theUserLooksUpTheSingleSpaceUsingTheGraphApiByUsingItsId( + string $user, + string $spaceName, + string $ownerUser = '' + ): void { $space = $this->getSpaceByName(($ownerUser !== "") ? $ownerUser : $user, $spaceName); Assert::assertIsArray($space); Assert::assertNotEmpty($space["id"]); @@ -777,7 +805,12 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function userSendsPatchRequestToTheSpaceOfUserWithData(string $user, string $spaceName, string $owner, string $data): void { + public function userSendsPatchRequestToTheSpaceOfUserWithData( + string $user, + string $spaceName, + string $owner, + string $data + ): void { $space = $this->getSpaceByName($owner, $spaceName); Assert::assertIsArray($space); Assert::assertNotEmpty($spaceId = $space["id"]); @@ -835,7 +868,14 @@ class SpacesContext implements Context { ): void { $space = $this->getSpaceByName($user, $spaceName); $this->featureContext->setResponse($this->propfindSpace($user, $spaceName)); - $this->featureContext->propfindResultShouldContainEntries($shouldOrNot, $expectedFiles, $user, 'PROPFIND', '', $space['id']); + $this->featureContext->propfindResultShouldContainEntries( + $shouldOrNot, + $expectedFiles, + $user, + 'PROPFIND', + '', + $space['id'] + ); } /** @@ -910,7 +950,12 @@ class SpacesContext implements Context { string $share, string $fileContent ): void { - $actualFileContent = $this->getFileData($user, $share, $file, true)->getBody()->getContents(); + $actualFileContent = $this->getFileData( + $user, + $share, + $file, + true + )->getBody()->getContents(); Assert::assertEquals($fileContent, $actualFileContent, "File content did not match"); } @@ -1010,7 +1055,10 @@ class SpacesContext implements Context { "Expected response status code should be 200", $response ); - Assert::assertIsArray($spaceAsArray = $this->getSpaceByNameFromResponse($spaceName, $response), "No space with name $spaceName found"); + Assert::assertIsArray( + $spaceAsArray = $this->getSpaceByNameFromResponse($spaceName, $response), + "No space with name $spaceName found" + ); $permissions = $spaceAsArray["root"]["permissions"]; $userId = $this->featureContext->getUserIdByUserName($grantedUser); @@ -1036,7 +1084,10 @@ class SpacesContext implements Context { public function jsonRespondedShouldNotContain( string $spaceName ): void { - Assert::assertEmpty($this->getSpaceByNameFromResponse($spaceName), "space $spaceName should not be available for a user"); + Assert::assertEmpty( + $this->getSpaceByNameFromResponse($spaceName), + "space $spaceName should not be available for a user" + ); } /** @@ -1061,9 +1112,15 @@ class SpacesContext implements Context { $response ); if (\trim($shouldOrNot) === "not") { - Assert::assertEmpty($this->getSpaceByNameFromResponse($spaceName, $response), "space $spaceName should not be available for a user"); + Assert::assertEmpty( + $this->getSpaceByNameFromResponse($spaceName, $response), + "space $spaceName should not be available for a user" + ); } else { - Assert::assertNotEmpty($this->getSpaceByNameFromResponse($spaceName, $response), "space '$spaceName' should be available for a user '$user' but not found"); + Assert::assertNotEmpty( + $this->getSpaceByNameFromResponse($spaceName, $response), + "space '$spaceName' should be available for a user '$user' but not found" + ); } } @@ -1384,7 +1441,12 @@ class SpacesContext implements Context { * @throws GuzzleException * @throws Exception */ - public function userHasUploadedAFileToInSpaceUsingTheWebdavApi(string $user, string $source, string $destination, string $spaceName): void { + public function userHasUploadedAFileToInSpaceUsingTheWebdavApi( + string $user, + string $source, + string $destination, + string $spaceName + ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); $response = $this->featureContext->uploadFile($user, $source, $destination, $spaceId); $this->featureContext->theHTTPStatusCodeShouldBe( @@ -1415,7 +1477,12 @@ class SpacesContext implements Context { string $destination ): void { $spaceId = $this->getSpaceIdByName($ownerUser, $spaceName); - $response = $this->featureContext->uploadFileWithContent($user, $content, $destination, $spaceId); + $response = $this->featureContext->uploadFileWithContent( + $user, + $content, + $destination, + $spaceId + ); $this->featureContext->setResponse($response); } @@ -1475,7 +1542,9 @@ class SpacesContext implements Context { string $owner = '' ): void { $bodyData = ["Name" => $newName]; - $this->featureContext->setResponse($this->updateSpace($user, $spaceName, $bodyData, $owner)); + $this->featureContext->setResponse( + $this->updateSpace($user, $spaceName, $bodyData, $owner) + ); } /** @@ -1498,7 +1567,9 @@ class SpacesContext implements Context { string $owner = '' ): void { $bodyData = ["description" => $newDescription]; - $this->featureContext->setResponse($this->updateSpace($user, $spaceName, $bodyData, $owner)); + $this->featureContext->setResponse( + $this->updateSpace($user, $spaceName, $bodyData, $owner) + ); } /** @@ -1546,7 +1617,9 @@ class SpacesContext implements Context { string $owner = '' ): void { $bodyData = ["quota" => ["total" => $newQuota]]; - $this->featureContext->setResponse($this->updateSpace($user, $spaceName, $bodyData, $owner)); + $this->featureContext->setResponse( + $this->updateSpace($user, $spaceName, $bodyData, $owner) + ); } /** @@ -1757,7 +1830,7 @@ class SpacesContext implements Context { string $fileSource, string $fileDestination, string $spaceName - ):void { + ): void { $space = $this->getSpaceByName($user, $spaceName); $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( $user, @@ -1787,7 +1860,7 @@ class SpacesContext implements Context { string $fileSource, string $fileDestination, string $spaceName - ):ResponseInterface { + ): ResponseInterface { $space = $this->getSpaceByName($user, $spaceName); $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( $user, @@ -1820,8 +1893,15 @@ class SpacesContext implements Context { string $fileSource, string $fileDestination, string $spaceName - ):void { - $this->featureContext->setResponse($this->moveFileWithinSpace($user, $fileSource, $fileDestination, $spaceName)); + ): void { + $this->featureContext->setResponse( + $this->moveFileWithinSpace( + $user, + $fileSource, + $fileDestination, + $spaceName + ) + ); $this->featureContext->pushToLastHttpStatusCodesArray(); } @@ -1841,7 +1921,7 @@ class SpacesContext implements Context { string $fileSource, string $fileDestination, string $spaceName - ):void { + ): void { $response = $this->moveFileWithinSpace( $user, $fileSource, @@ -1899,9 +1979,13 @@ class SpacesContext implements Context { string $fileDestination, string $toSpaceName, TableNode $table = null - ):void { + ): void { $space = $this->getSpaceByName($user, $fromSpaceName); - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $toSpaceName + ); if ($table !== null) { $this->featureContext->verifyTableNodeColumns( @@ -1941,9 +2025,13 @@ class SpacesContext implements Context { string $fileDestination, string $toSpaceName, string $action - ):void { + ): void { $space = $this->getSpaceByName($user, $fromSpaceName); - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $toSpaceName + ); $headers['Overwrite'] = 'T'; $encodedName = \rawurlencode(ltrim($fileSource, "/")); @@ -1961,34 +2049,51 @@ class SpacesContext implements Context { } /** - * @Then /^user "([^"]*)" should not be able to download file "([^"]*)" from space "([^"]*)"$/ + * @Then /^user "([^"]*)" (should|should not) be able to download file "([^"]*)" from space "([^"]*)"$/ * * @param string $user + * @param string $shouldOrNot * @param string $fileName * @param string $spaceName * * @return void * @throws GuzzleException */ - public function userShouldNotBeAbleToDownloadFileInsideSpace( + public function userShouldOrShouldNotBeAbleToDownloadFileFromSpace( string $user, + string $shouldOrNot, string $fileName, string $spaceName - ):void { - $response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName, $this->featureContext->getPasswordForUser($user)); - Assert::assertGreaterThanOrEqual( - 400, - $response->getStatusCode(), - __METHOD__ - . ' download must fail' - ); - Assert::assertLessThanOrEqual( - 499, - $response->getStatusCode(), - __METHOD__ - . ' 4xx error expected but got status code "' - . $response->getStatusCode() . '"' + ): void { + $spaceId = $this->getSpaceIdByName($user, $spaceName); + $response = $this->featureContext->downloadFileAsUserUsingPassword( + $user, + $fileName, + $this->featureContext->getPasswordForUser($user), + null, + $spaceId ); + if ($shouldOrNot === 'should') { + $this->featureContext->theHTTPStatusCodeShouldBe( + 200, + __METHOD__ . "Expected response status code is 200 but got " . $response->getStatusCode(), + $response + ); + } else { + Assert::assertGreaterThanOrEqual( + 400, + $response->getStatusCode(), + __METHOD__ + . ' download must fail' + ); + Assert::assertLessThanOrEqual( + 499, + $response->getStatusCode(), + __METHOD__ + . ' 4xx error expected but got status code "' + . $response->getStatusCode() . '"' + ); + } } /** @@ -2009,9 +2114,13 @@ class SpacesContext implements Context { string $fromSpaceName, string $fileDestination, string $toSpaceName - ):void { + ): void { $space = $this->getSpaceByName($user, $fromSpaceName); - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $toSpaceName + ); $encodedName = \rawurlencode(ltrim($fileSource, "/")); $baseUrl = $this->featureContext->getBaseUrl(); @@ -2033,7 +2142,12 @@ class SpacesContext implements Context { * @return string * @throws GuzzleException */ - public function destinationHeaderValueWithSpaceName(string $user, string $fileDestination, string $spaceName, string $endPath = null):string { + public function destinationHeaderValueWithSpaceName( + string $user, + string $fileDestination, + string $spaceName, + string $endPath = null + ): string { $space = $this->getSpaceByName($user, $spaceName); $fileDestination = $this->escapePath(\ltrim($fileDestination, "/")); $baseUrl = $this->featureContext->getBaseUrl(); @@ -2075,7 +2189,14 @@ class SpacesContext implements Context { * @throws GuzzleException * @return void */ - public function userCopiesOrMovesFileWithIdAsIntoFolderInsideSpace(string $user, string $actionType, string $fileId, string $destinationFile, string $destinationFolder, string $toSpaceName): void { + public function userCopiesOrMovesFileWithIdAsIntoFolderInsideSpace( + string $user, + string $actionType, + string $fileId, + string $destinationFile, + string $destinationFolder, + string $toSpaceName + ): void { $destinationFile = \trim($destinationFile, "/"); $destinationFolder = \trim($destinationFolder, "/"); $fileDestination = $destinationFolder . '/' . $this->escapePath($destinationFile); @@ -2086,13 +2207,22 @@ class SpacesContext implements Context { $davPath = WebDavHelper::getDavPath($this->featureContext->getDavPathVersion()); $headers['Destination'] = "$baseUrl/$davPath/$sharesPath"; } else { - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName, $fileId); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $toSpaceName, + $fileId + ); } $fullUrl = "$baseUrl/$sourceDavPath/$fileId"; if ($actionType === 'copies') { - $this->featureContext->setResponse($this->copyFilesAndFoldersRequest($user, $fullUrl, $headers)); + $this->featureContext->setResponse( + $this->copyFilesAndFoldersRequest($user, $fullUrl, $headers) + ); } else { - $this->featureContext->setResponse($this->moveFilesAndFoldersRequest($user, $fullUrl, $headers)); + $this->featureContext->setResponse( + $this->moveFilesAndFoldersRequest($user, $fullUrl, $headers) + ); } } @@ -2124,7 +2254,12 @@ class SpacesContext implements Context { $davPath = WebDavHelper::getDavPath($this->featureContext->getDavPathVersion()); $headers['Destination'] = "$baseUrl/$davPath/$sharesPath"; } else { - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $spaceName, $fileId); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $spaceName, + $fileId + ); } $fullUrl = "$baseUrl/$sourceDavPath/$fileId"; $this->featureContext->setResponse($this->moveFilesAndFoldersRequest($user, $fullUrl, $headers)); @@ -2163,7 +2298,12 @@ class SpacesContext implements Context { $davPath = WebDavHelper::getDavPath($this->featureContext->getDavPathVersion()); $headers['Destination'] = "$baseUrl/$davPath/$sharesPath"; } else { - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $spaceName, $fileId); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $spaceName, + $fileId + ); } $fullUrl = "$baseUrl/$sourceDavPath/$fileId"; if ($actionType === 'copied') { @@ -2206,7 +2346,12 @@ class SpacesContext implements Context { $davPath = WebDavHelper::getDavPath($this->featureContext->getDavPathVersion()); $headers['Destination'] = "$baseUrl/$davPath/$sharesPath"; } else { - $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $spaceName, $fileId); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $spaceName, + $fileId + ); } $fullUrl = "$baseUrl/$sourceDavPath/$fileId"; $response = $this->moveFilesAndFoldersRequest($user, $fullUrl, $headers); @@ -2279,7 +2424,13 @@ class SpacesContext implements Context { $response = $this->listAllAvailableSpacesOfUser($user); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); $spaceId = $this->getSpaceIdByName($user, $spaceName); - $response = $this->featureContext->uploadFileWithContent($user, $fileContent, $destination, $spaceId, true); + $response = $this->featureContext->uploadFileWithContent( + $user, + $fileContent, + $destination, + $spaceId, + true + ); $this->featureContext->theHTTPStatusCodeShouldBe(['201', '204'], "", $response); return $response->getHeader('oc-fileid'); } @@ -2353,7 +2504,12 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function userExpiresTheShareOfSpaceForUser(string $user, string $shareType, string $spaceName, string $memberUser) { + public function userExpiresTheShareOfSpaceForUser( + string $user, + string $shareType, + string $spaceName, + string $memberUser + ) { $dateTime = new DateTime('yesterday'); $rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP'); $rows['shareWith'] = $memberUser; @@ -2472,10 +2628,12 @@ class SpacesContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function updateSharedResource(string $user, array $rows):ResponseInterface { - $shareId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() : $this->featureContext->getLastCreatedUserGroupShareId(); + public function updateSharedResource(string $user, array $rows): ResponseInterface { + $shareId = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() + : $this->featureContext->getLastCreatedUserGroupShareId(); $fullUrl = $this->featureContext->getBaseUrl() . $this->ocsApiUrl . '/' . $shareId; - return HttpRequestHelper::sendRequest( + return HttpRequestHelper::sendRequest( $fullUrl, $this->featureContext->getStepLineRef(), "PUT", @@ -2496,7 +2654,11 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException|JsonException */ - public function userExpiresTheLastShareOfResourceInsideOfTheSpace(string $user, string $resource, string $spaceName): void { + public function userExpiresTheLastShareOfResourceInsideOfTheSpace( + string $user, + string $resource, + string $spaceName + ): void { $dateTime = new DateTime('yesterday'); $rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP'); if ($this->featureContext->isUsingSharingNG()) { @@ -2541,7 +2703,8 @@ class SpacesContext implements Context { $rows["path"] = \array_key_exists("path", $rows) ? $rows["path"] : null; $rows["shareType"] = \array_key_exists("shareType", $rows) ? $rows["shareType"] : 3; $rows["permissions"] = \array_key_exists("permissions", $rows) ? $rows["permissions"] : null; - $rows['password'] = \array_key_exists('password', $rows) ? $this->featureContext->getActualPassword($rows['password']) : null; + $rows['password'] = \array_key_exists('password', $rows) + ? $this->featureContext->getActualPassword($rows['password']) : null; $rows["name"] = \array_key_exists("name", $rows) ? $rows["name"] : null; $rows["expireDate"] = \array_key_exists("expireDate", $rows) ? $rows["expireDate"] : null; @@ -2683,7 +2846,8 @@ class SpacesContext implements Context { string $recipient ): ResponseInterface { $space = $this->getSpaceByName($user, $spaceName); - $fullUrl = $this->featureContext->getBaseUrl() . $this->ocsApiUrl . "/" . $space['id'] . "?shareWith=" . $recipient; + $fullUrl = $this->featureContext->getBaseUrl() + . $this->ocsApiUrl . "/" . $space['id'] . "?shareWith=" . $recipient; return HttpRequestHelper::delete( $fullUrl, @@ -2773,7 +2937,7 @@ class SpacesContext implements Context { public function userHasDeletedASpaceOwnedByUser( string $user, string $spaceName - ):void { + ): void { $response = $this->deleteSpace($user, $spaceName); $this->featureContext->theHTTPStatusCodeShouldBe( 204, @@ -2996,7 +3160,11 @@ class SpacesContext implements Context { ): ResponseInterface { $space = $this->getSpaceByName($user, $spaceName); $baseUrl = $this->featureContext->getBaseUrl(); - $davPath = WebDavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $space["id"], "trash-bin"); + $davPath = WebDavHelper::getDavPath( + WebDavHelper::DAV_VERSION_SPACES, + $space["id"], + "trash-bin" + ); $fullUrl = "$baseUrl/$davPath"; return HttpRequestHelper::sendRequest( $fullUrl, @@ -3041,10 +3209,20 @@ class SpacesContext implements Context { // get space by admin user $space = $this->getSpaceByName($this->featureContext->getAdminUserName(), $spaceName); $baseUrl = $this->featureContext->getBaseUrl(); - $davPath = WebDavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $space["id"], "trash-bin"); + $davPath = WebDavHelper::getDavPath( + WebDavHelper::DAV_VERSION_SPACES, + $space["id"], + "trash-bin" + ); $fullUrl = "$baseUrl/$davPath"; $this->featureContext->setResponse( - HttpRequestHelper::sendRequest($fullUrl, $this->featureContext->getStepLineRef(), 'PROPFIND', $user, $this->featureContext->getPasswordForUser($user)) + HttpRequestHelper::sendRequest( + $fullUrl, + $this->featureContext->getStepLineRef(), + 'PROPFIND', + $user, + $this->featureContext->getPasswordForUser($user) + ) ); } @@ -3144,7 +3322,9 @@ class SpacesContext implements Context { } if ($pathToDeletedObject === "") { - throw new Exception(__METHOD__ . " Object '$object' was not found in the trashbin of space '$spaceName' by user '$user'"); + throw new Exception( + __METHOD__ . " Object '$object' was not found in the trashbin of space '$spaceName' by user '$user'" + ); } $baseUrl = $this->featureContext->getBaseUrl(); @@ -3193,7 +3373,9 @@ class SpacesContext implements Context { } if ($pathToDeletedObject === "") { - throw new Exception(__METHOD__ . " Object '$object' was not found in the trashbin of space '$spaceName' by user '$user'"); + throw new Exception( + __METHOD__ . " Object '$object' was not found in the trashbin of space '$spaceName' by user '$user'" + ); } $fullUrl = $this->featureContext->getBaseUrl() . $pathToDeletedObject; @@ -3272,7 +3454,13 @@ class SpacesContext implements Context { string $spaceName ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); - $response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName, $this->featureContext->getPasswordForUser($user), [], $spaceId); + $response = $this->featureContext->downloadFileAsUserUsingPassword( + $user, + $fileName, + $this->featureContext->getPasswordForUser($user), + [], + $spaceId + ); $this->featureContext->setResponse($response); } @@ -3292,7 +3480,9 @@ class SpacesContext implements Context { string $spaceName ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); - $this->featureContext->setResponse($this->checksumContext->propfindResourceChecksum($user, $path, $spaceId)); + $this->featureContext->setResponse( + $this->checksumContext->propfindResourceChecksum($user, $path, $spaceId) + ); } /** @@ -3316,7 +3506,14 @@ class SpacesContext implements Context { ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); $this->featureContext->setResponse( - $this->featureContext->uploadFileWithChecksumAndContent($user, $checksum, $content, $destination, false, $spaceId) + $this->featureContext->uploadFileWithChecksumAndContent( + $user, + $checksum, + $content, + $destination, + false, + $spaceId + ) ); } @@ -3339,7 +3536,9 @@ class SpacesContext implements Context { string $spaceName ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); - $this->featureContext->setResponse($this->filesVersionsContext->downloadVersion($user, $fileName, $index, $spaceId)); + $this->featureContext->setResponse( + $this->filesVersionsContext->downloadVersion($user, $fileName, $index, $spaceId) + ); } /** @@ -3352,7 +3551,7 @@ class SpacesContext implements Context { * @return void * @throws Exception */ - public function userTriesToDownloadFileVersions(string $user, string $file, string $spaceName):void { + public function userTriesToDownloadFileVersions(string $user, string $file, string $spaceName): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); $this->featureContext->setResponse( $this->filesVersionsContext->getFileVersions($user, $file, null, $spaceId) @@ -3386,7 +3585,12 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function storeEtagOfElementInSpaceForUser(string $user, string $space, string $path, ?string $storePath = ""): void { + public function storeEtagOfElementInSpaceForUser( + string $user, + string $space, + string $path, + ?string $storePath = "" + ): void { if ($storePath === "") { $storePath = $path; } @@ -3451,11 +3655,13 @@ class SpacesContext implements Context { $storedEtag = $this->getStoredEtagForPathInSpaceOfAUser($user, $space, $path); if ($action === 'should' && $etag === $storedEtag) { $changedEtagCount++; - $changedEtagMessage .= "\nExpected etag of element '$path' for user '$user' in space '$space' to change, but it did not."; + $changedEtagMessage .= + "\nExpected etag of element '$path' for user '$user' in space '$space' to change, but it did not."; } if ($action === 'should not' && $etag !== $storedEtag) { $changedEtagCount++; - $changedEtagMessage .= "\nExpected etag of element '$path' for user '$user' in space '$space' to change, but it did not."; + $changedEtagMessage .= + "\nExpected etag of element '$path' for user '$user' in space '$space' to change, but it did not."; } } @@ -3472,7 +3678,7 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException | Exception */ - public function userHasStoredEtagOfElementFromSpace(string $user, string $path, string $space):void { + public function userHasStoredEtagOfElementFromSpace(string $user, string $path, string $space): void { $user = $this->featureContext->getActualUsername($user); $this->storeEtagOfElementInSpaceForUser( $user, @@ -3495,7 +3701,12 @@ class SpacesContext implements Context { * @return void * @throws Exception | GuzzleException */ - public function userHasStoredEtagOfElementOnPathFromSpace(string $user, string $path, string $storePath, string $space):void { + public function userHasStoredEtagOfElementOnPathFromSpace( + string $user, + string $path, + string $storePath, + string $space + ): void { $user = $this->featureContext->getActualUsername($user); $this->storeEtagOfElementInSpaceForUser( $user, @@ -3503,7 +3714,9 @@ class SpacesContext implements Context { $path, $storePath ); - if ($this->storedEtags[$user][$space][$storePath] === "" || $this->storedEtags[$user][$space][$storePath] === null) { + if ($this->storedEtags[$user][$space][$storePath] === "" + || $this->storedEtags[$user][$space][$storePath] === null + ) { throw new Exception("Expected stored etag to be some string but found null!"); } } @@ -3526,7 +3739,8 @@ class SpacesContext implements Context { $rows["shareType"] = \array_key_exists("shareType", $rows) ? $rows["shareType"] : 3; $rows["permissions"] = \array_key_exists("permissions", $rows) ? $rows["permissions"] : null; - $rows['password'] = \array_key_exists('password', $rows) ? $this->featureContext->getActualPassword($rows['password']) : null; + $rows['password'] = \array_key_exists('password', $rows) + ? $this->featureContext->getActualPassword($rows['password']) : null; $rows["name"] = \array_key_exists("name", $rows) ? $rows["name"] : null; $rows["expireDate"] = \array_key_exists("expireDate", $rows) ? $rows["expireDate"] : null; @@ -3549,7 +3763,9 @@ class SpacesContext implements Context { $this->featureContext->getStepLineRef() ); - $this->featureContext->addToCreatedPublicShares(HttpRequestHelper::getResponseXml($response, __METHOD__)->data); + $this->featureContext->addToCreatedPublicShares( + HttpRequestHelper::getResponseXml($response, __METHOD__)->data + ); return $response; } @@ -3639,16 +3855,25 @@ class SpacesContext implements Context { ); $should = ($shouldOrNot !== "not"); - $responseArray = json_decode(json_encode(HttpRequestHelper::getResponseXml($response, __METHOD__)->data), true, 512, JSON_THROW_ON_ERROR); + $responseArray = json_decode( + json_encode(HttpRequestHelper::getResponseXml($response, __METHOD__)->data), + true, + 512, + JSON_THROW_ON_ERROR + ); if ($should) { Assert::assertNotEmpty($responseArray, __METHOD__ . ' Response should contain a link, but it is empty'); foreach ($responseArray as $element) { if ($shareType === 'public link') { - $expectedLinkId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : (string) $this->featureContext->getLastCreatedPublicShare()->id; + $expectedLinkId = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : + (string) $this->featureContext->getLastCreatedPublicShare()->id; Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different"); } else { - $expectedShareId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() : (string)$this->featureContext->getLastCreatedUserGroupShareId(); + $expectedShareId = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() + : (string)$this->featureContext->getLastCreatedUserGroupShareId(); Assert::assertEquals($element["id"], $expectedShareId, "share IDs are different"); } } @@ -3674,9 +3899,14 @@ class SpacesContext implements Context { string $resourceName, string $spaceName, TableNode $propertiesTable - ):void { + ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); - $response = $this->webDavPropertiesContext->getPropertiesOfFolder($user, $resourceName, $spaceId, $propertiesTable); + $response = $this->webDavPropertiesContext->getPropertiesOfFolder( + $user, + $resourceName, + $spaceId, + $propertiesTable + ); $this->featureContext->setResponse($response); } @@ -3697,12 +3927,17 @@ class SpacesContext implements Context { string $resourceName, string $spaceName, TableNode $propertiesTable - ):void { + ): void { // NOTE: extracting properties occurs asynchronously // short wait is necessary before getting those properties sleep(2); $spaceId = $this->getSpaceIdByName($user, $spaceName); - $response = $this->webDavPropertiesContext->getPropertiesOfFolder($user, $resourceName, $spaceId, $propertiesTable); + $response = $this->webDavPropertiesContext->getPropertiesOfFolder( + $user, + $resourceName, + $spaceId, + $propertiesTable + ); $this->featureContext->setResponse($response); } @@ -3725,9 +3960,16 @@ class SpacesContext implements Context { string $spaceName, string $property, string $value - ):void { + ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); - $this->webDavPropertiesContext->checkPropertyOfAFolder($user, $resourceName, $property, $value, null, $spaceId); + $this->webDavPropertiesContext->checkPropertyOfAFolder( + $user, + $resourceName, + $property, + $value, + null, + $spaceId + ); } /** @@ -3740,9 +3982,19 @@ class SpacesContext implements Context { * * @return void */ - public function asUserFileOrFolderInsideSpaceShouldOrNotBeFavorited(string $user, string $path, string $spaceName, string $shouldOrNot):void { + public function asUserFileOrFolderInsideSpaceShouldOrNotBeFavorited( + string $user, + string $path, + string $spaceName, + string $shouldOrNot + ): void { $spaceId = $this->getSpaceIdByName($user, $spaceName); - $this->favoritesContext->asUserFileOrFolderShouldBeFavorited($user, $path, ($shouldOrNot === 'should') ? 1 : 0, $spaceId); + $this->favoritesContext->asUserFileOrFolderShouldBeFavorited( + $user, + $path, + ($shouldOrNot === 'should') ? 1 : 0, + $spaceId + ); } /** @@ -3789,7 +4041,12 @@ class SpacesContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function userFolderOfTheSpaceShouldHaveThePreviouslyStoredId(string $user, string $fileOrFolder, string $path, string $spaceName): void { + public function userFolderOfTheSpaceShouldHaveThePreviouslyStoredId( + string $user, + string $fileOrFolder, + string $path, + string $spaceName + ): void { $this->getSpaceIdByName($user, $spaceName); $user = $this->featureContext->getActualUsername($user); $currentFileID = $this->featureContext->getFileIdForPath($user, $path); @@ -3798,7 +4055,8 @@ class SpacesContext implements Context { $currentFileID, $storedFileID, __METHOD__ - . " User '$user' $fileOrFolder '$path' does not have the previously stored id '$storedFileID', but has '$currentFileID'." + . " User '$user' $fileOrFolder '$path' does not have the previously stored id '" + . $storedFileID . "', but has '$currentFileID'." ); } @@ -3813,7 +4071,14 @@ class SpacesContext implements Context { */ public function searchResultShouldContainSpace(string $user, string $spaceName): void { // get a response after a Report request (called in the core) - $responseArray = json_decode(json_encode(HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath("//d:response/d:href")), true, 512, JSON_THROW_ON_ERROR); + $responseArray = json_decode( + json_encode( + HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath("//d:response/d:href") + ), + true, + 512, + JSON_THROW_ON_ERROR + ); Assert::assertNotEmpty($responseArray, "search result is empty"); // for mountpoint, id looks a little different than for project space @@ -3857,7 +4122,11 @@ class SpacesContext implements Context { * * @throws GuzzleException */ - public function userSendsPropfindRequestToSpaceUsingTheWebdavApi(string $user, string $spaceName, ?string $folderDepth = "1"): void { + public function userSendsPropfindRequestToSpaceUsingTheWebdavApi( + string $user, + string $spaceName, + ?string $folderDepth = "1" + ): void { $this->featureContext->setResponse( $this->sendPropfindRequestToSpace($user, $spaceName, "", null, $folderDepth) ); @@ -3878,7 +4147,12 @@ class SpacesContext implements Context { * * @throws GuzzleException */ - public function userSendsPropfindRequestFromTheSpaceToTheResourceWithDepthUsingTheWebdavApi(string $user, string $spaceName, string $resource, ?string $folderDepth = "1"): void { + public function userSendsPropfindRequestFromTheSpaceToTheResourceWithDepthUsingTheWebdavApi( + string $user, + string $spaceName, + string $resource, + ?string $folderDepth = "1" + ): void { $response = $this->sendPropfindRequestToSpace($user, $spaceName, $resource, null, $folderDepth); $this->featureContext->setResponse($response); } @@ -3896,7 +4170,11 @@ class SpacesContext implements Context { * * @throws GuzzleException */ - public function userSendsPropfindRequestToSpaceWithHeaders(string $user, string $spaceName, TableNode $headersTable): void { + public function userSendsPropfindRequestToSpaceWithHeaders( + string $user, + string $spaceName, + TableNode $headersTable + ): void { $this->featureContext->verifyTableNodeColumns( $headersTable, ['header', 'value'] @@ -3922,7 +4200,13 @@ class SpacesContext implements Context { * * @throws JsonException */ - public function sendPropfindRequestToSpace(string $user, string $spaceName, ?string $resource = "", ?array $headers = [], ?string $folderDepth = "1"): ResponseInterface { + public function sendPropfindRequestToSpace( + string $user, + string $spaceName, + ?string $resource = "", + ?array $headers = [], + ?string $folderDepth = "1" + ): ResponseInterface { $spaceId = $this->getSpaceIdByName($user, $spaceName); $properties = [ 'oc:id', @@ -3956,7 +4240,7 @@ class SpacesContext implements Context { } } - return WebDavHelper::propfind( + return WebDavHelper::propfind( $this->featureContext->getBaseUrl(), $this->featureContext->getActualUsername($user), $this->featureContext->getPasswordForUser($user), @@ -3984,7 +4268,12 @@ class SpacesContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function asUsertheXMLResponseShouldContainMountpointWithTheseKeyAndValuePair(string $user, string $type, string $resource, TableNode $table): void { + public function asUsertheXMLResponseShouldContainMountpointWithTheseKeyAndValuePair( + string $user, + string $type, + string $resource, + TableNode $table + ): void { $this->featureContext->verifyTableNodeColumns($table, ['key', 'value']); if ($this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES && $type === 'space') { $space = $this->getSpaceByName($user, $resource); @@ -4006,7 +4295,11 @@ class SpacesContext implements Context { * * @return string */ - public function buildXpathErrorMessage(SimpleXMLElement $responseXmlObject, array $xpaths, string $message): string { + public function buildXpathErrorMessage( + SimpleXMLElement $responseXmlObject, + array $xpaths, + string $message + ): string { return "Using xpaths:\n\t- " . \join("\n\t- ", $xpaths) . "\n" . $message @@ -4022,7 +4315,11 @@ class SpacesContext implements Context { * @return string * @throws Exception */ - public function getXpathSiblingValue(SimpleXMLElement $responseXmlObject, string $siblingXpath, string $siblingToFind): string { + public function getXpathSiblingValue( + SimpleXMLElement $responseXmlObject, + string $siblingXpath, + string $siblingToFind + ): string { $xpaths[] = $siblingXpath . "/preceding-sibling::$siblingToFind"; $xpaths[] = $siblingXpath . "/following-sibling::$siblingToFind"; @@ -4032,7 +4329,11 @@ class SpacesContext implements Context { break; } } - $errorMessage = $this->buildXpathErrorMessage($responseXmlObject, $xpaths, "Could not find sibling '<$siblingToFind>' element in the XML response"); + $errorMessage = $this->buildXpathErrorMessage( + $responseXmlObject, + $xpaths, + "Could not find sibling '<$siblingToFind>' element in the XML response" + ); Assert::assertNotEmpty($foundSibling, $errorMessage); return \preg_quote($foundSibling[0]->__toString(), "/"); } @@ -4067,10 +4368,15 @@ class SpacesContext implements Context { if ($property['key'] === 'oc:name') { $xpath = "//oc:name[text()='$decodedResource']"; } elseif (\array_key_exists('oc:shareroot', $properties)) { - $xpaths[] = "//oc:name[text()='$resource']/preceding-sibling::oc:shareroot[text()='" . $properties['oc:shareroot'] . "'/preceding-sibling::/"; - $xpaths[] = "//oc:name[text()='$resource']/preceding-sibling::oc:shareroot[text()='" . $properties['oc:shareroot'] . "'/following-sibling::/"; - $xpaths[] = "//oc:name[text()='$resource']/following-sibling::oc:shareroot[text()='" . $properties['oc:shareroot'] . "'/preceding-sibling::/"; - $xpaths[] = "//oc:name[text()='$resource']/following-sibling::oc:shareroot[text()='" . $properties['oc:shareroot'] . "'/following-sibling::/"; + $xpaths[] = "//oc:name[text()='$resource']/preceding-sibling::oc:shareroot[text()='" + . $properties['oc:shareroot'] . "'/preceding-sibling::/"; + $xpaths[] = "//oc:name[text()='$resource']/preceding-sibling::oc:shareroot[text()='" + . $properties['oc:shareroot'] . "'/following-sibling::/"; + $xpaths[] = "//oc:name[text()='$resource']/following-sibling::oc:shareroot[text()='" + + . $properties['oc:shareroot'] . "'/preceding-sibling::/"; + $xpaths[] = "//oc:name[text()='$resource']/following-sibling::oc:shareroot[text()='" + . $properties['oc:shareroot'] . "'/following-sibling::/"; } else { $xpaths[] = "//oc:name[text()='$decodedResource']/preceding-sibling::"; $xpaths[] = "//oc:name[text()='$decodedResource']/following-sibling::"; @@ -4097,11 +4403,19 @@ class SpacesContext implements Context { Assert::assertCount( 1, $foundXmlItem, - $this->buildXpathErrorMessage($responseXmlObject, $xpaths, "Found multiple elements for '<$itemToFind>' in the XML response") + $this->buildXpathErrorMessage( + $responseXmlObject, + $xpaths, + "Found multiple elements for '<$itemToFind>' in the XML response" + ) ); Assert::assertNotEmpty( $foundXmlItem, - $this->buildXpathErrorMessage($responseXmlObject, $xpaths, "Could not find '<$itemToFind>' element in the XML response") + $this->buildXpathErrorMessage( + $responseXmlObject, + $xpaths, + "Could not find '<$itemToFind>' element in the XML response" + ) ); $actualValue = $foundXmlItem[0]->__toString(); @@ -4131,15 +4445,27 @@ class SpacesContext implements Context { switch ($itemToFind) { case "oc:fileid": $expectedValue = GraphHelper::jsonSchemaRegexToPureRegex($expectedValue); - Assert::assertMatchesRegularExpression($expectedValue, $actualValue, 'wrong "fileid" in the response'); + Assert::assertMatchesRegularExpression( + $expectedValue, + $actualValue, + 'wrong "fileid" in the response' + ); break; case "oc:file-parent": $expectedValue = GraphHelper::jsonSchemaRegexToPureRegex($expectedValue); - Assert::assertMatchesRegularExpression($expectedValue, $actualValue, 'wrong "file-parent" in the response'); + Assert::assertMatchesRegularExpression( + $expectedValue, + $actualValue, + 'wrong "file-parent" in the response' + ); break; case "oc:privatelink": $expectedValue = GraphHelper::jsonSchemaRegexToPureRegex($expectedValue); - Assert::assertMatchesRegularExpression($expectedValue, $actualValue, 'wrong "privatelink" in the response'); + Assert::assertMatchesRegularExpression( + $expectedValue, + $actualValue, + 'wrong "privatelink" in the response' + ); break; case "oc:tags": // The value should be a comma-separated string of tag names. @@ -4167,7 +4493,11 @@ class SpacesContext implements Context { break; case "oc:remote-item-id": $expectedValue = GraphHelper::jsonSchemaRegexToPureRegex($expectedValue); - Assert::assertMatchesRegularExpression($expectedValue, $actualValue, 'wrong "remote-item-id" in the response'); + Assert::assertMatchesRegularExpression( + $expectedValue, + $actualValue, + 'wrong "remote-item-id" in the response' + ); break; default: Assert::assertEquals($expectedValue, $actualValue, "wrong '$itemToFind' in the response"); @@ -4186,7 +4516,11 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function asUserTheKeyFromPropfindResponseShouldMatchWithSharedwithmeDriveitemidOfShare(string $user, string $key, string $resource): void { + public function asUserTheKeyFromPropfindResponseShouldMatchWithSharedwithmeDriveitemidOfShare( + string $user, + string $key, + string $resource + ): void { $responseXmlObject = HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__); $fileId = $responseXmlObject->xpath("//oc:name[text()='$resource']/preceding-sibling::$key")[0]->__toString(); @@ -4219,7 +4553,9 @@ class SpacesContext implements Context { * @throws Exception */ public function publicDownloadsTheFolderFromTheLastCreatedPublicLink(string $resource) { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $responseXmlObject = HttpRequestHelper::getResponseXml( $this->featureContext->listFolder( @@ -4293,14 +4629,26 @@ class SpacesContext implements Context { "Expected response status code should be 200", $response ); - Assert::assertIsArray($spaceAsArray = $this->getSpaceByNameFromResponse($spaceName, $response), "No space with name $spaceName found"); - $recipientType === 'user' ? $recipientId = $this->featureContext->getUserIdByUserName($recipient) : $recipientId = $this->featureContext->getGroupIdByGroupName($recipient); + Assert::assertIsArray( + $spaceAsArray = $this->getSpaceByNameFromResponse($spaceName, $response), + "No space with name $spaceName found" + ); + $recipientType === 'user' ? + $recipientId = $this->featureContext->getUserIdByUserName($recipient) + : $recipientId = $this->featureContext->getGroupIdByGroupName($recipient); $foundRoleInResponse = false; foreach ($spaceAsArray['root']['permissions'] as $permission) { - if (isset($permission['grantedToIdentities'][0][$recipientType]) && $permission['roles'][0] === $role && $permission['grantedToIdentities'][0][$recipientType]['id'] === $recipientId) { + if (isset($permission['grantedToIdentities'][0][$recipientType]) + && $permission['roles'][0] === $role + && $permission['grantedToIdentities'][0][$recipientType]['id'] === $recipientId + ) { $foundRoleInResponse = true; if ($expirationDate !== null && isset($permission['expirationDateTime'])) { - Assert::assertEquals($expirationDate, (preg_split("/[\sT]+/", $permission['expirationDateTime']))[0], "$expirationDate is different in the response"); + Assert::assertEquals( + $expirationDate, + (preg_split("/[\sT]+/", $permission['expirationDateTime']))[0], + "$expirationDate is different in the response" + ); } break; } @@ -4320,7 +4668,7 @@ class SpacesContext implements Context { * * @throws GuzzleException */ - public function userDownloadsTheSpaceUsingTheWebdavApi(string $user, string $spaceName, string $owner = ''):void { + public function userDownloadsTheSpaceUsingTheWebdavApi(string $user, string $spaceName, string $owner = ''): void { $space = $this->getSpaceByName($owner ?: $user, $spaceName); $url = $this->archiverContext->getArchiverUrl('id=' . $space['id']); $this->featureContext->setResponse( @@ -4344,7 +4692,12 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function userHasSharedResourceInsideSpaceWithUser(string $sharer, string $path, string $space, string $sharee): void { + public function userHasSharedResourceInsideSpaceWithUser( + string $sharer, + string $path, + string $space, + string $sharee + ): void { $sharer = $this->featureContext->getActualUsername($sharer); $resource_id = $this->getResourceId($sharer, $space, $path); $response = $this->featureContext->createShare( @@ -4367,7 +4720,8 @@ class SpacesContext implements Context { Assert::assertContainsEquals( $responseStatusCode, $statusCodes, - "OCS status code is not any of the expected values " . \implode(",", $statusCodes) . " got " . $responseStatusCode + "OCS status code is not any of the expected values " + . \implode(",", $statusCodes) . " got " . $responseStatusCode ); } @@ -4380,7 +4734,7 @@ class SpacesContext implements Context { * * @return void */ - public function userGetsTheDriveItemInSpace(string $user, string $file, string $space):void { + public function userGetsTheDriveItemInSpace(string $user, string $file, string $space): void { $spaceId = ($this->getSpaceByName($user, $space))["id"]; $itemId = ''; if ($space === "Shares") { diff --git a/tests/acceptance/bootstrap/SpacesTUSContext.php b/tests/acceptance/bootstrap/SpacesTUSContext.php index 7a6ed162125..a179244d7ef 100644 --- a/tests/acceptance/bootstrap/SpacesTUSContext.php +++ b/tests/acceptance/bootstrap/SpacesTUSContext.php @@ -61,7 +61,12 @@ class SpacesTUSContext implements Context { * @throws Exception * @throws GuzzleException */ - public function userHasUploadedFileViaTusInSpace(string $user, string $source, string $destination, string $spaceName): void { + public function userHasUploadedFileViaTusInSpace( + string $user, + string $source, + string $destination, + string $spaceName + ): void { $spaceId = $this->spacesContext->getSpaceIdByName($user, $spaceName); $this->tusContext->uploadFileUsingTus($user, $source, $destination, $spaceId); $this->featureContext->setLastUploadDeleteTime(\time()); @@ -175,7 +180,12 @@ class SpacesTUSContext implements Context { * @return void * @throws Exception|GuzzleException */ - public function userUploadsAFileWithContentToInsideFederatedShareViaTusUsingTheWebdavApi(string $user, string $content, string $file, string $destination): void { + public function userUploadsAFileWithContentToInsideFederatedShareViaTusUsingTheWebdavApi( + string $user, + string $content, + string $file, + string $destination + ): void { $remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $destination); $remoteItemId = \rawurlencode($remoteItemId); $tmpFile = $this->tusContext->writeDataToTempFile($content); @@ -293,8 +303,10 @@ class SpacesTUSContext implements Context { * * @return void * @throws Exception|GuzzleException + * @codingStandardsIgnoreStart */ public function userHasUploadedFileWithChecksumToTheLastCreatedTusLocationWithOffsetAndContentViaTusInsideOfTheSpaceUsingTheWebdavApi( + // @codingStandardsIgnoreEnd string $user, string $checksum, string $offset, @@ -317,8 +329,10 @@ class SpacesTUSContext implements Context { * * @return void * @throws Exception|GuzzleException + * @codingStandardsIgnoreStart */ public function userUploadsFileWithChecksumToTheLastCreatedTusLocationWithOffsetAndContentViaTusInsideOfTheSpaceUsingTheWebdavApi( + // @codingStandardsIgnoreEnd string $user, string $checksum, string $offset, @@ -341,8 +355,10 @@ class SpacesTUSContext implements Context { * * @return void * @throws Exception|GuzzleException + * @codingStandardsIgnoreStart */ public function userSendsAChunkToTheLastCreatedTusLocationWithOffsetAndDataWithChecksumViaTusInsideOfTheSpaceUsingTheWebdavApi( + // @codingStandardsIgnoreEnd string $user, string $offset, string $data, @@ -371,7 +387,14 @@ class SpacesTUSContext implements Context { ): void { $rows = $headers->getRowsHash(); $resourceLocation = $this->tusContext->getLastTusResourceLocation(); - $response = $this->tusContext->uploadChunkToTUSLocation($user, $resourceLocation, $rows['Upload-Offset'], $data, $rows['Upload-Checksum'], ['Origin' => $rows['Origin']]); + $response = $this->tusContext->uploadChunkToTUSLocation( + $user, + $resourceLocation, + $rows['Upload-Offset'], + $data, + $rows['Upload-Checksum'], + ['Origin' => $rows['Origin']] + ); $this->featureContext->setResponse($response); } @@ -387,8 +410,10 @@ class SpacesTUSContext implements Context { * * @return void * @throws GuzzleException + * @codingStandardsIgnoreStart */ public function userOverwritesRecentlySharedFileWithOffsetAndDataWithChecksumViaTusInsideOfTheSpaceUsingTheWebdavApiWithTheseHeaders( + // @codingStandardsIgnoreEnd string $user, string $offset, string $data, diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index 50640e76f39..4d023a0e01c 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -97,7 +97,12 @@ class TUSContext implements Context { * @throws Exception * @throws GuzzleException */ - public function createNewTUSResourceWithHeaders(string $user, TableNode $headersTable, string $content = '', ?string $spaceId = null): ResponseInterface { + public function createNewTUSResourceWithHeaders( + string $user, + TableNode $headersTable, + string $content = '', + ?string $spaceId = null + ): ResponseInterface { $this->featureContext->verifyTableNodeColumnsCount($headersTable, 2); $user = $this->featureContext->getActualUsername($user); $password = $this->featureContext->getUserPassword($user); @@ -163,7 +168,7 @@ class TUSContext implements Context { * * @return ResponseInterface */ - public function createNewTUSResource(string $user, TableNode $headers, ?string $spaceId = null):ResponseInterface { + public function createNewTUSResource(string $user, TableNode $headers, ?string $spaceId = null): ResponseInterface { $rows = $headers->getRows(); $rows[] = ['Tus-Resumable', '1.0.0']; return $this->createNewTUSResourceWithHeaders($user, new TableNode($rows), '', $spaceId); @@ -182,7 +187,14 @@ class TUSContext implements Context { * @throws GuzzleException * @throws JsonException */ - public function uploadChunkToTUSLocation(string $user, string $resourceLocation, string $offset, string $data, string $checksum = '', ?array $extraHeaders = null): ResponseInterface { + public function uploadChunkToTUSLocation( + string $user, + string $resourceLocation, + string $offset, + string $data, + string $checksum = '', + ?array $extraHeaders = null + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $password = $this->featureContext->getUserPassword($user); $headers = [ @@ -631,7 +643,12 @@ class TUSContext implements Context { * @return void * @throws Exception */ - public function userUploadsChunkFileWithChecksum(string $user, string $offset, string $data, string $checksum): void { + public function userUploadsChunkFileWithChecksum( + string $user, + string $offset, + string $data, + string $checksum + ): void { $resourceLocation = $this->getLastTusResourceLocation(); $response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum); $this->featureContext->setResponse($response); @@ -648,7 +665,12 @@ class TUSContext implements Context { * @return void * @throws Exception */ - public function userHasUploadedChunkFileWithChecksum(string $user, string $offset, string $data, string $checksum): void { + public function userHasUploadedChunkFileWithChecksum( + string $user, + string $offset, + string $data, + string $checksum + ): void { $resourceLocation = $this->getLastTusResourceLocation(); $response = $this->uploadChunkToTUSLocation($user, $resourceLocation, $offset, $data, $checksum); $this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response); @@ -669,7 +691,13 @@ class TUSContext implements Context { * @throws GuzzleException * @throws Exception */ - public function userOverwritesFileWithChecksum(string $user, string $offset, string $data, string $checksum, TableNode $headers): void { + public function userOverwritesFileWithChecksum( + string $user, + string $offset, + string $data, + string $checksum, + TableNode $headers + ): void { $createResponse = $this->createNewTUSResource($user, $headers); $this->featureContext->theHTTPStatusCodeShouldBe(201, "", $createResponse); $resourceLocation = $this->getLastTusResourceLocation(); diff --git a/tests/acceptance/bootstrap/TagContext.php b/tests/acceptance/bootstrap/TagContext.php index 678f39ab412..f057a02653d 100644 --- a/tests/acceptance/bootstrap/TagContext.php +++ b/tests/acceptance/bootstrap/TagContext.php @@ -64,7 +64,13 @@ class TagContext implements Context { * @return ResponseInterface * @throws Exception */ - public function createTags(string $user, string $fileOrFolder, string $resource, string $space, TableNode $table):ResponseInterface { + public function createTags( + string $user, + string $fileOrFolder, + string $resource, + string $space, + TableNode $table + ): ResponseInterface { $tagNameArray = []; foreach ($table->getRows() as $value) { $tagNameArray[] = $value[0]; @@ -97,7 +103,13 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function theUserCreatesFollowingTags(string $user, string $fileOrFolder, string $resource, string $space, TableNode $table):void { + public function theUserCreatesFollowingTags( + string $user, + string $fileOrFolder, + string $resource, + string $space, + TableNode $table + ): void { $response = $this->createTags($user, $fileOrFolder, $resource, $space, $table); $this->featureContext->setResponse($response); } @@ -114,7 +126,13 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function theUserHasCreatedFollowingTags(string $user, string $fileOrFolder, string $resource, string $space, TableNode $table):void { + public function theUserHasCreatedFollowingTags( + string $user, + string $fileOrFolder, + string $resource, + string $space, + TableNode $table + ): void { $response = $this->createTags($user, $fileOrFolder, $resource, $space, $table); $this->featureContext->theHttpStatusCodeShouldBe(200, "", $response); } @@ -130,7 +148,12 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function userHasCreatedTheFollowingTagsForFilesOfTheSpace(string $user, string $filesOrFolders, string $space, TableNode $table):void { + public function userHasCreatedTheFollowingTagsForFilesOfTheSpace( + string $user, + string $filesOrFolders, + string $space, + TableNode $table + ): void { $this->featureContext->verifyTableNodeColumns($table, ["path", "tagName"]); $rows = $table->getHash(); foreach ($rows as $row) { @@ -148,7 +171,7 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function theUserGetsAllAvailableTags(string $user):void { + public function theUserGetsAllAvailableTags(string $user): void { // Note: after creating or deleting tags, in some cases tags do not appear or disappear immediately, // So wait is necessary before listing tags sleep(5); @@ -171,10 +194,12 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function theFollowingTagsShouldExistForUser(string $shouldOrNot, TableNode $table):void { + public function theFollowingTagsShouldExistForUser(string $shouldOrNot, TableNode $table): void { $rows = $table->getRows(); foreach ($rows as $row) { - $responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['value']; + $responseArray = $this->featureContext->getJsonDecodedResponse( + $this->featureContext->getResponse() + )['value']; if ($shouldOrNot === "not") { Assert::assertFalse( \in_array($row[0], $responseArray), @@ -201,7 +226,13 @@ class TagContext implements Context { * @return ResponseInterface * @throws Exception */ - public function removeTagsFromResourceOfTheSpace(string $user, string $fileOrFolder, string $resource, string $space, TableNode $table):ResponseInterface { + public function removeTagsFromResourceOfTheSpace( + string $user, + string $fileOrFolder, + string $resource, + string $space, + TableNode $table + ): ResponseInterface { $tagNameArray = []; foreach ($table->getRows() as $value) { $tagNameArray[] = $value[0]; @@ -235,8 +266,20 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function userRemovesTagsFromResourceOfTheSpace(string $user, string $fileOrFolder, string $resource, string $space, TableNode $table):void { - $response = $this->removeTagsFromResourceOfTheSpace($user, $fileOrFolder, $resource, $space, $table); + public function userRemovesTagsFromResourceOfTheSpace( + string $user, + string $fileOrFolder, + string $resource, + string $space, + TableNode $table + ): void { + $response = $this->removeTagsFromResourceOfTheSpace( + $user, + $fileOrFolder, + $resource, + $space, + $table + ); $this->featureContext->setResponse($response); } @@ -252,7 +295,13 @@ class TagContext implements Context { * @return void * @throws Exception */ - public function userHAsRemovedTheFollowingTagsForFileOfSpace(string $user, string $fileOrFolder, string $resource, string $space, TableNode $table):void { + public function userHAsRemovedTheFollowingTagsForFileOfSpace( + string $user, + string $fileOrFolder, + string $resource, + string $space, + TableNode $table + ): void { $response = $this->removeTagsFromResourceOfTheSpace($user, $fileOrFolder, $resource, $space, $table); $this->featureContext->theHttpStatusCodeShouldBe(200, "", $response); } diff --git a/tests/acceptance/bootstrap/TrashbinContext.php b/tests/acceptance/bootstrap/TrashbinContext.php index cb657ff6415..c41b78a3c07 100644 --- a/tests/acceptance/bootstrap/TrashbinContext.php +++ b/tests/acceptance/bootstrap/TrashbinContext.php @@ -42,7 +42,7 @@ class TrashbinContext implements Context { * * @return ResponseInterface */ - public function emptyTrashbin(?string $user):ResponseInterface { + public function emptyTrashbin(?string $user): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $davPathVersion = $this->featureContext->getDavPathVersion(); return WebDavHelper::makeDavRequest( @@ -77,7 +77,7 @@ class TrashbinContext implements Context { * * @return void */ - public function userHasEmptiedTrashbin(string $user):void { + public function userHasEmptiedTrashbin(string $user): void { $response = $this->emptyTrashbin($user); $this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response); } @@ -109,7 +109,9 @@ class TrashbinContext implements Context { $name = $successPropStat->xpath('./d:prop/oc:trashbin-original-filename'); $mtime = $successPropStat->xpath('./d:prop/oc:trashbin-delete-timestamp'); $resourcetype = $successPropStat->xpath('./d:prop/d:resourcetype'); - if (\array_key_exists(0, $resourcetype) && ($resourcetype[0]->asXML() === "")) { + if (\array_key_exists(0, $resourcetype) + && ($resourcetype[0]->asXML() === "") + ) { $collection[0] = true; } else { $collection[0] = false; @@ -145,7 +147,7 @@ class TrashbinContext implements Context { * @return array response * @throws Exception */ - public function listTopOfTrashbinFolder(?string $user, string $depth = "1"):array { + public function listTopOfTrashbinFolder(?string $user, string $depth = "1"): array { $password = $this->featureContext->getPasswordForUser($user); $davPathVersion = $this->featureContext->getDavPathVersion(); @@ -205,7 +207,7 @@ class TrashbinContext implements Context { * @return array of all the items in the trashbin of the user * @throws Exception */ - public function listTrashbinFolder(?string $user, string $depth = "1"):array { + public function listTrashbinFolder(?string $user, string $depth = "1"): array { return $this->listTrashbinFolderCollection( $user, "", @@ -224,7 +226,12 @@ class TrashbinContext implements Context { * @return array response * @throws Exception */ - public function listTrashbinFolderCollection(?string $user, ?string $collectionPath = "", string $depth = "1", int $level = 1):array { + public function listTrashbinFolderCollection( + ?string $user, + ?string $collectionPath = "", + string $depth = "1", + int $level = 1 + ): array { // $collectionPath should be some list of file-ids like 2147497661/2147497662 // or the empty string, which will list the whole trashbin from the top. $collectionPath = \trim($collectionPath, "/"); @@ -251,7 +258,11 @@ class TrashbinContext implements Context { $response->getBody()->rewind(); $statusCode = $response->getStatusCode(); $respBody = $response->getBody()->getContents(); - Assert::assertEquals("207", $statusCode, "Expected status code to be '207' but got $statusCode \nResponse\n$respBody"); + Assert::assertEquals( + "207", + $statusCode, + "Expected status code to be '207' but got $statusCode \nResponse\n$respBody" + ); $files = $this->getTrashbinContentFromResponseXml( HttpRequestHelper::getResponseXml( @@ -331,7 +342,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function userGetsFilesInTheTrashbinWithDepthUsingTheWebdavApi(string $user, string $depth):void { + public function userGetsFilesInTheTrashbinWithDepthUsingTheWebdavApi(string $user, string $depth): void { $this->listTopOfTrashbinFolder($user, $depth); } @@ -343,9 +354,11 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table):void { + public function theTrashbinDavResponseShouldNotContainTheseNodes(TableNode $table): void { $this->featureContext->verifyTableNodeColumns($table, ['name']); - $files = $this->getTrashbinContentFromResponseXml(HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__)); + $files = $this->getTrashbinContentFromResponseXml( + HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__) + ); foreach ($table->getHash() as $row) { $path = trim((string)$row['name'], "/"); @@ -365,10 +378,12 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function theTrashbinDavResponseShouldContainTheseNodes(TableNode $table):void { + public function theTrashbinDavResponseShouldContainTheseNodes(TableNode $table): void { $this->featureContext->verifyTableNodeColumns($table, ['name']); - $files = $this->getTrashbinContentFromResponseXml(HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__)); + $files = $this->getTrashbinContentFromResponseXml( + HttpRequestHelper::getResponseXml($this->featureContext->getResponse(), __METHOD__) + ); foreach ($table->getHash() as $row) { $path = trim($row['name'], "/"); @@ -395,7 +410,11 @@ class TrashbinContext implements Context { * @return ResponseInterface * @throws Exception */ - public function sendTrashbinListRequest(string $user, ?string $asUser = null, ?string $password = null): ResponseInterface { + public function sendTrashbinListRequest( + string $user, + ?string $asUser = null, + ?string $password = null + ): ResponseInterface { $asUser = $asUser ?? $user; $password = $password ?? $this->featureContext->getPasswordForUser($asUser); @@ -445,7 +464,11 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function userTriesToListTheTrashbinContentForUserUsingPassword(string $asUser, string $user, string $password):void { + public function userTriesToListTheTrashbinContentForUserUsingPassword( + string $asUser, + string $user, + string $password + ): void { $response = $this->sendTrashbinListRequest($user, $asUser, $password); $this->featureContext->setResponse($response); } @@ -457,7 +480,7 @@ class TrashbinContext implements Context { * * @return void */ - public function theLastWebdavResponseShouldContainFollowingElements(TableNode $elements):void { + public function theLastWebdavResponseShouldContainFollowingElements(TableNode $elements): void { $files = $this->getTrashbinContentFromResponseXml(HttpRequestHelper::getResponseXml($response, __METHOD__)); $elementRows = $elements->getHash(); foreach ($elementRows as $expectedElement) { @@ -481,8 +504,10 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode $elements):void { - $files = $this->getTrashbinContentFromResponseXml(HttpRequestHelper::getResponseXml($this->featureContext->getResponse())); + public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode $elements): void { + $files = $this->getTrashbinContentFromResponseXml( + HttpRequestHelper::getResponseXml($this->featureContext->getResponse()) + ); // 'user' is also allowed in the table even though it is not used anywhere // This for better readability in feature files @@ -513,7 +538,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function userTriesToDeleteFromTrashbinOfUser(string $user, string $path, string $ofUser):void { + public function userTriesToDeleteFromTrashbinOfUser(string $user, string $path, string $ofUser): void { $response = $this->deleteItemFromTrashbin($user, $path, $ofUser); $this->featureContext->setResponse($response); } @@ -530,7 +555,12 @@ class TrashbinContext implements Context { * @throws JsonException * @throws Exception */ - public function userTriesToDeleteFromTrashbinOfUserUsingPassword(string $user, string $path, string $ofUser, string $password):void { + public function userTriesToDeleteFromTrashbinOfUserUsingPassword( + string $user, + string $path, + string $ofUser, + string $password + ): void { $response = $this->deleteItemFromTrashbin($user, $path, $ofUser, $password); $this->featureContext->setResponse($response); } @@ -546,7 +576,7 @@ class TrashbinContext implements Context { * @throws JsonException * @throws Exception */ - public function userTriesToRestoreFromTrashbinOfUser(?string $asUser, ?string $path, ?string $user):void { + public function userTriesToRestoreFromTrashbinOfUser(?string $asUser, ?string $path, ?string $user): void { $user = $this->featureContext->getActualUsername($user); $asUser = $this->featureContext->getActualUsername($asUser); $response = $this->restoreElement($user, $path, null, $asUser); @@ -565,7 +595,12 @@ class TrashbinContext implements Context { * @throws JsonException * @throws Exception */ - public function userTriesToRestoreFromTrashbinOfUserUsingPassword(?string $asUser, ?string $path, ?string $user, ?string $password):void { + public function userTriesToRestoreFromTrashbinOfUserUsingPassword( + ?string $asUser, + ?string $path, + ?string $user, + ?string $password + ): void { $asUser = $this->featureContext->getActualUsername($asUser); $user = $this->featureContext->getActualUsername($user); $response = $this->restoreElement($user, $path, null, $asUser, $password); @@ -579,7 +614,7 @@ class TrashbinContext implements Context { * * @return string */ - private function convertTrashbinHref(string $href):string { + private function convertTrashbinHref(string $href): string { $trashItemHRef = \trim($href, '/'); $trashItemHRef = \strstr($trashItemHRef, '/trash-bin'); $trashItemHRef = \trim($trashItemHRef, '/'); @@ -596,7 +631,10 @@ class TrashbinContext implements Context { * * @return void */ - public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(string $user, string $originalPath):void { + public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI( + string $user, + string $originalPath + ): void { $response = $this->deleteItemFromTrashbin($user, $originalPath); $this->featureContext->setResponse($response); } @@ -609,7 +647,12 @@ class TrashbinContext implements Context { * * @return ResponseInterface */ - public function deleteItemFromTrashbin(string $user, string $originalPath, ?string $ofUser = null, ?string $password = null): ResponseInterface { + public function deleteItemFromTrashbin( + string $user, + string $originalPath, + ?string $ofUser = null, + ?string $password = null + ): ResponseInterface { $ofUser = $ofUser ?? $user; $user = $this->featureContext->getActualUsername($user); $ofUser = $this->featureContext->getActualUsername($ofUser); @@ -656,7 +699,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function deleteFileFromTrashbin(string $user, string $originalPath):void { + public function deleteFileFromTrashbin(string $user, string $originalPath): void { $response = $this->deleteItemFromTrashbin($user, $originalPath); $this->featureContext->setResponse($response); $this->featureContext->pushToLastStatusCodesArrays(); @@ -671,7 +714,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function userHasDeletedTheFolderWithOriginalPathFromTheTrashbin(string $user, string $originalPath):void { + public function userHasDeletedTheFolderWithOriginalPathFromTheTrashbin(string $user, string $originalPath): void { $response = $this->deleteItemFromTrashbin($user, $originalPath); $this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response); } @@ -685,7 +728,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function deleteFollowingFilesFromTrashbin(string $user, TableNode $table):void { + public function deleteFollowingFilesFromTrashbin(string $user, TableNode $table): void { $this->featureContext->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -706,7 +749,7 @@ class TrashbinContext implements Context { * @throws JsonException * @throws Exception */ - public function asFileOrFolderExistsInTrash(?string $user, ?string $path):void { + public function asFileOrFolderExistsInTrash(?string $user, ?string $path): void { $user = $this->featureContext->getActualUsername($user); $path = \trim($path, '/'); $sections = \explode('/', $path, 2); @@ -756,7 +799,7 @@ class TrashbinContext implements Context { * @return bool * @throws Exception */ - private function isInTrash(?string $user, ?string $originalPath):bool { + private function isInTrash(?string $user, ?string $originalPath): bool { $listing = $this->listTrashbinFolder($user); // we don't care if the test step writes a leading "/" or not @@ -781,7 +824,13 @@ class TrashbinContext implements Context { * @throws JsonException * @throws GuzzleException */ - private function sendUndeleteRequest(string $user, string $trashItemHRef, string $destinationPath, ?string $asUser = null, ?string $password = null):ResponseInterface { + private function sendUndeleteRequest( + string $user, + string $trashItemHRef, + string $destinationPath, + ?string $asUser = null, + ?string $password = null + ): ResponseInterface { $asUser = $asUser ?? $user; $password = $password ?? $this->featureContext->getPasswordForUser($asUser); $destinationPath = \trim($destinationPath, '/'); @@ -834,7 +883,13 @@ class TrashbinContext implements Context { * @throws JsonException * @throws GuzzleException */ - private function restoreElement(string $user, string $originalPath, ?string $destinationPath = null, ?string $asUser = null, ?string $password = null):ResponseInterface { + private function restoreElement( + string $user, + string $originalPath, + ?string $destinationPath = null, + ?string $asUser = null, + ?string $password = null + ): ResponseInterface { $asUser = $asUser ?? $user; $listing = $this->listTrashbinFolder($user); $originalPath = \trim($originalPath, '/'); @@ -870,7 +925,10 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function userRestoresResourceWithOriginalPathWithoutSpecifyingDestinationUsingTrashbinApi(string $user, string $originalPath):void { + public function userRestoresResourceWithOriginalPathWithoutSpecifyingDestinationUsingTrashbinApi( + string $user, + string $originalPath + ): void { $listing = $this->listTrashbinFolder($user); $originalPath = \trim($originalPath, '/'); @@ -912,7 +970,7 @@ class TrashbinContext implements Context { ?string $user, ?string $content, ?string $alternativeContent - ):void { + ): void { $isInTrash = $this->isInTrash($user, $fileName); $user = $this->featureContext->getActualUsername($user); $response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName); @@ -933,7 +991,7 @@ class TrashbinContext implements Context { * @throws JsonException * @throws Exception */ - public function elementInTrashIsRestored(?string $user, string $originalPath):void { + public function elementInTrashIsRestored(?string $user, string $originalPath): void { $user = $this->featureContext->getActualUsername($user); $this->featureContext->setResponse($this->restoreElement($user, $originalPath)); } @@ -947,7 +1005,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function userRestoresFollowingFiles(string $user, TableNode $table):void { + public function userRestoresFollowingFiles(string $user, TableNode $table): void { $this->featureContext->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -967,7 +1025,7 @@ class TrashbinContext implements Context { * @return void * @throws Exception */ - public function elementInTrashHasBeenRestored(string $user, string $originalPath):void { + public function elementInTrashHasBeenRestored(string $user, string $originalPath): void { $response = $this->restoreElement($user, $originalPath); $this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response); if ($this->isInTrash($user, $originalPath)) { @@ -990,7 +1048,7 @@ class TrashbinContext implements Context { ?string $user, ?string $originalPath, ?string $destinationPath - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $this->featureContext->setResponse($this->restoreElement($user, $originalPath, $destinationPath)); } @@ -1008,7 +1066,7 @@ class TrashbinContext implements Context { public function elementIsInTrashCheckingOriginalPath( ?string $user, ?string $originalPath - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); Assert::assertTrue( $this->isInTrash($user, $originalPath), @@ -1028,7 +1086,7 @@ class TrashbinContext implements Context { public function elementIsNotInTrashCheckingOriginalPath( ?string $user, string $originalPath - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); Assert::assertFalse( $this->isInTrash($user, $originalPath), @@ -1048,7 +1106,7 @@ class TrashbinContext implements Context { public function followingElementsAreNotInTrashCheckingOriginalPath( string $user, TableNode $table - ):void { + ): void { $this->featureContext->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -1073,7 +1131,7 @@ class TrashbinContext implements Context { public function followingElementsAreInTrashCheckingOriginalPath( string $user, TableNode $table - ):void { + ): void { $this->featureContext->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -1095,7 +1153,7 @@ class TrashbinContext implements Context { * @return array|null real entry name with timestamp suffix or null if not found * @throws Exception */ - private function findFirstTrashedEntry(string $user, string $name):?array { + private function findFirstTrashedEntry(string $user, string $name): ?array { $listing = $this->listTrashbinFolder($user); foreach ($listing as $entry) { @@ -1117,7 +1175,7 @@ class TrashbinContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context @@ -1131,7 +1189,7 @@ class TrashbinContext implements Context { * * @return void */ - public function theDeletedFileFolderShouldHaveCorrectDeletionMtimeInTheResponse(string $resource):void { + public function theDeletedFileFolderShouldHaveCorrectDeletionMtimeInTheResponse(string $resource): void { $files = $this->getTrashbinContentFromResponseXml( HttpRequestHelper::getResponseXml($this->featureContext->getResponse()) ); diff --git a/tests/acceptance/bootstrap/WebDav.php b/tests/acceptance/bootstrap/WebDav.php index 5d0b0b12764..43f5df92d28 100644 --- a/tests/acceptance/bootstrap/WebDav.php +++ b/tests/acceptance/bootstrap/WebDav.php @@ -99,21 +99,21 @@ trait WebDav { /** * @return void */ - public function davPropfindDepthInfinityEnabled():void { + public function davPropfindDepthInfinityEnabled(): void { $this->davPropfindDepthInfinityEnabled = true; } /** * @return void */ - public function davPropfindDepthInfinityDisabled():void { + public function davPropfindDepthInfinityDisabled(): void { $this->davPropfindDepthInfinityEnabled = false; } /** * @return bool */ - public function davPropfindDepthInfinityIsEnabled():bool { + public function davPropfindDepthInfinityIsEnabled(): bool { return $this->davPropfindDepthInfinityEnabled; } @@ -122,14 +122,14 @@ trait WebDav { * * @return void */ - public function setLastUploadDeleteTime(int $lastUploadDeleteTime):void { + public function setLastUploadDeleteTime(int $lastUploadDeleteTime): void { $this->lastUploadDeleteTime = $lastUploadDeleteTime; } /** * @return number */ - public function getLastUploadDeleteTime():int { + public function getLastUploadDeleteTime(): int { return $this->lastUploadDeleteTime; } @@ -138,14 +138,14 @@ trait WebDav { * * @return void */ - public function setStoredFileID(string $fileID):void { + public function setStoredFileID(string $fileID): void { $this->storedFileID = $fileID; } /** * @return string */ - public function getStoredFileID():string { + public function getStoredFileID(): string { return $this->storedFileID; } @@ -185,7 +185,7 @@ trait WebDav { * * @return void */ - public function usingOldOrNewOrSpacesDavPath(string $davChoice):void { + public function usingOldOrNewOrSpacesDavPath(string $davChoice): void { switch ($davChoice) { case 'old': $this->currentDAVPath = WebDavHelper::DAV_VERSION_OLD; @@ -198,7 +198,6 @@ trait WebDav { break; default: throw new Exception("Invalid DAV path: $davChoice"); - break; } } @@ -213,7 +212,7 @@ trait WebDav { * @return string * @throws GuzzleException */ - public function getFullDavFilesPath(string $user, ?string $spaceId = null):string { + public function getFullDavFilesPath(string $user, ?string $spaceId = null): string { if ($spaceId === null && $this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) { $spaceId = WebDavHelper::getPersonalSpaceIdForUser( $this->getBaseUrl(), @@ -240,7 +239,7 @@ trait WebDav { * * @return string */ - public function getPublicLinkDavPath(string $token):string { + public function getPublicLinkDavPath(string $token): string { $davPath = WebDavHelper::getDavPath($this->getDavPathVersion(), $token, "public-files"); $path = "{$this->getBasePath()}/$davPath"; $path = WebDavHelper::sanitizeUrl($path); @@ -257,7 +256,7 @@ trait WebDav { * * @return int DAV path version (1, 2 or 3) selected, or appropriate for the endpoint */ - public function getDavPathVersion(?string $for = null):?int { + public function getDavPathVersion(?string $for = null): ?int { if (\in_array($for, ['systemtags', 'file_versions'])) { // 'systemtags' only exists since new DAV // 'file_versions' only exists since new DAV @@ -301,7 +300,7 @@ trait WebDav { ?array $urlParameter = [], ?string $doDavRequestAsUser = null, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); if ($davPathVersion === null) { @@ -349,7 +348,13 @@ trait WebDav { * @throws JsonException | GuzzleException * @throws GuzzleException | JsonException */ - public function createFolder(string $user, string $folder, ?bool $isGivenStep = false, ?string $password = null, ?string $spaceId=null): ResponseInterface { + public function createFolder( + string $user, + string $folder, + ?bool $isGivenStep = false, + ?string $password = null, + ?string $spaceId=null + ): ResponseInterface { return $this->makeDavRequest( $user, "MKCOL", @@ -377,7 +382,13 @@ trait WebDav { * @return ResponseInterface * @throws GuzzleException */ - public function downloadPreviews(string $user, ?string $path, ?string $doDavRequestAsUser, ?string $width, ?string $height):ResponseInterface { + public function downloadPreviews( + string $user, + ?string $path, + ?string $doDavRequestAsUser, + ?string $width, + ?string $height + ): ResponseInterface { $user = $this->getActualUsername($user); $doDavRequestAsUser = $this->getActualUsername($doDavRequestAsUser); $doDavRequestAsUser = $doDavRequestAsUser ?? $user; @@ -411,7 +422,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theNumberOfVersionsShouldBe(int $number):void { + public function theNumberOfVersionsShouldBe(int $number): void { $responseXmlObject = HttpRequestHelper::getResponseXml($this->getResponse(), __METHOD__); $xmlPart = $responseXmlObject->xpath("//d:getlastmodified"); $actualNumber = \count($xmlPart); @@ -430,7 +441,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theNumberOfEtagElementInTheResponseShouldBe(int $number):void { + public function theNumberOfEtagElementInTheResponseShouldBe(int $number): void { $responseXmlObject = HttpRequestHelper::getResponseXml($this->getResponse()); $xmlPart = $responseXmlObject->xpath("//d:getetag"); $actualNumber = \count($xmlPart); @@ -448,7 +459,7 @@ trait WebDav { * @return string * @throws GuzzleException */ - public function destinationHeaderValue(string $user, string $fileDestination):string { + public function destinationHeaderValue(string $user, string $fileDestination): string { $fileDestination = \ltrim($fileDestination, "/"); $spaceId = $this->getPersonalSpaceIdForUser($user); // If the destination is a share, we need to get the space ID for the Shares space @@ -483,7 +494,7 @@ trait WebDav { ?string $user, ?string $fileSource, ?string $fileDestination - ):void { + ): void { $response = $this->moveResource($user, $fileSource, $fileDestination); $actualStatusCode = $response->getStatusCode(); $this->theHTTPStatusCodeShouldBe( @@ -531,7 +542,7 @@ trait WebDav { string $user, string $source, string $destination - ):void { + ): void { $response = $this->moveResource($user, $source, $destination); $this->setResponse($response); $this->pushToLastHttpStatusCodesArray(); @@ -546,7 +557,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userMovesTheFollowingFileUsingTheWebdavApi(string $user, TableNode $table):void { + public function userMovesTheFollowingFileUsingTheWebdavApi(string $user, TableNode $table): void { $this->verifyTableNodeColumns($table, ["source", "destination"]); $rows = $table->getHash(); foreach ($rows as $row) { @@ -572,7 +583,7 @@ trait WebDav { string $user, string $type, TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["from", "to"]); $paths = $table->getHash(); @@ -595,7 +606,12 @@ trait WebDav { * @return void * @throws Exception */ - public function theUserShouldBeAbleToRenameEntryTo(string $user, string $entry, string $source, string $destination):void { + public function theUserShouldBeAbleToRenameEntryTo( + string $user, + string $entry, + string $source, + string $destination + ): void { $user = $this->getActualUsername($user); $this->checkFileOrFolderExistsForUser($user, $entry, $source); $response = $this->moveResource($user, $source, $destination); @@ -615,7 +631,12 @@ trait WebDav { * @return void * @throws Exception */ - public function theUserShouldNotBeAbleToRenameEntryTo(string $user, string $entry, string $source, string $destination):void { + public function theUserShouldNotBeAbleToRenameEntryTo( + string $user, + string $entry, + string $source, + string $destination + ): void { $this->checkFileOrFolderExistsForUser($user, $entry, $source); $response = $this->moveResource($user, $source, $destination); $this->theHTTPStatusCodeShouldBeBetween(400, 499, $response); @@ -634,7 +655,7 @@ trait WebDav { string $user, string $fileSource, string $fileDestination - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $headers['Destination'] = $this->destinationHeaderValue( $user, @@ -661,7 +682,7 @@ trait WebDav { string $user, string $fileSource, string $fileDestination - ):void { + ): void { $response = $this->copyFile($user, $fileSource, $fileDestination); $this->setResponse($response); $this->pushToLastHttpStatusCodesArray(); @@ -680,11 +701,12 @@ trait WebDav { string $user, string $fileSource, string $fileDestination - ):void { + ): void { $response = $this->copyFile($user, $fileSource, $fileDestination); $this->theHTTPStatusCodeShouldBe( ["201", "204"], - "HTTP status code was not 201 or 204 while trying to copy resource '$fileSource' to '$fileDestination' for user '$user'", + "HTTP status code was not 201 or 204 while trying to copy resource " + . "'$fileSource' to '$fileDestination' for user '$user'", $response ); } @@ -696,7 +718,7 @@ trait WebDav { * * @return ResponseInterface */ - public function downloadFileWithRange(string $user, string $fileSource, string $range):ResponseInterface { + public function downloadFileWithRange(string $user, string $fileSource, string $range): ResponseInterface { $user = $this->getActualUsername($user); $headers['Range'] = $range; return $this->makeDavRequest( @@ -716,7 +738,7 @@ trait WebDav { * * @return void */ - public function userDownloadsFileWithRangeUsingWebDavApi(string $user, string $fileSource, string $range):void { + public function userDownloadsFileWithRangeUsingWebDavApi(string $user, string $fileSource, string $range): void { $this->setResponse($this->downloadFileWithRange($user, $fileSource, $range)); } @@ -733,7 +755,7 @@ trait WebDav { string $user, string $password, string $fileName - ):void { + ): void { $user = $this->getActualUsername($user); $password = $this->getActualPassword($password); $response = $this->downloadFileAsUserUsingPassword($user, $fileName, $password); @@ -764,7 +786,7 @@ trait WebDav { public function userShouldNotBeAbleToDownloadFile( string $user, string $fileName - ):void { + ): void { $user = $this->getActualUsername($user); $password = $this->getPasswordForUser($user); $response = $this->downloadFileAsUserUsingPassword($user, $fileName, $password); @@ -790,7 +812,7 @@ trait WebDav { * * @return void */ - public function sizeOfDownloadedFileShouldBe(string $size):void { + public function sizeOfDownloadedFileShouldBe(string $size): void { $actualSize = \strlen((string) $this->response->getBody()); Assert::assertEquals( $size, @@ -806,7 +828,7 @@ trait WebDav { * * @return void */ - public function downloadedContentShouldEndWith(string $content):void { + public function downloadedContentShouldEndWith(string $content): void { $actualContent = \substr((string) $this->response->getBody(), -\strlen($content)); Assert::assertEquals( $content, @@ -822,7 +844,7 @@ trait WebDav { * * @return void */ - public function downloadedContentShouldBe(string $content):void { + public function downloadedContentShouldBe(string $content): void { $this->checkDownloadedContentMatches($content, '', $this->getResponse()); } @@ -837,7 +859,7 @@ trait WebDav { string $expectedContent, string $extraErrorText = "", ?ResponseInterface $response = null - ):void { + ): void { $response = $response ?? $this->response; $actualContent = (string) $response->getBody(); // For this test we really care about the content. @@ -851,7 +873,8 @@ trait WebDav { Assert::assertEquals( $expectedContent, $actualContent, - $extraErrorText . "The content was expected to be '$expectedContent', but actually is '$actualContent'. HTTP status was $actualStatus" + $extraErrorText . "The content was expected to be '$expectedContent', but actually is " + . "'$actualContent'. HTTP status was $actualStatus" ); } @@ -889,7 +912,7 @@ trait WebDav { * @return void * */ - public function theDownloadedContentForMultipartByteRangeShouldBe(int $statusCode, PyStringNode $content):void { + public function theDownloadedContentForMultipartByteRangeShouldBe(int $statusCode, PyStringNode $content): void { $actualStatusCode = $this->response->getStatusCode(); if ($actualStatusCode === $statusCode) { $actualContent = (string) $this->response->getBody(); @@ -899,7 +922,8 @@ trait WebDav { Assert::assertEquals( $content, $actualContent, - "The downloaded content was expected to be '$content', but actually is '$actualContent'. HTTP status was $actualStatusCode" + "The downloaded content was expected to be '$content', but actually is " + . "'$actualContent'. HTTP status was $actualStatusCode" ); } } @@ -912,7 +936,7 @@ trait WebDav { * * @return void */ - public function checkStatusCodeForDownloadedContentShouldBe(int $statusCode, string $content):void { + public function checkStatusCodeForDownloadedContentShouldBe(int $statusCode, string $content): void { $actualStatusCode = $this->response->getStatusCode(); if ($actualStatusCode === $statusCode) { $this->checkDownloadedContentMatches($content, '', $this->getResponse()); @@ -928,7 +952,7 @@ trait WebDav { * * @return void */ - public function contentOfFileForUserShouldBe(string $fileName, string $user, string $content):void { + public function contentOfFileForUserShouldBe(string $fileName, string $user, string $content): void { $response = $this->downloadFileAsUserUsingPassword($this->getActualUsername($user), $fileName); $actualStatus = $response->getStatusCode(); if ($actualStatus !== 200) { @@ -949,7 +973,7 @@ trait WebDav { * @return void * @throws Exception */ - public function contentOfFollowingFilesShouldBe(string $user, string $content, TableNode $table):void { + public function contentOfFollowingFilesShouldBe(string $user, string $content, TableNode $table): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -981,7 +1005,7 @@ trait WebDav { string $user, ?string $password, string $content - ):void { + ): void { $user = $this->getActualUsername($user); $password = $this->getActualPassword($password); $response = $this->downloadFileAsUserUsingPassword($user, $fileName, $password); @@ -1001,7 +1025,7 @@ trait WebDav { string $fileName, string $user, PyStringNode $content - ):void { + ): void { $user = $this->getActualUsername($user); $response = $this->downloadFileAsUserUsingPassword($user, $fileName); $actualStatus = $response->getStatusCode(); @@ -1025,7 +1049,7 @@ trait WebDav { public function userDownloadsFileUsingTheAPI( string $user, string $fileName - ):void { + ): void { $this->setResponse($this->downloadFileAsUserUsingPassword($user, $fileName)); } @@ -1044,7 +1068,7 @@ trait WebDav { ?string $password = null, ?array $headers = [], ?string $spaceId = null, - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $password = $this->getActualPassword($password); return $this->makeDavRequest( @@ -1067,8 +1091,9 @@ trait WebDav { * @return void * @throws Exception */ - public function publicGetsSizeOfLastSharedPublicLinkUsingTheWebdavApi():void { - $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); + public function publicGetsSizeOfLastSharedPublicLinkUsingTheWebdavApi(): void { + $token = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath($this->getDavPathVersion(), $token, "public-files"); $url = "{$this->getBaseUrl()}/$davPath"; $this->response = HttpRequestHelper::sendRequest( @@ -1087,7 +1112,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userGetsSizeOfFileUsingTheWebdavApi(string $user, string $resource):void { + public function userGetsSizeOfFileUsingTheWebdavApi(string $user, string $resource): void { $user = $this->getActualUsername($user); $password = $this->getPasswordForUser($user); $this->response = WebDavHelper::propfind( @@ -1112,7 +1137,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theSizeOfTheFileShouldBe(string $size):void { + public function theSizeOfTheFileShouldBe(string $size): void { $responseXmlObject = HttpRequestHelper::getResponseXml( $this->response, __METHOD__ @@ -1136,7 +1161,7 @@ trait WebDav { * * @return void */ - public function contentOfFileForUserShouldBePlusEndOfLine(string $fileName, string $user, string $content):void { + public function contentOfFileForUserShouldBePlusEndOfLine(string $fileName, string $user, string $content): void { $user = $this->getActualUsername($user); $response = $this->downloadFileAsUserUsingPassword($user, $fileName); $actualStatus = $response->getStatusCode(); @@ -1156,7 +1181,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theFollowingHeadersShouldBeSet(TableNode $table):void { + public function theFollowingHeadersShouldBeSet(TableNode $table): void { $this->verifyTableNodeColumns( $table, ['header', 'value'] @@ -1200,7 +1225,7 @@ trait WebDav { string $user, string $entry, string $path - ):void { + ): void { $this->checkFileOrFolderDoesNotExistsForUser($user, $entry, $path); } @@ -1217,7 +1242,7 @@ trait WebDav { string $entry = "file", ?string $path = null, string $type = "files" - ):void { + ): void { $user = $this->getActualUsername($user); $path = $this->substituteInLineCodes($path); $response = $this->listFolder( @@ -1273,7 +1298,7 @@ trait WebDav { string $user, string $entry, TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); $entry = \rtrim($entry, "s"); @@ -1297,7 +1322,7 @@ trait WebDav { string $user, string $entry, string $path - ):void { + ): void { $this->checkFileOrFolderExistsForUser($user, $entry, $path); } @@ -1315,7 +1340,7 @@ trait WebDav { string $entry, string $path, ?string $type = "files" - ):void { + ): void { $user = $this->getActualUsername($user); $path = $this->substituteInLineCodes($path); $responseXmlObject = HttpRequestHelper::getResponseXml( @@ -1355,7 +1380,7 @@ trait WebDav { string $user, string $entry, TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); $entry = \rtrim($entry, "s"); @@ -1379,7 +1404,7 @@ trait WebDav { string $entry, string $path, string $type = "files" - ):bool { + ): bool { try { $this->checkFileOrFolderExistsForUser($user, $entry, $path, $type); return true; @@ -1407,7 +1432,7 @@ trait WebDav { ?array $properties = null, ?string $spaceId = null, string $type = "files" - ):ResponseInterface { + ): ResponseInterface { return WebDavHelper::listFolder( $this->getBaseUrl(), $this->getActualUsername($user), @@ -1433,7 +1458,7 @@ trait WebDav { * @throws InvalidArgumentException|Exception * */ - public function userShouldSeeTheElements(string $user, string $shouldOrNot, TableNode $elements):void { + public function userShouldSeeTheElements(string $user, string $shouldOrNot, TableNode $elements): void { $should = ($shouldOrNot !== "not"); $this->checkElementList($user, $elements, $should); } @@ -1454,7 +1479,7 @@ trait WebDav { string $user, TableNode $elements, bool $expectedToBeListed = true - ):void { + ): void { $user = $this->getActualUsername($user); $this->verifyTableNodeColumnsCount($elements, 1); $elementRows = $elements->getRows(); @@ -1552,7 +1577,7 @@ trait WebDav { string $destination, string $spaceId = null, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $file = \fopen($this->acceptanceTestsDirLocation() . $source, 'r'); $this->pauseUploadDelete(); @@ -1588,7 +1613,7 @@ trait WebDav { string $user, string $source, string $destination - ):void { + ): void { $response = $this->uploadFile($user, $source, $destination); $this->setResponse($response); $this->pushToLastHttpStatusCodesArray( @@ -1605,11 +1630,12 @@ trait WebDav { * * @return array */ - public function userHasUploadedAFileTo(string $user, string $source, string $destination):array { + public function userHasUploadedAFileTo(string $user, string $source, string $destination): array { $response = $this->uploadFile($user, $source, $destination, null, true); $this->theHTTPStatusCodeShouldBe( ["201", "204"], - "HTTP status code was not 201 or 204 while trying to upload file '$source' to '$destination' for user '$user'", + "HTTP status code was not 201 or 204 while trying to upload file " + . "'$source' to '$destination' for user '$user'", $response ); return $response->getHeader('oc-fileid'); @@ -1709,7 +1735,7 @@ trait WebDav { string $source, string $destination, int $noOfChunks = 2 - ):void { + ): void { $response = $this->userUploadsAFileInChunk($user, $source, $destination, $noOfChunks); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -1723,7 +1749,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theHTTPStatusCodeOfResponsesOnAllEndpointsShouldBe(int $statusCode):void { + public function theHTTPStatusCodeOfResponsesOnAllEndpointsShouldBe(int $statusCode): void { $duplicateRemovedStatusCodes = \array_unique($this->lastHttpStatusCodesArray); if (\count($duplicateRemovedStatusCodes) === 1) { Assert::assertSame( @@ -1746,7 +1772,7 @@ trait WebDav { * @return void * @throws Exception */ - public function checkTheHTTPStatusCodeOfResponsesOnEachEndpoint(string $statusCodes):void { + public function checkTheHTTPStatusCodeOfResponsesOnEachEndpoint(string $statusCodes): void { $expectedStatusCodes = \explode(',', $statusCodes); $actualStatusCodes = $this->lastHttpStatusCodesArray; $count = \count($expectedStatusCodes); @@ -1778,7 +1804,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes):void { + public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes): void { $this->checkTheHTTPStatusCodeOfResponsesOnEachEndpoint($statusCodes); } @@ -1791,7 +1817,10 @@ trait WebDav { * @return void * @throws Exception */ - public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBeOcisReva(string $ocisStatusCodes, string $revaStatusCodes):void { + public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBeOcisReva( + string $ocisStatusCodes, + string $revaStatusCodes + ): void { if (OcisHelper::isTestingOnReva()) { $expectedStatusCodes = $revaStatusCodes; } else { @@ -1808,7 +1837,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theOCStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes):void { + public function theOCStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes): void { $statusCodes = \explode(',', $statusCodes); $count = \count($statusCodes); if ($count === \count($this->lastOCSStatusCodesArray)) { @@ -1835,7 +1864,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theOCSStatusCodeOfResponsesOnAllEndpointsShouldBe(string $statusCode):void { + public function theOCSStatusCodeOfResponsesOnAllEndpointsShouldBe(string $statusCode): void { $duplicateRemovedStatusCodes = \array_unique($this->lastOCSStatusCodesArray); if (\count($duplicateRemovedStatusCodes) === 1) { Assert::assertSame( @@ -1862,7 +1891,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userShouldBeAbleToUploadFileTo(string $user, string $source, string $destination):void { + public function userShouldBeAbleToUploadFileTo(string $user, string $source, string $destination): void { $user = $this->getActualUsername($user); $response = $this->uploadFile($user, $source, $destination); $this->theHTTPStatusCodeShouldBe( @@ -1883,7 +1912,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theUserShouldNotBeAbleToUploadFileTo(string $user, string $source, string $destination):void { + public function theUserShouldNotBeAbleToUploadFileTo(string $user, string $source, string $destination): void { $fileAlreadyExists = $this->fileOrFolderExists($user, "file", $destination); if ($fileAlreadyExists) { $response = $this->downloadFileAsUserUsingPassword($user, $destination); @@ -1897,7 +1926,8 @@ trait WebDav { Assert::assertSame( $initialContent, $currentContent, - __METHOD__ . " user $user was unexpectedly able to upload $source to $destination - the content has changed:" + __METHOD__ + . " user $user was unexpectedly able to upload $source to $destination - the content has changed:" ); } else { $this->checkFileOrFolderDoesNotExistsForUser($user, "file", $destination); @@ -1917,7 +1947,7 @@ trait WebDav { string $destination, string $shouldOrNot, ?string $exceptChunkingType = '' - ):void { + ): void { switch ($exceptChunkingType) { case 'old': $exceptChunkingSuffix = 'olddav-oldchunking'; @@ -1967,7 +1997,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userHasUploadedFileToOfSizeBytes(string $user, string $destination, string $bytes):void { + public function userHasUploadedFileToOfSizeBytes(string $user, string $destination, string $bytes): void { $user = $this->getActualUsername($user); $filename = "filespecificSize.txt"; $this->createLocalFileOfSpecificSize($filename, $bytes, 'a'); @@ -1989,7 +2019,12 @@ trait WebDav { * @return void * @throws Exception */ - public function userHasUploadedFileToEndingWithOfSizeBytes(string $user, string $destination, string $text, string $bytes):void { + public function userHasUploadedFileToEndingWithOfSizeBytes( + string $user, + string $destination, + string $text, + string $bytes + ): void { $filename = "filespecificSize.txt"; $this->createLocalFileOfSpecificSize($filename, $bytes, $text); Assert::assertFileExists($this->workStorageDirLocation() . $filename); @@ -2021,7 +2056,9 @@ trait WebDav { $user = $this->getActualUsername($user); $this->pauseUploadDelete(); - if (\str_starts_with($destination, "Shares/") && $this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) { + if (\str_starts_with($destination, "Shares/") + && $this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES + ) { $spaceId = $this->spacesContext->getSpaceIdByName($user, "Shares"); $destination = \str_replace("Shares/", "", $destination); } @@ -2059,7 +2096,7 @@ trait WebDav { string $user, ?string $content, string $destination - ):void { + ): void { $response = $this->uploadFileWithContent($user, $content, $destination); $this->setResponse($response); $this->pushToLastHttpStatusCodesArray(); @@ -2079,7 +2116,7 @@ trait WebDav { string $user, ?string $content, TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -2108,7 +2145,7 @@ trait WebDav { string $destination, string $mtime, ?bool $isGivenStep = false - ):void { + ): void { $mtime = new DateTime($mtime); $mtime = $mtime->format('U'); $user = $this->getActualUsername($user); @@ -2143,7 +2180,7 @@ trait WebDav { string $source, string $destination, string $mtime - ):void { + ): void { $mtime = new DateTime($mtime); $mtime = $mtime->format('U'); $user = $this->getActualUsername($user); @@ -2181,7 +2218,7 @@ trait WebDav { string $user, string $resource, string $mtime - ):void { + ): void { $user = $this->getActualUsername($user); $password = $this->getPasswordForUser($user); $baseUrl = $this->getBaseUrl(); @@ -2215,7 +2252,7 @@ trait WebDav { string $user, ?string $content, string $destination - ):array { + ): array { $user = $this->getActualUsername($user); $response = $this->uploadFileWithContent($user, $content, $destination, null, true); $this->theHTTPStatusCodeShouldBe( @@ -2240,7 +2277,7 @@ trait WebDav { string $user, ?string $content, TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $files = $table->getHash(); @@ -2268,7 +2305,7 @@ trait WebDav { public function userDownloadsFollowingFiles( string $user, TableNode $table - ):void { + ): void { $this->verifyTableNodeColumns($table, ["path"]); $files = $table->getHash(); $this->emptyLastHTTPStatusCodesArray(); @@ -2295,7 +2332,7 @@ trait WebDav { ?string $content, string $mtime, string $destination - ):void { + ): void { $user = $this->getActualUsername($user); $mtime = new DateTime($mtime); $mtime = $mtime->format('U'); @@ -2326,7 +2363,7 @@ trait WebDav { string $destination, ?bool $isGivenStep = false, ?string $spaceId = null - ):ResponseInterface { + ): ResponseInterface { $this->pauseUploadDelete(); $response = $this->makeDavRequest( $user, @@ -2362,7 +2399,7 @@ trait WebDav { string $checksum, string $content, string $destination - ):void { + ): void { $response = $this->uploadFileWithChecksumAndContent($user, $checksum, $content, $destination); $this->setResponse($response); } @@ -2382,7 +2419,7 @@ trait WebDav { string $checksum, ?string $content, string $destination - ):void { + ): void { $response = $this->uploadFileWithChecksumAndContent( $user, $checksum, @@ -2392,7 +2429,8 @@ trait WebDav { ); $this->theHTTPStatusCodeShouldBe( ["201", "204"], - "HTTP status code was not 201 or 204 while trying to upload file with checksum '$checksum' to '$destination' for user '$user'", + "HTTP status code was not 201 or 204 while trying to upload file with checksum " + . "'$checksum' to '$destination' for user '$user'", $response ); } @@ -2407,7 +2445,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userShouldBeAbleToDeleteEntry(string $user, string $entry, string $source):void { + public function userShouldBeAbleToDeleteEntry(string $user, string $entry, string $source): void { $user = $this->getActualUsername($user); $this->checkFileOrFolderExistsForUser($user, $entry, $source); $this->deleteFile($user, $source); @@ -2424,7 +2462,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theUserShouldNotBeAbleToDeleteEntry(string $user, string $entry, string $source):void { + public function theUserShouldNotBeAbleToDeleteEntry(string $user, string $entry, string $source): void { $this->checkFileOrFolderExistsForUser($user, $entry, $source); $this->deleteFile($user, $source); $this->checkFileOrFolderExistsForUser($user, $entry, $source); @@ -2436,7 +2474,7 @@ trait WebDav { * * @return void */ - public function deleteFile(string $user, string $resource):ResponseInterface { + public function deleteFile(string $user, string $resource): ResponseInterface { $user = $this->getActualUsername($user); $this->pauseUploadDelete(); $response = $this->makeDavRequest($user, 'DELETE', $resource, []); @@ -2452,7 +2490,7 @@ trait WebDav { * * @return void */ - public function userDeletesFile(string $user, string $resource):void { + public function userDeletesFile(string $user, string $resource): void { $response = $this->deleteFile($user, $resource); $this->setResponse($response); $this->pushToLastStatusCodesArrays(); @@ -2468,7 +2506,12 @@ trait WebDav { * * @return void */ - public function userDeletesFileFromSpaceUsingFileIdPath(string $user, string $filename, string $space, string $fileId):void { + public function userDeletesFileFromSpaceUsingFileIdPath( + string $user, + string $filename, + string $space, + string $fileId + ): void { $baseUrl = $this->getBaseUrl(); $davPath = WebDavHelper::getDavPath($this->getDavPathVersion()); $user = $this->getActualUsername($user); @@ -2519,7 +2562,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userHasDeletedResource(string $user, string $resource):void { + public function userHasDeletedResource(string $user, string $resource): void { $user = $this->getActualUsername($user); $response = $this->deleteFile($user, $resource); // If the file or folder was there and got deleted then we get a 204 @@ -2545,7 +2588,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userHasDeletedFollowingFiles(string $user, TableNode $table):void { + public function userHasDeletedFollowingFiles(string $user, TableNode $table): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -2570,7 +2613,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userDeletesFollowingFiles(string $user, TableNode $table):void { + public function userDeletesFollowingFiles(string $user, TableNode $table): void { $user = $this->getActualUsername($user); $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -2592,7 +2635,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userDeletesFilesFoldersWithoutDelays(string $user, TableNode $table):void { + public function userDeletesFilesFoldersWithoutDelays(string $user, TableNode $table): void { $user = $this->getActualUsername($user); $this->verifyTableNodeColumnsCount($table, 1); foreach ($table->getTable() as $entry) { @@ -2613,7 +2656,7 @@ trait WebDav { * @throws JsonException * @throws GuzzleException */ - public function userCreatesFolder(string $user, string $destination):void { + public function userCreatesFolder(string $user, string $destination): void { $response = $this->createFolder($user, $destination); $this->setResponse($response); } @@ -2628,7 +2671,7 @@ trait WebDav { * @throws JsonException * @throws GuzzleException */ - public function userHasCreatedFolder(string $user, string $destination):void { + public function userHasCreatedFolder(string $user, string $destination): void { $user = $this->getActualUsername($user); $response = $this->createFolder($user, $destination, true); $this->theHTTPStatusCodeShouldBe( @@ -2647,7 +2690,7 @@ trait WebDav { * @throws JsonException * @throws GuzzleException */ - public function adminHasCreatedFolder(string $destination):void { + public function adminHasCreatedFolder(string $destination): void { $admin = $this->getAdminUsername(); Assert::assertEquals( "admin", @@ -2672,7 +2715,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userHasCreatedFollowingFolders(string $user, TableNode $table):void { + public function userHasCreatedFollowingFolders(string $user, TableNode $table): void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); @@ -2697,7 +2740,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userShouldBeAbleToCreateFolder(string $user, string $destination):void { + public function userShouldBeAbleToCreateFolder(string $user, string $destination): void { $user = $this->getActualUsername($user); $response = $this->createFolder($user, $destination, true); $this->theHTTPStatusCodeShouldBe( @@ -2722,7 +2765,11 @@ trait WebDav { * @return void * @throws Exception */ - public function userShouldBeAbleToCreateFolderUsingPassword(string $user, string $destination, string $password):void { + public function userShouldBeAbleToCreateFolderUsingPassword( + string $user, + string $destination, + string $password + ): void { $user = $this->getActualUsername($user); $response = $this->createFolder($user, $destination, true, $password); $this->theHTTPStatusCodeShouldBe( @@ -2746,7 +2793,7 @@ trait WebDav { * @return void * @throws Exception */ - public function userShouldNotBeAbleToCreateFolder(string $user, string $destination):void { + public function userShouldNotBeAbleToCreateFolder(string $user, string $destination): void { $user = $this->getActualUsername($user); $response = $this->createFolder($user, $destination); $this->theHTTPStatusCodeShouldBeBetween(400, 499, $response); @@ -2767,7 +2814,11 @@ trait WebDav { * @return void * @throws Exception */ - public function userShouldNotBeAbleToCreateFolderUsingPassword(string $user, string $destination, string $password):void { + public function userShouldNotBeAbleToCreateFolderUsingPassword( + string $user, + string $destination, + string $password + ): void { $user = $this->getActualUsername($user); $response = $this->createFolder($user, $destination, false, $password); $this->theHTTPStatusCodeShouldBeBetween(400, 499, $response); @@ -2800,7 +2851,7 @@ trait WebDav { string $total, string $file, TableNode $chunkDetails - ):void { + ): void { $this->verifyTableNodeColumns($chunkDetails, ['number', 'content']); foreach ($chunkDetails->getHash() as $chunkDetail) { $chunkNumber = (int)$chunkDetail['number']; @@ -2830,7 +2881,7 @@ trait WebDav { string $user, string $file, TableNode $chunkDetails - ):void { + ): void { $total = (string) \count($chunkDetails->getHash()); $this->verifyTableNodeColumns($chunkDetails, ['number', 'content']); foreach ($chunkDetails->getHash() as $chunkDetail) { @@ -2859,7 +2910,7 @@ trait WebDav { ?string $data, string $destination, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $num -= 1; $file = "$destination-chunking-42-$total-$num"; @@ -2906,7 +2957,7 @@ trait WebDav { string $file, TableNode $chunkDetails, ?bool $isGivenStep = false - ):void { + ): void { $user = $this->getActualUsername($user); $async = false; if ($type === "asynchronously") { @@ -2946,7 +2997,7 @@ trait WebDav { array $chunkDetails, bool $async = false, bool $isGivenStep = false - ):void { + ): void { $this->pauseUploadDelete(); if ($isGivenStep) { $response = $this->userCreateANewChunkingUploadWithId($user, $chunkingId, true); @@ -2958,7 +3009,13 @@ trait WebDav { $chunkNumber = (int)$chunkDetail['number']; $chunkContent = $chunkDetail['content']; if ($isGivenStep) { - $response = $this->userUploadNewChunkFileOfWithToId($user, $chunkNumber, $chunkContent, $chunkingId, true); + $response = $this->userUploadNewChunkFileOfWithToId( + $user, + $chunkNumber, + $chunkContent, + $chunkingId, + true + ); $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); } else { $response = $this->userUploadNewChunkFileOfWithToId($user, $chunkNumber, $chunkContent, $chunkingId); @@ -2991,7 +3048,7 @@ trait WebDav { string $user, string $id, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $destination = "/uploads/$user/$id"; return $this->makeDavRequest( @@ -3026,7 +3083,7 @@ trait WebDav { ?string $data, string $id, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $destination = "/uploads/$user/$id/$num"; return $this->makeDavRequest( @@ -3059,7 +3116,7 @@ trait WebDav { string $id, string $type, string $dest - ):ResponseInterface { + ): ResponseInterface { $headers = []; if ($type === "asynchronously") { $headers = ['OC-LazyOps' => 'true']; @@ -3082,7 +3139,7 @@ trait WebDav { string $id, string $type, string $dest - ):void { + ): void { $this->setResponse($this->userMoveNewChunkFileWithIdToMychunkedfile($user, $id, $type, $dest)); } @@ -3101,7 +3158,7 @@ trait WebDav { string $type, string $dest, int $size - ):ResponseInterface { + ): ResponseInterface { $headers = ['OC-Total-Length' => $size]; if ($type === "asynchronously") { $headers['OC-LazyOps'] = 'true'; @@ -3129,7 +3186,7 @@ trait WebDav { string $type, string $dest, string $checksum - ):ResponseInterface { + ): ResponseInterface { $headers = ['OC-Checksum' => $checksum]; if ($type === "asynchronously") { $headers['OC-LazyOps'] = 'true'; @@ -3159,7 +3216,7 @@ trait WebDav { string $type, string $dest, string $checksum - ):void { + ): void { $response = $this->userMoveNewChunkFileWithIdToMychunkedfileWithChecksum( $user, $id, @@ -3187,7 +3244,7 @@ trait WebDav { string $destination, array $headers, ?bool $isGivenStep = false - ):ResponseInterface { + ): ResponseInterface { $user = $this->getActualUsername($user); $source = "/uploads/$user/$id/.file"; $headers['Destination'] = $this->destinationHeaderValue( @@ -3221,7 +3278,7 @@ trait WebDav { * * @return ResponseInterface */ - private function deleteUpload(string $user, string $id, array $headers):ResponseInterface { + private function deleteUpload(string $user, string $id, array $headers): ResponseInterface { $source = "/uploads/$user/$id"; return $this->makeDavRequest( $user, @@ -3241,7 +3298,7 @@ trait WebDav { * * @return string encoded path */ - public function encodePath(string $path):string { + public function encodePath(string $path): string { // slashes need to stay // in ocis even brackets are encoded return \str_replace('%2F', '/', \rawurlencode($path)); @@ -3252,7 +3309,7 @@ trait WebDav { * * @return ResponseInterface */ - public function connectToDavEndpoint():ResponseInterface { + public function connectToDavEndpoint(): ResponseInterface { return $this->makeDavRequest( null, 'PROPFIND', @@ -3266,7 +3323,7 @@ trait WebDav { * * @return void */ - public function connectingToDavEndpoint():void { + public function connectingToDavEndpoint(): void { $this->setResponse($this->connectToDavEndpoint()); } @@ -3276,7 +3333,7 @@ trait WebDav { * @return void * @throws Exception */ - public function thereAreNoDuplicateHeaders():void { + public function thereAreNoDuplicateHeaders(): void { $headers = $this->response->getHeaders(); foreach ($headers as $headerName => $headerValues) { // if a header has multiple values, they must be different @@ -3296,7 +3353,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theFollowingHeadersShouldNotBeSet(TableNode $table):void { + public function theFollowingHeadersShouldNotBeSet(TableNode $table): void { $this->verifyTableNodeColumns( $table, ['header'] @@ -3322,7 +3379,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theFollowingHeadersShouldMatchTheseRegularExpressions(TableNode $table):void { + public function theFollowingHeadersShouldMatchTheseRegularExpressions(TableNode $table): void { $this->headersShouldMatchRegularExpressions($table); } @@ -3331,7 +3388,7 @@ trait WebDav { * * @return void */ - public function headersShouldMatchRegularExpressions(TableNode $table):void { + public function headersShouldMatchRegularExpressions(TableNode $table): void { $this->verifyTableNodeColumnsCount($table, 2); foreach ($table->getTable() as $header) { $headerName = $header[0]; @@ -3360,7 +3417,7 @@ trait WebDav { * @return void * @throws Exception */ - public function statusCodeShouldMatchTheseRegularExpressions(int $statusCode, TableNode $table):void { + public function statusCodeShouldMatchTheseRegularExpressions(int $statusCode, TableNode $table): void { $actualStatusCode = $this->response->getStatusCode(); if ($actualStatusCode === $statusCode) { $this->headersShouldMatchRegularExpressions($table); @@ -3376,7 +3433,7 @@ trait WebDav { * @return void * @throws Exception */ - public function headersShouldMatchRegularExpressionsForUser(string $user, TableNode $table):void { + public function headersShouldMatchRegularExpressionsForUser(string $user, TableNode $table): void { $this->verifyTableNodeColumnsCount($table, 2); $user = $this->getActualUsername($user); foreach ($table->getTable() as $header) { @@ -3409,7 +3466,7 @@ trait WebDav { public function userDeletesEverythingInFolder( string $user, string $folder - ):void { + ): void { $this->deleteEverythingInFolder($user, $folder, false); } @@ -3425,7 +3482,7 @@ trait WebDav { string $user, string $folder, bool $checkEachDelete = false - ):void { + ): void { $user = $this->getActualUsername($user); $responseXmlObject = HttpRequestHelper::getResponseXml( $this->listFolder( @@ -3467,7 +3524,7 @@ trait WebDav { * * @return void */ - public function downloadPreviewOfFiles(string $user, string $path, string $width, string $height):void { + public function downloadPreviewOfFiles(string $user, string $path, string $width, string $height): void { $response = $this->downloadPreviews( $user, $path, @@ -3488,7 +3545,12 @@ trait WebDav { * * @return void */ - public function userDownloadsThePreviewOfWithPreviewZero(string $user, string $path, string $width, string $height) { + public function userDownloadsThePreviewOfWithPreviewZero( + string $user, + string $path, + string $width, + string $height + ) { $user = $this->getActualUsername($user); $urlParameter = [ 'x' => $width, @@ -3521,7 +3583,12 @@ trait WebDav { * * @return void */ - public function userDownloadsThePreviewOfSharedResourceWithWidthAndHeightUsingTheWebdavApi(string $user, string $path, string $width, string $height): void { + public function userDownloadsThePreviewOfSharedResourceWithWidthAndHeightUsingTheWebdavApi( + string $user, + string $path, + string $width, + string $height + ): void { if ($this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) { $this->setResponse($this->downloadSharedFilePreview($user, $path, $width, $height)); } else { @@ -3540,7 +3607,13 @@ trait WebDav { * * @return void */ - public function userDownloadsThePreviewOfWithWidthHeightProcessorUsingWebDAVAPI(string $user, string $path, string $width, string $height, string $processor): void { + public function userDownloadsThePreviewOfWithWidthHeightProcessorUsingWebDAVAPI( + string $user, + string $path, + string $width, + string $height, + string $processor + ): void { $user = $this->getActualUsername($user); $urlParameter = [ 'x' => $width, @@ -3574,7 +3647,12 @@ trait WebDav { * * @return void */ - public function userDownloadsThePreviewOfFederatedShareImageWithWidthHeightUsingWebDAVAPI(string $user, string $path, string $width, string $height): void { + public function userDownloadsThePreviewOfFederatedShareImageWithWidthHeightUsingWebDAVAPI( + string $user, + string $path, + string $width, + string $height + ): void { $user = $this->getActualUsername($user); $urlParameter = [ 'x' => $width, @@ -3609,7 +3687,12 @@ trait WebDav { * * @return void */ - public function userHasDownloadedThePreviewOfSharedResourceWithWidthAndHeight(string $user, string $path, string $width, string $height): void { + public function userHasDownloadedThePreviewOfSharedResourceWithWidthAndHeight( + string $user, + string $path, + string $width, + string $height + ): void { if ($this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) { $response = $this->downloadSharedFilePreview($user, $path, $width, $height); } else { @@ -3633,7 +3716,12 @@ trait WebDav { * * @return void */ - public function asUserThePreviewOfSharedResourceWithWidthAndHeightShouldHaveBeenChanged(string $user, string $path, string $width, string $height):void { + public function asUserThePreviewOfSharedResourceWithWidthAndHeightShouldHaveBeenChanged( + string $user, + string $path, + string $width, + string $height + ): void { if ($this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) { $response = $this->downloadSharedFilePreview($user, $path, $width, $height); } else { @@ -3662,7 +3750,11 @@ trait WebDav { * * @return void */ - public function userUploadsFileWithContentSharedResourceToUsingTheWebdavApi(string $user, string $content, string $destination): void { + public function userUploadsFileWithContentSharedResourceToUsingTheWebdavApi( + string $user, + string $content, + string $destination + ): void { $this->setResponse($this->uploadFileWithContent($user, $content, $destination)); } @@ -3754,7 +3846,13 @@ trait WebDav { * * @return void */ - public function downloadPreviewOfOtherUser(string $user, string $path, string $ofUser, string $width, string $height):void { + public function downloadPreviewOfOtherUser( + string $user, + string $path, + string $ofUser, + string $width, + string $height + ): void { $response = $this->downloadPreviews( $ofUser, $path, @@ -3784,7 +3882,7 @@ trait WebDav { * * @return void */ - public function checkImageDimensions(string $width, string $height, ?ResponseInterface $response = null) : void { + public function checkImageDimensions(string $width, string $height, ?ResponseInterface $response = null): void { $response = $response ?? $this->getResponse(); $response->getBody()->rewind(); $responseBodyContent = $response->getBody()->getContents(); @@ -3802,7 +3900,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theDownloadedPreviewContentShouldMatchWithFixturesPreviewContentFor(string $filename):void { + public function theDownloadedPreviewContentShouldMatchWithFixturesPreviewContentFor(string $filename): void { $expectedPreview = \file_get_contents(__DIR__ . "/../fixtures/" . $filename); $this->getResponse()->getBody()->rewind(); $responseBodyContent = $this->getResponse()->getBody()->getContents(); @@ -3819,7 +3917,12 @@ trait WebDav { * * @return void */ - public function userDownloadsThePreviewOfWithWidthAndHeight(string $user, string $path, string $width, string $height):void { + public function userDownloadsThePreviewOfWithWidthAndHeight( + string $user, + string $path, + string $width, + string $height + ): void { $response = $this->downloadPreviews( $user, $path, @@ -3844,7 +3947,12 @@ trait WebDav { * * @return void */ - public function asUserThePreviewOfPathWithHeightAndWidthShouldHaveBeenChanged(string $user, string $path, string $width, string $height):void { + public function asUserThePreviewOfPathWithHeightAndWidthShouldHaveBeenChanged( + string $user, + string $path, + string $width, + string $height + ): void { $response = $this->downloadPreviews( $user, $path, @@ -3897,7 +4005,7 @@ trait WebDav { * * @return void */ - public function userStoresFileIdForPath(string $user, string $path):void { + public function userStoresFileIdForPath(string $user, string $path): void { $this->storedFileID = $this->getFileIdForPath($user, $path); } @@ -3910,14 +4018,15 @@ trait WebDav { * * @return void */ - public function userFileShouldHaveStoredId(string $user, string $fileOrFolder, string $path):void { + public function userFileShouldHaveStoredId(string $user, string $fileOrFolder, string $path): void { $user = $this->getActualUsername($user); $currentFileID = $this->getFileIdForPath($user, $path); Assert::assertEquals( $currentFileID, $this->storedFileID, __METHOD__ - . " User '$user' $fileOrFolder '$path' does not have the previously stored id '$this->storedFileID', but has '$currentFileID'." + . " User '$user' $fileOrFolder '$path' does not have the previously stored id " . + "'$this->storedFileID', but has '$currentFileID'." ); } @@ -3930,7 +4039,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theDavElementShouldBe(string $element, string $message):void { + public function theDavElementShouldBe(string $element, string $message): void { $responseXmlArray = HttpRequestHelper::parseResponseAsXml($this->getResponse()); WebDavAssert::assertDavResponseElementIs( $element, @@ -3958,7 +4067,7 @@ trait WebDav { ?string $method = 'REPORT', ?string $folderpath = '', ?string $spaceId = null - ):void { + ): void { $folderpath = \trim($folderpath, "/"); $this->verifyTableNodeColumnsCount($expectedFiles, 1); $elementRows = $expectedFiles->getRows(); @@ -4015,7 +4124,7 @@ trait WebDav { string $user, string $shouldOrNot, TableNode $expectedFiles - ):void { + ): void { $user = $this->getActualUsername($user); $this->propfindResultShouldContainEntries( $shouldOrNot, @@ -4036,7 +4145,7 @@ trait WebDav { public function thePropfindResultShouldContainOnlyEntries( string $user, TableNode $expectedFiles - ):void { + ): void { $user = $this->getActualUsername($user); Assert::assertEquals( @@ -4060,7 +4169,7 @@ trait WebDav { * * @return void */ - public function propfindResultShouldContainNumEntries(int $numFiles):void { + public function propfindResultShouldContainNumEntries(int $numFiles): void { $this->checkIFResponseContainsNumberEntries($numFiles); } @@ -4069,7 +4178,7 @@ trait WebDav { * * @return void */ - public function checkIFResponseContainsNumberEntries(int $numFiles):void { + public function checkIFResponseContainsNumberEntries(int $numFiles): void { $responseXmlArray = HttpRequestHelper::parseResponseAsXml($this->response); Assert::assertIsArray( @@ -4109,7 +4218,7 @@ trait WebDav { public function theSearchResultShouldContainAnyOfTheseEntries( int $expectedNumber, TableNode $expectedFiles - ):void { + ): void { $this->checkIfSearchResultContainsFiles( $this->getCurrentUser(), $expectedNumber, @@ -4131,7 +4240,7 @@ trait WebDav { string $user, int $expectedNumber, TableNode $expectedFiles - ):void { + ): void { $this->checkIfSearchResultContainsFiles( $user, $expectedNumber, @@ -4150,7 +4259,7 @@ trait WebDav { string $user, int $expectedNumber, TableNode $expectedFiles - ):void { + ): void { $user = $this->getActualUsername($user); $this->verifyTableNodeColumnsCount($expectedFiles, 1); $this->checkIFResponseContainsNumberEntries($expectedNumber); @@ -4180,7 +4289,11 @@ trait WebDav { * @return void * @throws Exception */ - public function userListsTheResourcesInPathWithDepthUsingTheWebdavApi(string $user, string $path, string $depth):void { + public function userListsTheResourcesInPathWithDepthUsingTheWebdavApi( + string $user, + string $path, + string $depth + ): void { $response = $this->listFolder( $user, $path, @@ -4198,7 +4311,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theLastDavResponseShouldContainTheseNodes(string $user, TableNode $table):void { + public function theLastDavResponseShouldContainTheseNodes(string $user, TableNode $table): void { $this->verifyTableNodeColumns($table, ["name"]); foreach ($table->getHash() as $row) { $path = $this->substituteInLineCodes($row['name']); @@ -4216,7 +4329,7 @@ trait WebDav { * @return void * @throws Exception */ - public function theLastDavResponseShouldNotContainTheseNodes(string $user, TableNode $table):void { + public function theLastDavResponseShouldNotContainTheseNodes(string $user, TableNode $table): void { $this->verifyTableNodeColumns($table, ["name"]); foreach ($table->getHash() as $row) { $path = $this->substituteInLineCodes($row['name']); @@ -4233,8 +4346,9 @@ trait WebDav { * @return void * @throws Exception */ - public function theLastPublicDavResponseShouldContainTheseNodes(TableNode $table):void { - $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); + public function theLastPublicDavResponseShouldContainTheseNodes(TableNode $table): void { + $token = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->verifyTableNodeColumns($table, ["name"]); foreach ($table->getHash() as $row) { @@ -4252,8 +4366,9 @@ trait WebDav { * @return void * @throws Exception */ - public function theLastPublicDavResponseShouldNotContainTheseNodes(TableNode $table):void { - $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); + public function theLastPublicDavResponseShouldNotContainTheseNodes(TableNode $table): void { + $token = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->verifyTableNodeColumns($table, ["name"]); foreach ($table->getHash() as $row) { @@ -4271,8 +4386,11 @@ trait WebDav { * @return void * @throws Exception */ - public function thePublicListsTheResourcesInTheLastCreatedPublicLinkWithDepthUsingTheWebdavApi(string $depth):void { - $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); + public function thePublicListsTheResourcesInTheLastCreatedPublicLinkWithDepthUsingTheWebdavApi( + string $depth + ): void { + $token = ($this->isUsingSharingNG()) + ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->setResponse( $this->listFolder( $token, @@ -4290,7 +4408,7 @@ trait WebDav { * * @return array */ - public function findEntryFromReportResponse(?string $user):array { + public function findEntryFromReportResponse(?string $user): array { $responseXmlObj = HttpRequestHelper::getResponseXml($this->getResponse()); $responseResources = []; $hrefs = $responseXmlObj->xpath('//d:href'); @@ -4316,7 +4434,7 @@ trait WebDav { */ public function getNumberOfEntriesInPropfindResponse( ?string $user = null - ):int { + ): int { $multistatusResults = $this->getMultiStatusResultFromPropfindResult($user); return \count($multistatusResults); } @@ -4331,7 +4449,7 @@ trait WebDav { */ public function getMultiStatusResultFromPropfindResult( ?string $user = null - ):array { + ): array { $responseXmlArray = HttpRequestHelper::parseResponseAsXml($this->response); Assert::assertNotEmpty($responseXmlArray, __METHOD__ . ' Response is empty'); @@ -4526,7 +4644,7 @@ trait WebDav { * * @return void */ - public function pauseUploadDelete():void { + public function pauseUploadDelete(): void { $time = \time(); $uploadWaitTime = \getenv("UPLOAD_DELETE_WAIT_TIME"); @@ -4546,7 +4664,7 @@ trait WebDav { * * @return void */ - public function checkAuthorOfAVersionOfFile(string $index, string $expectedUsername):void { + public function checkAuthorOfAVersionOfFile(string $index, string $expectedUsername): void { $expectedUserDisplayName = $this->getUserDisplayName($expectedUsername); $responseXmlObject = HttpRequestHelper::getResponseXml( $this->getResponse(), @@ -4565,14 +4683,16 @@ trait WebDav { } if (!isset($authors[$index - 1])) { Assert::fail( - 'could not find version with index "' . $index . '" for oc:meta-version-edited-by property in response to user "' . $this->responseUser . '"' + 'could not find version with index "' . $index + . '" for oc:meta-version-edited-by property in response to user "' . $this->responseUser . '"' ); } $actualUser = $authors[$index - 1]; Assert::assertEquals( $expectedUsername, $actualUser, - "Expected user of version with index $index in response to user '$this->responseUser' was '$expectedUsername', but got '$actualUser'" + "Expected user of version with index $index in response to user '$this->responseUser'" + . " was '$expectedUsername', but got '$actualUser'" ); // the user's display name should be in oc:meta-version-edited-by-name @@ -4587,14 +4707,16 @@ trait WebDav { } if (!isset($displaynames[$index - 1])) { Assert::fail( - 'could not find version with index "' . $index . '" for oc:meta-version-edited-by-name property in response to user "' . $this->responseUser . '"' + 'could not find version with index "' . $index + . '" for oc:meta-version-edited-by-name property in response to user "' . $this->responseUser . '"' ); } $actualUserDisplayName = $displaynames[$index - 1]; Assert::assertEquals( $expectedUserDisplayName, $actualUserDisplayName, - "Expected display name of version with index $index in response to user '$this->responseUser' was '$expectedUserDisplayName', but got '$actualUserDisplayName'" + "Expected display name of version with index $index in response to user '$this->responseUser'" + . " was '$expectedUserDisplayName', but got '$actualUserDisplayName'" ); } diff --git a/tests/acceptance/bootstrap/WebDavLockingContext.php b/tests/acceptance/bootstrap/WebDavLockingContext.php index 01c20c74029..431102095b6 100644 --- a/tests/acceptance/bootstrap/WebDavLockingContext.php +++ b/tests/acceptance/bootstrap/WebDavLockingContext.php @@ -69,7 +69,7 @@ class WebDavLockingContext implements Context { bool $public = false, bool $expectToSucceed = true, ?string $spaceId = null - ):ResponseInterface { + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); if ($public === true) { $type = "public-files"; @@ -146,7 +146,9 @@ class WebDavLockingContext implements Context { */ public function userLocksFileSettingPropertiesUsingWebDavAPI(string $user, string $file, TableNode $properties) { $spaceId = null; - if (\str_starts_with($file, "Shares/") && $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) { + if (\str_starts_with($file, "Shares/") + && $this->featureContext->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES + ) { $spaceId = $this->spacesContext->getSpaceIdByName($user, "Shares"); $file = \str_replace("Shares/", "", $file); } @@ -163,7 +165,11 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userTriesToLockFileSettingPropertiesUsingWebDavAPI(string $user, string $file, TableNode $properties) { + public function userTriesToLockFileSettingPropertiesUsingWebDavAPI( + string $user, + string $file, + TableNode $properties + ) { $response = $this->lockFile($user, $file, $properties, null, false, false); $this->featureContext->setResponse($response); } @@ -179,7 +185,12 @@ class WebDavLockingContext implements Context { * @return void * @throws GuzzleException */ - public function userLocksFileInProjectSpaceUsingWebDavAPI(string $user, string $file, string $space, TableNode $properties) { + public function userLocksFileInProjectSpaceUsingWebDavAPI( + string $user, + string $file, + string $space, + TableNode $properties + ) { $this->featureContext->setResponse($this->userLocksFileInProjectSpace($user, $file, $space, $properties)); } @@ -193,7 +204,12 @@ class WebDavLockingContext implements Context { * * @throws GuzzleException */ - public function userLocksFileInProjectSpace(string $user, string $file, string $space, TableNode $properties): ?ResponseInterface { + public function userLocksFileInProjectSpace( + string $user, + string $file, + string $space, + TableNode $properties + ): ?ResponseInterface { $spaceId = $this->spacesContext->getSpaceIdByName($user, $space); $baseUrl = $this->featureContext->getBaseUrl(); $davPathVersion = $this->featureContext->getDavPathVersion(); @@ -218,7 +234,12 @@ class WebDavLockingContext implements Context { * @return void * @throws GuzzleException */ - public function userHasLockedFileInProjectSpaceUsingWebDavAPI(string $user, string $file, string $space, TableNode $properties): void { + public function userHasLockedFileInProjectSpaceUsingWebDavAPI( + string $user, + string $file, + string $space, + TableNode $properties + ): void { $response = $this->userLocksFileInProjectSpace($user, $file, $space, $properties); $this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response); } @@ -233,7 +254,12 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userTriesToLockFileInProjectSpaceUsingWebDavAPI(string $user, string $file, string $space, TableNode $properties) { + public function userTriesToLockFileInProjectSpaceUsingWebDavAPI( + string $user, + string $file, + string $space, + TableNode $properties + ) { $spaceId = $this->spacesContext->getSpaceIdByName($user, $space); $davPathVersion = $this->featureContext->getDavPathVersion(); $suffixPath = $user; @@ -257,7 +283,12 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userLocksFileUsingFileIdUsingWebDavAPISettingFollowingProperties(string $user, string $file, string $fileId, TableNode $properties) { + public function userLocksFileUsingFileIdUsingWebDavAPISettingFollowingProperties( + string $user, + string $file, + string $fileId, + TableNode $properties + ) { $davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion()); $davPath = \rtrim($davPath, '/'); $fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId"; @@ -275,7 +306,12 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userTriesToLockFileUsingFileIdUsingWebDavAPI(string $user, string $file, string $fileId, TableNode $properties) { + public function userTriesToLockFileUsingFileIdUsingWebDavAPI( + string $user, + string $file, + string $fileId, + TableNode $properties + ) { $davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion()); $davPath = \rtrim($davPath, '/'); $fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId"; @@ -307,7 +343,12 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userHasLockedFileInsideSpaceSettingTheFollowingProperties(string $user, string $file, string $spaceName, TableNode $properties) { + public function userHasLockedFileInsideSpaceSettingTheFollowingProperties( + string $user, + string $file, + string $spaceName, + TableNode $properties + ) { $spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName); $response = $this->lockFile($user, $file, $properties, null, false, true, $spaceId); $this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response); @@ -358,7 +399,9 @@ class WebDavLockingContext implements Context { * @return void */ public function publicLocksLastSharedFile(TableNode $properties) { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $response = $this->lockFile( $token, "/", @@ -382,7 +425,9 @@ class WebDavLockingContext implements Context { string $file, TableNode $properties ) { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $response = $this->lockFile( $token, $file, @@ -406,7 +451,9 @@ class WebDavLockingContext implements Context { string $file, TableNode $properties ) { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $response = $this->lockFile( $token, $file, @@ -445,7 +492,11 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi(string $user, string $spaceName, string $file) { + public function userUnlocksTheLastCreatedLockOfFileInsideSpaceUsingTheWebdavApi( + string $user, + string $spaceName, + string $file + ) { $spaceId = $this->spacesContext->getSpaceIdByName($this->featureContext->getActualUsername($user), $spaceName); $response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI( $user, @@ -468,11 +519,22 @@ class WebDavLockingContext implements Context { * * @return void */ - public function userUnlocksTheLastCreatedLockOfFileWithFileIdPathUsingTheWebdavApi(string $user, string $itemToUnlock, string $fileId) { + public function userUnlocksTheLastCreatedLockOfFileWithFileIdPathUsingTheWebdavApi( + string $user, + string $itemToUnlock, + string $fileId + ) { $davPath = WebdavHelper::getDavPath($this->featureContext->getDavPathVersion()); $davPath = \rtrim($davPath, '/'); $fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileId"; - $response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI($user, $itemToUnlock, $user, $itemToUnlock, false, $fullUrl); + $response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI( + $user, + $itemToUnlock, + $user, + $itemToUnlock, + false, + $fullUrl + ); $this->featureContext->setResponse($response); } @@ -535,7 +597,7 @@ class WebDavLockingContext implements Context { private function countLockOfResources( string $user, string $itemToUnlock - ):int { + ): int { $user = $this->featureContext->getActualUsername($user); $baseUrl = $this->featureContext->getBaseUrl(); $password = $this->featureContext->getPasswordForUser($user); @@ -625,7 +687,7 @@ class WebDavLockingContext implements Context { bool $public = false, string $fullUrl = null, ?string $spaceId = null, - ):ResponseInterface { + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $lockOwner = $this->featureContext->getActualUsername($lockOwner); if ($public === true) { @@ -711,7 +773,9 @@ class WebDavLockingContext implements Context { string $lockOwner, string $itemToUseLockOf ) { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI( $token, $itemToUnlock, @@ -730,7 +794,9 @@ class WebDavLockingContext implements Context { * @return void */ public function unlockItemAsPublicUsingWebDavAPI(string $itemToUnlock) { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $response = $this->unlockItemWithLastLockOfUserAndItemUsingWebDavAPI( $token, $itemToUnlock, @@ -782,7 +848,7 @@ class WebDavLockingContext implements Context { string $fileDestination, string $itemToUseLockOf, string $lockOwner - ):ResponseInterface { + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); $lockOwner = $this->featureContext->getActualUsername($lockOwner); $destination = $this->featureContext->destinationHeaderValue( @@ -901,7 +967,12 @@ class WebDavLockingContext implements Context { * @return void * @throws GuzzleException */ - public function numberOfLockShouldBeReportedInProjectSpace(int $count, string $file, string $spaceName, string $user) { + public function numberOfLockShouldBeReportedInProjectSpace( + int $count, + string $file, + string $spaceName, + string $user + ) { $response = $this->spacesContext->sendPropfindRequestToSpace($user, $spaceName, $file, null, '0'); $this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response); $responseXmlObject = HttpRequestHelper::getResponseXml($response, __METHOD__); diff --git a/tests/acceptance/bootstrap/WebDavPropertiesContext.php b/tests/acceptance/bootstrap/WebDavPropertiesContext.php index bb2cd9d5a4b..ac369e36425 100644 --- a/tests/acceptance/bootstrap/WebDavPropertiesContext.php +++ b/tests/acceptance/bootstrap/WebDavPropertiesContext.php @@ -56,7 +56,7 @@ class WebDavPropertiesContext implements Context { public function userGetsThePropertiesOfFolder( string $user, string $path - ):void { + ): void { $response = $this->featureContext->listFolder( $user, $path, @@ -79,7 +79,7 @@ class WebDavPropertiesContext implements Context { string $user, string $path, string $depth - ):void { + ): void { $response = $this->featureContext->listFolder( $user, $path, @@ -133,7 +133,7 @@ class WebDavPropertiesContext implements Context { string $user, string $path, TableNode $propertiesTable - ):void { + ): void { $response = $this->getPropertiesOfFolder($user, $path, null, $propertiesTable); $this->featureContext->setResponse($response); $this->featureContext->pushToLastStatusCodesArrays(); @@ -170,7 +170,11 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function userHasSetFollowingPropertiesUsingProppatch(string $username, string $path, TableNode $propertiesTable) { + public function userHasSetFollowingPropertiesUsingProppatch( + string $username, + string $path, + TableNode $propertiesTable + ) { $username = $this->featureContext->getActualUsername($username); $this->featureContext->verifyTableNodeColumns($propertiesTable, ['propertyName', 'propertyValue']); $properties = $propertiesTable->getColumnsHash(); @@ -200,7 +204,7 @@ class WebDavPropertiesContext implements Context { string $user, string $propertyName, string $path - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $properties = [$propertyName]; $response = WebDavHelper::propfind( @@ -234,7 +238,7 @@ class WebDavPropertiesContext implements Context { string $propertyName, string $namespace, string $path - ):void { + ): void { $user = $this->featureContext->getActualUsername($user); $properties = [ $namespace => $propertyName @@ -262,7 +266,9 @@ class WebDavPropertiesContext implements Context { * @throws Exception */ public function getPropertiesOfEntryFromLastLinkShare(string $path, TableNode $propertiesTable): ResponseInterface { - $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) + ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() + : $this->featureContext->getLastCreatedPublicShareToken(); $properties = null; foreach ($propertiesTable->getRows() as $row) { $properties[] = $row[0]; @@ -286,7 +292,10 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function thePublicGetsFollowingPropertiesOfEntryFromLastLinkShare(string $path, TableNode $propertiesTable):void { + public function thePublicGetsFollowingPropertiesOfEntryFromLastLinkShare( + string $path, + TableNode $propertiesTable + ): void { $response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable); $this->featureContext->setResponse($response); } @@ -307,7 +316,7 @@ class WebDavPropertiesContext implements Context { string $path, string $propertyValue, string $namespace = null, - ):ResponseInterface { + ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); return WebDavHelper::proppatch( $this->featureContext->getBaseUrl(), @@ -338,7 +347,7 @@ class WebDavPropertiesContext implements Context { string $propertyName, string $path, string $propertyValue - ):void { + ): void { $response = $this->setResourceProperty( $user, $propertyName, @@ -366,7 +375,7 @@ class WebDavPropertiesContext implements Context { string $namespace, string $path, string $propertyValue - ):void { + ): void { $response = $this->setResourceProperty( $user, $propertyName, @@ -393,7 +402,7 @@ class WebDavPropertiesContext implements Context { string $propertyName, string $path, string $propertyValue - ):void { + ): void { $response = $this->setResourceProperty( $user, $propertyName, @@ -421,7 +430,7 @@ class WebDavPropertiesContext implements Context { string $namespace, string $path, string $propertyValue - ):void { + ): void { $response = $this->setResourceProperty( $user, $propertyName, @@ -477,7 +486,7 @@ class WebDavPropertiesContext implements Context { string $propertyName, string $namespaceString, string $propertyValue - ):void { + ): void { // let's unescape quotes first $propertyValue = \str_replace('\"', '"', $propertyValue); $responseXmlObject = HttpRequestHelper::getResponseXml( @@ -518,7 +527,7 @@ class WebDavPropertiesContext implements Context { public function theSingleResponseShouldContainAPropertyWithChildProperty( string $property, string $childProperty - ):void { + ): void { $xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath( "//d:prop/$property/$childProperty" ); @@ -572,7 +581,7 @@ class WebDavPropertiesContext implements Context { public function theSingleResponseShouldContainAPropertyWithValue( string $key, string $expectedValue - ):void { + ): void { $this->checkResponseContainsAPropertyWithValue( $this->featureContext->getResponse(), $key, @@ -595,7 +604,7 @@ class WebDavPropertiesContext implements Context { string $user, string $key, string $expectedValue - ):void { + ): void { $this->checkResponseContainsAPropertyWithValue( $this->featureContext->getResponse(), $key, @@ -619,7 +628,7 @@ class WebDavPropertiesContext implements Context { string $key, string $expectedValue, string $altExpectedValue - ):void { + ): void { $this->checkResponseContainsAPropertyWithValue( $this->featureContext->getResponse(), $key, @@ -636,7 +645,11 @@ class WebDavPropertiesContext implements Context { * @return SimpleXMLElement * @throws Exception */ - public function checkResponseContainsProperty(ResponseInterface $response, string $key, string $namespaceString = null): SimpleXMLElement { + public function checkResponseContainsProperty( + ResponseInterface $response, + string $key, + string $namespaceString = null + ): SimpleXMLElement { $xmlPart = HttpRequestHelper::getResponseXml($response, __METHOD__); ; @@ -680,7 +693,7 @@ class WebDavPropertiesContext implements Context { string $expectedValue, string $altExpectedValue, ?string $user = null - ):void { + ): void { $xmlPart = $this->checkResponseContainsProperty($response, $key); $value = $xmlPart->__toString(); $expectedValue = $this->featureContext->substituteInLineCodes( @@ -708,7 +721,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function assertValueOfItemInResponseIs(string $xpath, string $expectedValue):void { + public function assertValueOfItemInResponseIs(string $xpath, string $expectedValue): void { $this->assertValueOfItemInResponseAboutUserIs( $xpath, null, @@ -727,7 +740,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function valueOfItemOfPathShouldBe(string $user, string $xpath, string $path, string $expectedValue):void { + public function valueOfItemOfPathShouldBe(string $user, string $xpath, string $path, string $expectedValue): void { $path = $this->featureContext->substituteInLineCodes($path, $user); $path = \ltrim($path, '/'); $path = "/" . WebdavHelper::prefixRemotePhp($path); @@ -749,7 +762,11 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function theValueOfTheItemInTheResponseAboutUserShouldBe(string $xpath, string $user, string $expectedValue):void { + public function theValueOfTheItemInTheResponseAboutUserShouldBe( + string $xpath, + string $user, + string $expectedValue + ): void { $this->assertValueOfItemInResponseAboutUserIs($xpath, $user, $expectedValue); } @@ -760,7 +777,7 @@ class WebDavPropertiesContext implements Context { * * @return void */ - public function assertValueOfItemInResponseAboutUserIs(string $xpath, ?string $user, string $expectedValue):void { + public function assertValueOfItemInResponseAboutUserIs(string $xpath, ?string $user, string $expectedValue): void { $responseXmlObject = HttpRequestHelper::getResponseXml( $this->featureContext->getResponse(), __METHOD__ @@ -794,7 +811,12 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function assertValueOfItemInResponseAboutUserIsEitherOr(string $xpath, ?string $user, string $expectedValue1, string $expectedValue2):void { + public function assertValueOfItemInResponseAboutUserIsEitherOr( + string $xpath, + ?string $user, + string $expectedValue1, + string $expectedValue2 + ): void { if (!$expectedValue2) { $expectedValue2 = $expectedValue1; } @@ -820,7 +842,10 @@ class WebDavPropertiesContext implements Context { $expectedValue2 = preg_replace("/^\/\//i", "/", $expectedValue2); $expectedValues = [$expectedValue1, $expectedValue2]; $isExpectedValueInMessage = \in_array($value, $expectedValues); - Assert::assertTrue($isExpectedValueInMessage, "The actual value \"$value\" is not one of the expected values: \"$expectedValue1\" or \"$expectedValue2\""); + Assert::assertTrue( + $isExpectedValueInMessage, + "The actual value \"$value\" is not one of the expected values: \"$expectedValue1\" or \"$expectedValue2\"" + ); } /** @@ -850,7 +875,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function assertValueOfItemInResponseRegExp(string $xpath, string $pattern):void { + public function assertValueOfItemInResponseRegExp(string $xpath, string $pattern): void { $this->assertXpathValueMatchesPattern( HttpRequestHelper::getResponseXml($this->featureContext->getResponse()), $xpath, @@ -868,7 +893,11 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function publicGetsThePropertiesOfFolderAndAssertValueOfItemInResponseRegExp(string $xpath, string $path, string $pattern):void { + public function publicGetsThePropertiesOfFolderAndAssertValueOfItemInResponseRegExp( + string $xpath, + string $path, + string $pattern + ): void { $propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]); $response = $this->getPropertiesOfEntryFromLastLinkShare($path, $propertiesTable); $this->featureContext->theHTTPStatusCodeShouldBe('207', "", $response); @@ -888,7 +917,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function assertEntryWithHrefMatchingRegExpInResponseToUser(string $expectedHref, string $user):void { + public function assertEntryWithHrefMatchingRegExpInResponseToUser(string $expectedHref, string $user): void { $responseXmlObject = HttpRequestHelper::getResponseXml( $this->featureContext->getResponse(), __METHOD__ @@ -947,7 +976,12 @@ class WebDavPropertiesContext implements Context { * @return void * @throws JsonException */ - public function assertXpathValueMatchesPattern(SimpleXMLElement $responseXmlObject, string $xpath, string $pattern, ?string $user = null): void { + public function assertXpathValueMatchesPattern( + SimpleXMLElement $responseXmlObject, + string $xpath, + string $pattern, + ?string $user = null + ): void { $xmlPart = $responseXmlObject->xpath($xpath); Assert::assertTrue( isset($xmlPart[0]), @@ -955,7 +989,8 @@ class WebDavPropertiesContext implements Context { ); $user = $this->featureContext->getActualUsername($user); $value = $xmlPart[0]->__toString(); - $callback = ($this->featureContext->isUsingSharingNG()) ? "shareNgGetLastCreatedLinkShareToken" : "getLastCreatedPublicShareToken"; + $callback = ($this->featureContext->isUsingSharingNG()) + ? "shareNgGetLastCreatedLinkShareToken" : "getLastCreatedPublicShareToken"; if (\str_ends_with($xpath, "d:href")) { $pattern = \preg_replace("/^\//", "", $pattern); @@ -996,7 +1031,12 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function userGetsPropertiesOfFolderAndAssertValueOfItemInResponseToUserRegExp(string $user, string $xpath, string $path, string $pattern):void { + public function userGetsPropertiesOfFolderAndAssertValueOfItemInResponseToUserRegExp( + string $user, + string $xpath, + string $path, + string $pattern + ): void { $propertiesTable = new TableNode([['propertyName'],['d:lockdiscovery']]); $response = $this->getPropertiesOfFolder( $user, @@ -1021,7 +1061,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function assertItemInResponseDoesNotExist(string $xpath):void { + public function assertItemInResponseDoesNotExist(string $xpath): void { $xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath($xpath); Assert::assertFalse( isset($xmlPart[0]), @@ -1047,7 +1087,7 @@ class WebDavPropertiesContext implements Context { string $property, string $expectedValue, ?string $altExpectedValue = null - ):void { + ): void { $this->checkPropertyOfAFolder($user, $path, $property, $expectedValue, $altExpectedValue); } @@ -1068,7 +1108,7 @@ class WebDavPropertiesContext implements Context { string $expectedValue, ?string $altExpectedValue = null, ?string $spaceId = null, - ):void { + ): void { $response = $this->featureContext->listFolder( $user, $path, @@ -1099,7 +1139,7 @@ class WebDavPropertiesContext implements Context { public function theSingleResponseShouldContainAPropertyWithValueLike( string $key, string $regex - ):void { + ): void { $xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath( "//d:prop/$key" ); @@ -1123,7 +1163,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function theResponseShouldContainAShareTypesPropertyWith(TableNode $table):void { + public function theResponseShouldContainAShareTypesPropertyWith(TableNode $table): void { $this->featureContext->verifyTableNodeColumnsCount($table, 1); WebdavTest::assertResponseContainsShareTypes( HttpRequestHelper::getResponseXml($this->featureContext->getResponse()), @@ -1139,7 +1179,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function theResponseShouldContainAnEmptyProperty(string $property):void { + public function theResponseShouldContainAnEmptyProperty(string $property): void { $xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath( "//d:prop/$property" ); @@ -1163,7 +1203,12 @@ class WebDavPropertiesContext implements Context { * @return SimpleXMLElement * @throws Exception */ - public function storeEtagOfElement(string $user, string $path, ?string $storePath = "", ?string $spaceId = null):SimpleXMLElement { + public function storeEtagOfElement( + string $user, + string $path, + ?string $storePath = "", + ?string $spaceId = null + ): SimpleXMLElement { if ($storePath === "") { $storePath = $path; } @@ -1190,7 +1235,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function userStoresEtagOfElement(string $user, string $path):void { + public function userStoresEtagOfElement(string $user, string $path): void { $this->storeEtagOfElement( $user, $path @@ -1207,7 +1252,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function userStoresEtagOfElementOnPath(string $user, string $path, string $storePath):void { + public function userStoresEtagOfElementOnPath(string $user, string $path, string $storePath): void { $user = $this->featureContext->getActualUsername($user); $this->storeEtagOfElement( $user, @@ -1231,7 +1276,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function userHasStoredEtagOfElement(string $user, string $path):void { + public function userHasStoredEtagOfElement(string $user, string $path): void { $user = $this->featureContext->getActualUsername($user); $this->storeEtagOfElement( $user, @@ -1248,7 +1293,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function thePropertiesResponseShouldContainAnEtag():void { + public function thePropertiesResponseShouldContainAnEtag(): void { Assert::assertTrue( $this->featureContext->isEtagValid($this->featureContext->getEtagFromResponseXmlObject()), __METHOD__ @@ -1287,8 +1332,11 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function theResponseShouldHavePropertyWithValue(string $username, TableNode $expectedPropTable):void { - $this->featureContext->verifyTableNodeColumns($expectedPropTable, ['resource', 'propertyName', 'propertyValue']); + public function theResponseShouldHavePropertyWithValue(string $username, TableNode $expectedPropTable): void { + $this->featureContext->verifyTableNodeColumns( + $expectedPropTable, + ['resource', 'propertyName', 'propertyValue'] + ); $responseXmlObject = HttpRequestHelper::getResponseXml($this->featureContext->getResponse()); $href = (string)$responseXmlObject->xpath("//d:href")[0]; @@ -1315,7 +1363,7 @@ class WebDavPropertiesContext implements Context { * @return string * @throws Exception */ - public function getCurrentEtagOfElement(string $path, string $user):string { + public function getCurrentEtagOfElement(string $path, string $user): string { $user = $this->featureContext->getActualUsername($user); $propertiesTable = new TableNode([['propertyName'],['d:getetag']]); $response = $this->getPropertiesOfFolder( @@ -1324,7 +1372,9 @@ class WebDavPropertiesContext implements Context { null, $propertiesTable ); - return $this->featureContext->getEtagFromResponseXmlObject(HttpRequestHelper::getResponseXml($response, __METHOD__)); + return $this->featureContext->getEtagFromResponseXmlObject( + HttpRequestHelper::getResponseXml($response, __METHOD__) + ); } /** @@ -1334,7 +1384,7 @@ class WebDavPropertiesContext implements Context { * * @return string */ - public function getStoredEtagOfElement(string $path, string $user, string $messageStart = ''):string { + public function getStoredEtagOfElement(string $path, string $user, string $messageStart = ''): string { if ($messageStart === '') { $messageStart = __METHOD__; } @@ -1348,7 +1398,8 @@ class WebDavPropertiesContext implements Context { $path, $this->storedETAG[$user], $messageStart - . " Trying to check etag of element $path of user $user but the user does not have a stored etag for the element" + . " Trying to check etag of element $path of user " + . "$user but the user does not have a stored etag for the element" ); return $this->storedETAG[$user][$path]; } @@ -1361,7 +1412,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function theseEtagsShouldNotHaveChanged(TableNode $etagTable):void { + public function theseEtagsShouldNotHaveChanged(TableNode $etagTable): void { $this->featureContext->verifyTableNodeColumns($etagTable, ["user", "path"]); $this->featureContext->verifyTableNodeColumnsCount($etagTable, 2); $changedEtagCount = 0; @@ -1389,7 +1440,7 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function theseEtagsShouldHaveChanged(TableNode $etagTable):void { + public function theseEtagsShouldHaveChanged(TableNode $etagTable): void { $this->featureContext->verifyTableNodeColumns($etagTable, ["user", "path"]); $this->featureContext->verifyTableNodeColumnsCount($etagTable, 2); $unchangedEtagCount = 0; @@ -1419,7 +1470,11 @@ class WebDavPropertiesContext implements Context { * @return void * @throws Exception */ - public function etagOfElementOfUserShouldOrShouldNotHaveChanged(string $path, string $user, string $shouldShouldNot):void { + public function etagOfElementOfUserShouldOrShouldNotHaveChanged( + string $path, + string $user, + string $shouldShouldNot + ): void { $user = $this->featureContext->getActualUsername($user); $actualEtag = $this->getCurrentEtagOfElement($path, $user); $storedEtag = $this->getStoredEtagOfElement($path, $user, __METHOD__); @@ -1452,7 +1507,7 @@ class WebDavPropertiesContext implements Context { * * @return void */ - public function before(BeforeScenarioScope $scope):void { + public function before(BeforeScenarioScope $scope): void { // Get the environment $environment = $scope->getEnvironment(); // Get all the contexts you need in this context diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 04a57217c77..57948c74c69 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -431,6 +431,7 @@ default: contexts: - FeatureContext: *common_feature_context_params - AuthAppContext: + - CliContext: cliCommands: paths: diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 3eea82cd2f1..86a84f58118 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -322,5 +322,9 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSharingNg1/propfindShares.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg1/propfindShares.feature#L149) +#### [Readiness check for some services returns 500 status code](https://github.com/owncloud/ocis/issues/10661) +- [apiServiceAvailability/serviceAvailabilityCheck.feature:116](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature#L116) +- [apiServiceAvailability/serviceAvailabilityCheck.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature#L125) + Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/expected-failures-without-remotephp.md b/tests/acceptance/expected-failures-without-remotephp.md index f4fb796c5db..6aefe6f9dec 100644 --- a/tests/acceptance/expected-failures-without-remotephp.md +++ b/tests/acceptance/expected-failures-without-remotephp.md @@ -195,6 +195,9 @@ - [apiSpaces/publicLink.feature:28](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L28) - [apiSpaces/publicLink.feature:34](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L34) - [apiSpaces/publicLink.feature:40](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/publicLink.feature#L40) +- [apiSpaces/uploadSpaces.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L98) +- [apiSpaces/uploadSpaces.feature:115](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L115) +- [apiSpaces/uploadSpaces.feature:132](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/uploadSpaces.feature#L132) - [apiSpacesShares/shareSpacesViaLink.feature:61](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature#L61) - [apiDepthInfinity/propfind.feature:74](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiDepthInfinity/propfind.feature#L74) - [apiDepthInfinity/propfind.feature:124](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiDepthInfinity/propfind.feature#L124) diff --git a/tests/acceptance/features/apiAntivirus/serviceAvailabilityCheck.feature b/tests/acceptance/features/apiAntivirus/serviceAvailabilityCheck.feature index e686283445e..0c927b3e289 100644 --- a/tests/acceptance/features/apiAntivirus/serviceAvailabilityCheck.feature +++ b/tests/acceptance/features/apiAntivirus/serviceAvailabilityCheck.feature @@ -2,14 +2,14 @@ Feature: service health check Scenario: check service health - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9297/healthz | antivirus | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9297/healthz | antivirus | Then the HTTP status code of responses on all endpoints should be "200" Scenario: check service readiness - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9297/readyz | antivirus | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9297/readyz | antivirus | Then the HTTP status code of responses on all endpoints should be "200" diff --git a/tests/acceptance/features/apiAuthApp/token.feature b/tests/acceptance/features/apiAuthApp/token.feature index 53de35f2188..a4b3d92b661 100644 --- a/tests/acceptance/features/apiAuthApp/token.feature +++ b/tests/acceptance/features/apiAuthApp/token.feature @@ -1,13 +1,13 @@ -Feature: create auth token +Feature: create auth-app token As a user - I want to create App Tokens + I want to create auth-app Tokens So that I can use 3rd party apps Background: Given user "Alice" has been created with default attributes - Scenario: user creates app token + Scenario: user creates auth-app token When user "Alice" creates app token with expiration time "72h" using the auth-app API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -22,7 +22,6 @@ Feature: create auth token ], "properties": { "token": { - "type": "string", "pattern": "^[a-zA-Z0-9]{16}$" }, "label": { @@ -34,8 +33,8 @@ Feature: create auth token Scenario: user lists app tokens - Given user "Alice" has created app token with expiration time "72h" - And user "Alice" has created app token with expiration time "2h" + Given user "Alice" has created app token with expiration time "72h" using the auth-app API + And user "Alice" has created app token with expiration time "72h" using the auth-app CLI When user "Alice" lists all created tokens using the auth-app API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -46,22 +45,42 @@ Feature: create auth token "maxItems": 2, "uniqueItems": true, "items": { - "type": "object", - "required": [ - "token", - "expiration_date", - "created_date", - "label" - ], - "properties": { - "token": { - "type": "string", - "pattern": "^\\$2a\\$11\\$[A-Za-z0-9./]{53}$" + "oneOf": [ + { + "type": "object", + "required": [ + "token", + "expiration_date", + "created_date", + "label" + ], + "properties": { + "token": { + "pattern": "^\\$2a\\$11\\$[A-Za-z0-9./]{53}$" + }, + "label": { + "const": "Generated via API" + } + } }, - "label": { - "const": "Generated via API" + { + "type": "object", + "required": [ + "token", + "expiration_date", + "created_date", + "label" + ], + "properties": { + "token": { + "pattern": "^\\$2a\\$11\\$[A-Za-z0-9./]{53}$" + }, + "label": { + "const": "Generated via CLI" + } + } } - } + ] } } """ diff --git a/tests/acceptance/features/apiCollaboration/serviceAvailabilityCheck.feature b/tests/acceptance/features/apiCollaboration/serviceAvailabilityCheck.feature index 866c2d1fbc8..3cc49f955e4 100644 --- a/tests/acceptance/features/apiCollaboration/serviceAvailabilityCheck.feature +++ b/tests/acceptance/features/apiCollaboration/serviceAvailabilityCheck.feature @@ -2,14 +2,14 @@ Feature: service health check Scenario: check service health - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %collaboration_hostname%:9304/healthz | collaboration | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%collaboration_hostname%:9304/healthz | collaboration | Then the HTTP status code of responses on all endpoints should be "200" Scenario: check service readiness - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %collaboration_hostname%:9304/readyz | collaboration | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%collaboration_hostname%:9304/readyz | collaboration | Then the HTTP status code of responses on all endpoints should be "200" diff --git a/tests/acceptance/features/apiNotification/serviceAvailabilityCheck.feature b/tests/acceptance/features/apiNotification/serviceAvailabilityCheck.feature index 1f343875ab6..de33960749d 100644 --- a/tests/acceptance/features/apiNotification/serviceAvailabilityCheck.feature +++ b/tests/acceptance/features/apiNotification/serviceAvailabilityCheck.feature @@ -2,14 +2,14 @@ Feature: service health check Scenario: check service health - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9174/healthz | notification | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9174/healthz | notification | Then the HTTP status code of responses on all endpoints should be "200" Scenario: check service readiness - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9174/readyz | notification | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9174/readyz | notification | Then the HTTP status code of responses on all endpoints should be "200" diff --git a/tests/acceptance/features/apiOcm/listPermissions.feature b/tests/acceptance/features/apiOcm/listPermissions.feature new file mode 100644 index 00000000000..7f383dae98c --- /dev/null +++ b/tests/acceptance/features/apiOcm/listPermissions.feature @@ -0,0 +1,272 @@ +@ocm +Feature: List a federated sharing permissions + As a user + I want to list the permissions for federated share + So that the federated share is assigned the correct permissions + + Background: + Given user "Alice" has been created with default attributes + + @issue-9898 + Scenario: user lists permissions of a resource shared to a federated user + Given using server "LOCAL" + And "Alice" has created the federation share invitation + And using server "REMOTE" + And user "Brian" has been created with default attributes + And "Brian" has accepted invitation + And using server "LOCAL" + And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Alice" gets permissions list for file "textfile.txt" of the space "Personal" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues", + "value" + ], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType","displayName","id"], + "properties": { + "@libre.graph.userType": { + "const": "Federated" + }, + "id": { + "type": "string", + "pattern": "^%federated_user_id_pattern%$" + }, + "displayName": { + "const": "Brian Murphy" + } + } + } + } + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { + "const": "Member" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + } + } + } + ] + } + } + } + } + """ + + @issue-9745 @env-config + Scenario: user lists allowed file permissions for federated user + Given using server "LOCAL" + And the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" + When user "Alice" gets the allowed roles for federated user of file "textfile.txt" from the space "Personal" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "View and download." + }, + "displayName": { + "const": "Can view" + }, + "id": { + "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "View, download and edit." + }, + "displayName": { + "const": "Can edit" + }, + "id": { + "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" + } + } + } + ] + } + } + } + } + """ + + @issue-9745 + Scenario: user lists allowed folder permissions for federated user + Given using server "LOCAL" + And the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has created folder "folderToShare" + When user "Alice" gets the allowed roles for federated user of folder "folderToShare" from the space "Personal" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "View and download." + }, + "displayName": { + "const": "Can view" + }, + "id": { + "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "View, download, upload, edit, add and delete." + }, + "displayName": { + "const": "Can edit" + }, + "id": { + "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" + } + } + } + ] + } + } + } + } + """ diff --git a/tests/acceptance/features/apiOcm/ocmEndpoint.feature b/tests/acceptance/features/apiOcm/ocmEndpoint.feature new file mode 100644 index 00000000000..f40ae7a8793 --- /dev/null +++ b/tests/acceptance/features/apiOcm/ocmEndpoint.feature @@ -0,0 +1,84 @@ +@ocm +Feature: ocm well-known URI + As a user + I want to verify the response of well-known URI + So that I can ensure the configuration works correctly + + + Scenario: check the ocm well-known endpoint response + Given using server "LOCAL" + When a user requests "/.well-known/ocm" with "GET" and no authentication + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "enabled", + "apiVersion", + "endPoint", + "provider", + "resourceTypes", + "capabilities" + ], + "properties": { + "enabled": { + "const": true + }, + "apiVersion": { + "const": "1.1.0" + }, + "endPoint": { + "pattern": "^%base_url%/ocm" + }, + "provider": { + "const": "oCIS" + }, + "resourceTypes": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "name", + "shareTypes", + "protocols" + ], + "properties": { + "name": { + "const": "file" + }, + "sharesTypes": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "const": "user" + } + }, + "protocols": { + "type": "object", + "required": [ + "webdav" + ], + "properties": { + "webdav": { + "const": "/dav/ocm" + } + } + } + } + } + }, + "capabilities": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "const": "/invite-accepted" + } + } + } + } + """ diff --git a/tests/acceptance/features/apiOcm/share.feature b/tests/acceptance/features/apiOcm/share.feature index 4e31236f12a..7107339ff8c 100755 --- a/tests/acceptance/features/apiOcm/share.feature +++ b/tests/acceptance/features/apiOcm/share.feature @@ -796,122 +796,6 @@ Feature: an user shares resources using ScienceMesh application } """ - @issue-9898 - Scenario: user lists permissions of a resource shared to a federated user - Given using server "LOCAL" - And "Alice" has created the federation share invitation - And using server "REMOTE" - And "Brian" has accepted invitation - And using server "LOCAL" - And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" - And user "Alice" has sent the following resource share invitation to federated user: - | resource | textfile.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - And using server "LOCAL" - When user "Alice" gets permissions list for file "textfile.txt" of the space "Personal" using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": [ - "@libre.graph.permissions.actions.allowedValues", - "@libre.graph.permissions.roles.allowedValues", - "value" - ], - "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "uniqueItems": true, - "items": { - "oneOf":[ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["@libre.graph.userType","displayName","id"], - "properties": { - "@libre.graph.userType": { - "type": "string", - "const": "Federated" - }, - "id": { - "type": "string", - "pattern": "^%federated_user_id_pattern%$" - }, - "displayName": { - "const": "Brian Murphy" - } - } - } - } - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["@libre.graph.userType", "displayName", "id"], - "properties": { - "@libre.graph.userType": { - "type": "string", - "const": "Member" - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "const": "Alice Hansen" - } - } - } - } - } - } - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - } - } - } - ] - } - } - } - } - """ - @issue-10222 @issue-10495 Scenario: local user lists multiple federation shares Given using server "LOCAL" @@ -1297,3 +1181,36 @@ Feature: an user shares resources using ScienceMesh application | Viewer | | Uploader | | Editor | + + @issue-10272 + Scenario: federated user downloads shared resources as an archive + Given using spaces DAV path + And using server "REMOTE" + And "Brian" has created the federation share invitation + And using server "LOCAL" + And "Alice" has accepted invitation + And user "Alice" has uploaded file with content "some data" to "textfile.txt" + And user "Alice" has created folder "imageFolder" + And user "Alice" has uploaded file "filesForUpload/testavatar.png" to "imageFolder/testavatar.png" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Alice" has sent the following resource share invitation to federated user: + | resource | imageFolder | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And using server "REMOTE" + When user "Brian" downloads the archive of these items using the resource remoteItemIds + | textfile.txt | + | imageFolder | + Then the HTTP status code should be "200" + And the downloaded zip archive should contain these files: + | name | content | + | textfile.txt | some data | + | imageFolder | | + | imageFolder/testavatar.png | | diff --git a/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature b/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature index faf55b6aaa8..6fffb3e8104 100644 --- a/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature +++ b/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature @@ -2,42 +2,42 @@ Feature: service health check Scenario: check default services health - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9197/healthz | activitylog | - | %base_url_hostname%:9165/healthz | app-provider | - | %base_url_hostname%:9243/healthz | app-registry | - | %base_url_hostname%:9147/healthz | auth-basic | - | %base_url_hostname%:9167/healthz | auth-machine | - | %base_url_hostname%:9198/healthz | auth-service | - | %base_url_hostname%:9260/healthz | clientlog | - | %base_url_hostname%:9270/healthz | eventhistory | - | %base_url_hostname%:9141/healthz | frontend | - | %base_url_hostname%:9143/healthz | gateway | - | %base_url_hostname%:9124/healthz | graph | - | %base_url_hostname%:9161/healthz | groups | - | %base_url_hostname%:9239/healthz | idm | - | %base_url_hostname%:9134/healthz | idp | - | %base_url_hostname%:9234/healthz | nats | - | %base_url_hostname%:9163/healthz | ocdav | - | %base_url_hostname%:9281/healthz | ocm | - | %base_url_hostname%:9114/healthz | ocs | - | %base_url_hostname%:9255/healthz | postprocessing | - | %base_url_hostname%:9205/healthz | proxy | - | %base_url_hostname%:9224/healthz | search | - | %base_url_hostname%:9194/healthz | settings | - | %base_url_hostname%:9151/healthz | sharing | - | %base_url_hostname%:9139/healthz | sse | - | %base_url_hostname%:9179/healthz | storage-publiclink | - | %base_url_hostname%:9156/healthz | storage-shares | - | %base_url_hostname%:9217/healthz | storage-system | - | %base_url_hostname%:9159/healthz | storage-users | - | %base_url_hostname%:9189/healthz | thumbnails | - | %base_url_hostname%:9214/healthz | userlog | - | %base_url_hostname%:9145/healthz | users | - | %base_url_hostname%:9104/healthz | web | - | %base_url_hostname%:9119/healthz | webdav | - | %base_url_hostname%:9279/healthz | webfinger | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9197/healthz | activitylog | + | http://%base_url_hostname%:9165/healthz | app-provider | + | http://%base_url_hostname%:9243/healthz | app-registry | + | http://%base_url_hostname%:9147/healthz | auth-basic | + | http://%base_url_hostname%:9167/healthz | auth-machine | + | http://%base_url_hostname%:9198/healthz | auth-service | + | http://%base_url_hostname%:9260/healthz | clientlog | + | http://%base_url_hostname%:9270/healthz | eventhistory | + | http://%base_url_hostname%:9141/healthz | frontend | + | http://%base_url_hostname%:9143/healthz | gateway | + | http://%base_url_hostname%:9124/healthz | graph | + | http://%base_url_hostname%:9161/healthz | groups | + | http://%base_url_hostname%:9239/healthz | idm | + | http://%base_url_hostname%:9134/healthz | idp | + | http://%base_url_hostname%:9234/healthz | nats | + | http://%base_url_hostname%:9163/healthz | ocdav | + | http://%base_url_hostname%:9281/healthz | ocm | + | http://%base_url_hostname%:9114/healthz | ocs | + | http://%base_url_hostname%:9255/healthz | postprocessing | + | http://%base_url_hostname%:9205/healthz | proxy | + | http://%base_url_hostname%:9224/healthz | search | + | http://%base_url_hostname%:9194/healthz | settings | + | http://%base_url_hostname%:9151/healthz | sharing | + | http://%base_url_hostname%:9139/healthz | sse | + | http://%base_url_hostname%:9179/healthz | storage-publiclink | + | http://%base_url_hostname%:9156/healthz | storage-shares | + | http://%base_url_hostname%:9217/healthz | storage-system | + | http://%base_url_hostname%:9159/healthz | storage-users | + | http://%base_url_hostname%:9189/healthz | thumbnails | + | http://%base_url_hostname%:9214/healthz | userlog | + | http://%base_url_hostname%:9145/healthz | users | + | http://%base_url_hostname%:9104/healthz | web | + | http://%base_url_hostname%:9119/healthz | webdav | + | http://%base_url_hostname%:9279/healthz | webfinger | Then the HTTP status code of responses on all endpoints should be "200" @env-config @@ -47,56 +47,51 @@ Feature: service health check | OCIS_ADD_RUN_SERVICES | audit,auth-app,auth-bearer,policies,invitations | | AUDIT_DEBUG_ADDR | 0.0.0.0:9229 | | AUTH_APP_DEBUG_ADDR | 0.0.0.0:9245 | - | AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 | | POLICIES_DEBUG_ADDR | 0.0.0.0:9129 | | INVITATIONS_DEBUG_ADDR | 0.0.0.0:9269 | - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9229/healthz | audit | - | %base_url_hostname%:9245/healthz | auth-app | - | %base_url_hostname%:9149/healthz | auth-bearer | - | %base_url_hostname%:9269/healthz | invitations | - | %base_url_hostname%:9129/healthz | policies | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9229/healthz | audit | + | http://%base_url_hostname%:9245/healthz | auth-app | + | http://%base_url_hostname%:9269/healthz | invitations | + | http://%base_url_hostname%:9129/healthz | policies | Then the HTTP status code of responses on all endpoints should be "200" Scenario: check default services readiness - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9197/readyz | activitylog | - | %base_url_hostname%:9165/readyz | app-provider | - | %base_url_hostname%:9243/readyz | app-registry | - | %base_url_hostname%:9147/readyz | auth-basic | - | %base_url_hostname%:9167/readyz | auth-machine | - | %base_url_hostname%:9198/readyz | auth-service | - | %base_url_hostname%:9260/readyz | clientlog | - | %base_url_hostname%:9270/readyz | eventhistory | - | %base_url_hostname%:9141/readyz | frontend | - | %base_url_hostname%:9143/readyz | gateway | - | %base_url_hostname%:9124/readyz | graph | - | %base_url_hostname%:9161/readyz | groups | - | %base_url_hostname%:9239/readyz | idm | - | %base_url_hostname%:9134/readyz | idp | - | %base_url_hostname%:9234/readyz | nats | - | %base_url_hostname%:9163/readyz | ocdav | - | %base_url_hostname%:9281/readyz | ocm | - | %base_url_hostname%:9114/readyz | ocs | - | %base_url_hostname%:9255/readyz | postprocessing | - | %base_url_hostname%:9205/readyz | proxy | - | %base_url_hostname%:9224/readyz | search | - | %base_url_hostname%:9194/readyz | settings | - | %base_url_hostname%:9151/readyz | sharing | - | %base_url_hostname%:9139/readyz | sse | - | %base_url_hostname%:9179/readyz | storage-publiclink | - | %base_url_hostname%:9156/readyz | storage-shares | - | %base_url_hostname%:9217/readyz | storage-system | - | %base_url_hostname%:9159/readyz | storage-users | - | %base_url_hostname%:9189/readyz | thumbnails | - | %base_url_hostname%:9214/readyz | userlog | - | %base_url_hostname%:9145/readyz | users | - | %base_url_hostname%:9104/readyz | web | - | %base_url_hostname%:9119/readyz | webdav | - | %base_url_hostname%:9279/readyz | webfinger | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9197/readyz | activitylog | + | http://%base_url_hostname%:9165/readyz | app-provider | + | http://%base_url_hostname%:9243/readyz | app-registry | + | http://%base_url_hostname%:9147/readyz | auth-basic | + | http://%base_url_hostname%:9167/readyz | auth-machine | + | http://%base_url_hostname%:9198/readyz | auth-service | + | http://%base_url_hostname%:9260/readyz | clientlog | + | http://%base_url_hostname%:9270/readyz | eventhistory | + | http://%base_url_hostname%:9141/readyz | frontend | + | http://%base_url_hostname%:9143/readyz | gateway | + | http://%base_url_hostname%:9161/readyz | groups | + | http://%base_url_hostname%:9239/readyz | idm | + | http://%base_url_hostname%:9234/readyz | nats | + | http://%base_url_hostname%:9163/readyz | ocdav | + | http://%base_url_hostname%:9281/readyz | ocm | + | http://%base_url_hostname%:9114/readyz | ocs | + | http://%base_url_hostname%:9255/readyz | postprocessing | + | http://%base_url_hostname%:9224/readyz | search | + | http://%base_url_hostname%:9194/readyz | settings | + | http://%base_url_hostname%:9151/readyz | sharing | + | http://%base_url_hostname%:9139/readyz | sse | + | http://%base_url_hostname%:9179/readyz | storage-publiclink | + | http://%base_url_hostname%:9156/readyz | storage-shares | + | http://%base_url_hostname%:9217/readyz | storage-system | + | http://%base_url_hostname%:9159/readyz | storage-users | + | http://%base_url_hostname%:9189/readyz | thumbnails | + | http://%base_url_hostname%:9214/readyz | userlog | + | http://%base_url_hostname%:9145/readyz | users | + | http://%base_url_hostname%:9104/readyz | web | + | http://%base_url_hostname%:9119/readyz | webdav | + | http://%base_url_hostname%:9279/readyz | webfinger | Then the HTTP status code of responses on all endpoints should be "200" @env-config @@ -109,11 +104,30 @@ Feature: service health check | AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 | | POLICIES_DEBUG_ADDR | 0.0.0.0:9129 | | INVITATIONS_DEBUG_ADDR | 0.0.0.0:9269 | - When a user requests these endpoints with "GET" and no authentication - | endpoint | service | - | %base_url_hostname%:9229/readyz | audit | - | %base_url_hostname%:9245/readyz | auth-app | - | %base_url_hostname%:9149/readyz | auth-bearer | - | %base_url_hostname%:9269/readyz | invitations | - | %base_url_hostname%:9129/readyz | policies | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9229/readyz | audit | + | http://%base_url_hostname%:9245/readyz | auth-app | + | http://%base_url_hostname%:9269/readyz | invitations | + | http://%base_url_hostname%:9129/readyz | policies | + Then the HTTP status code of responses on all endpoints should be "200" + + @issue-10661 + Scenario: check default services readiness + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9124/readyz | graph | + | http://%base_url_hostname%:9134/readyz | idp | + | http://%base_url_hostname%:9205/readyz | proxy | + Then the HTTP status code of responses on all endpoints should be "200" + + @env-config @issue-10661 + Scenario: check extra services readiness + Given the following configs have been set: + | config | value | + | OCIS_ADD_RUN_SERVICES | auth-bearer | + | AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 | + When a user requests these URLs with "GET" and no authentication + | endpoint | service | + | http://%base_url_hostname%:9149/readyz | auth-bearer | Then the HTTP status code of responses on all endpoints should be "200" diff --git a/tests/acceptance/features/apiSharingNg1/enableDisablePermissionsRole.feature b/tests/acceptance/features/apiSharingNg1/enableDisablePermissionsRole.feature new file mode 100644 index 00000000000..1196b450870 --- /dev/null +++ b/tests/acceptance/features/apiSharingNg1/enableDisablePermissionsRole.feature @@ -0,0 +1,549 @@ +@env-config +Feature: enable disable permissions role + As a user + I want to enable/disable permissions role on shared resources + So that I can control the accessibility of shared resources to sharee + + Background: + Given these users have been created with default attributes: + | username | + | Alice | + | Brian | + + + Scenario Outline: users list the shares shared with Secure Viewer after the role is disabled (Personal Space) + Given the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And user "Alice" has created folder "folderToShare" + And user "Alice" has uploaded file with content "hello world" to "folderToShare/textfile1.txt" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "" synced + And the administrator has disabled the permissions role "Secure Viewer" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name" + ], + "properties": { + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "const": [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + }, + "roles": { "const": null } + } + } + } + } + } + """ + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@UI.Hidden", + "@client.synchronize", + "createdBy", + "eTag", + "", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "remoteItem" + ], + "properties": { + "remoteItem": { + "type": "object", + "required": [ + "createdBy", + "eTag", + "", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions" + ], + "properties": { + "name": { "const": "" }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "const": [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + }, + "roles": { "const": null } + } + } + } + } + } + } + } + } + } + } + """ + And user "Brian" should have a share "" shared by user "Alice" from space "Personal" + When user "Brian" sends PROPFIND request from the space "Shares" to the resource "" with depth "0" using the WebDAV API + Then the HTTP status code should be "207" + And as user "Brian" the PROPFIND response should contain a resource "" with these key and value pairs: + | key | value | + | oc:name | | + | oc:permissions | SX | + And user "Brian" should not be able to download file "" from space "Shares" + Examples: + | resource | resource-type | resource-to-download | + | textfile.txt | file | textfile.txt | + | folderToShare | folder | folderToShare/textfile1.txt | + + + Scenario: users list the shares shared with Denied after the role is disabled (Personal Space) + Given the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "folderToShare" + And user "Alice" has uploaded file with content "hello world" to "folderToShare/textfile1.txt" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "folderToShare" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name" + ], + "properties": { + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "const": ["none"] + }, + "roles": { "const": null } + } + } + } + } + } + """ + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 0, + "maxItems": 0 + } + } + } + """ + And user "Brian" should not have a share "folderToShare" shared by user "Alice" from space "Personal" + When user "Brian" sends PROPFIND request from the space "Shares" to the resource "folderToShare" with depth "0" using the WebDAV API + Then the HTTP status code should be "404" + And user "Brian" should not be able to download file "folderToShare/textfile1.txt" from space "Shares" + + + Scenario Outline: users list the shares shared with Secure Viewer after the role is disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Secure Viewer" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt" + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has uploaded a file inside space "new-space" with content "hello world" to "folderToShare/textfile1.txt" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "" synced + And the administrator has disabled the permissions role "Secure Viewer" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name" + ], + "properties": { + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "const": [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + }, + "roles": { "const": null } + } + } + } + } + } + """ + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@UI.Hidden", + "@client.synchronize", + "eTag", + "", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "remoteItem" + ], + "properties": { + "remoteItem": { + "type": "object", + "required": [ + "eTag", + "", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions" + ], + "properties": { + "name": { "const": "" }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "const": [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + }, + "roles": { "const": null } + } + } + } + } + } + } + } + } + } + } + """ + And user "Brian" should have a share "" shared by user "Alice" from space "new-space" + When user "Brian" sends PROPFIND request from the space "Shares" to the resource "" with depth "0" using the WebDAV API + Then the HTTP status code should be "207" + And as user "Brian" the PROPFIND response should contain a resource "" with these key and value pairs: + | key | value | + | oc:name | | + | oc:permissions | SX | + And user "Brian" should not be able to download file "" from space "Shares" + Examples: + | resource | resource-type | resource-to-download | + | textfile.txt | file | textfile.txt | + | folderToShare | folder | folderToShare/textfile1.txt | + + + Scenario: users list the shares shared with Denied after the role is disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has uploaded a file inside space "new-space" with content "hello world" to "folderToShare/textfile1.txt" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "folderToShare" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name" + ], + "properties": { + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "const": ["none"] + }, + "roles": { "const": null } + } + } + } + } + } + """ + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 0, + "maxItems": 0 + } + } + } + """ + And user "Brian" should not have a share "folderToShare" shared by user "Alice" from space "Personal" + When user "Brian" sends PROPFIND request from the space "Shares" to the resource "folderToShare" with depth "0" using the WebDAV API + Then the HTTP status code should be "404" + And user "Brian" should not be able to download file "folderToShare/textfile1.txt" from space "Shares" + + + Scenario: sharee lists drives after the share role Space Editor Without Versions has been disabled + Given using spaces DAV path + And the administrator has enabled the permissions role "Space Editor Without Versions" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "new-space" with content "hello world" to "textfile1.txt" + And user "Alice" has sent the following space share invitation: + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Editor Without Versions | + And the administrator has disabled the permissions role "Space Editor Without Versions" + When user "Brian" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "new-space" and match + """ + { + "type": "object", + "required": [ + "driveType", + "driveAlias", + "name", + "id", + "quota", + "root", + "webUrl" + ], + "properties": { + "root": { + "type": "object", + "required": [ + "eTag", + "id", + "permissions", + "webDavUrl" + ], + "properties": { + "permissions": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["grantedToV2", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user" : { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { "const": "Member" }, + "displayName": { "const": "Alice Hansen" }, + "id": { "pattern": "^%user_id_pattern%$" } + } + } + } + }, + "roles": { "pattern": "^%role_id_pattern%$" } + } + }, + { + "type": "object", + "required": ["@libre.graph.permissions.actions", "grantedToV2"], + "properties": { + "@libre.graph.permissions.actions": { + "const": [ + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read" + ] + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { "const": "Member" }, + "displayName": { "const": "Brian Murphy" }, + "id": { "pattern": "^%user_id_pattern%$" } + } + } + } + } + } + } + ] + } + } + } + } + } + } + """ + When user "Brian" sends PROPFIND request to space "new-space" with depth "0" using the WebDAV API + Then the HTTP status code should be "207" + And as user "Brian" the PROPFIND response should contain a space "new-space" with these key and value pairs: + | key | value | + | oc:name | new-space | + | oc:permissions | DNVCK | + And user "Brian" should be able to download file "textfile1.txt" from space "new-space" diff --git a/tests/acceptance/features/apiSharingNg1/listPermissions.feature b/tests/acceptance/features/apiSharingNg1/listPermissions.feature index 7b78789ff7a..4d7a6285e2d 100644 --- a/tests/acceptance/features/apiSharingNg1/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg1/listPermissions.feature @@ -21,29 +21,26 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.permissions.actions.allowedValues": { - "type": "array", - "enum": [ - [ - "libre.graph/driveItem/permissions/create", - "libre.graph/driveItem/children/create", - "libre.graph/driveItem/standard/delete", - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/quota/read", - "libre.graph/driveItem/content/read", - "libre.graph/driveItem/upload/create", - "libre.graph/driveItem/permissions/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/versions/read", - "libre.graph/driveItem/deleted/read", - "libre.graph/driveItem/path/update", - "libre.graph/driveItem/permissions/delete", - "libre.graph/driveItem/deleted/delete", - "libre.graph/driveItem/versions/update", - "libre.graph/driveItem/deleted/update", - "libre.graph/driveItem/basic/read", - "libre.graph/driveItem/permissions/update", - "libre.graph/driveItem/permissions/deny" - ] + "const": [ + "libre.graph/driveItem/permissions/create", + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/versions/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/permissions/delete", + "libre.graph/driveItem/deleted/delete", + "libre.graph/driveItem/versions/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read", + "libre.graph/driveItem/permissions/update", + "libre.graph/driveItem/permissions/deny" ] }, "@libre.graph.permissions.roles.allowedValues": { @@ -63,28 +60,16 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.weight": { - "type": "integer", - "enum": [ - 1 - ] + "const": 1 }, "description": { - "type": "string", - "enum": [ - "View and download." - ] + "const": "View and download." }, "displayName": { - "type": "string", - "enum": [ - "Can view" - ] + "const": "Can view" }, "id": { - "type": "string", - "enum": [ - "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" - ] + "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } } }, @@ -98,28 +83,16 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.weight": { - "type": "integer", - "enum": [ - 2 - ] + "const": 2 }, "description": { - "type": "string", - "enum": [ - "View, download and upload." - ] + "const": "View, download and upload." }, "displayName": { - "type": "string", - "enum": [ - "Can upload" - ] + "const": "Can upload" }, "id": { - "type": "string", - "enum": [ - "1c996275-f1c9-4e71-abdf-a42f6495e960" - ] + "const": "1c996275-f1c9-4e71-abdf-a42f6495e960" } } }, @@ -133,28 +106,16 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.weight": { - "type": "integer", - "enum": [ - 3 - ] + "const": 3 }, "description": { - "type": "string", - "enum": [ - "View, download, upload, edit, add and delete." - ] + "const": "View, download, upload, edit, add and delete." }, "displayName": { - "type": "string", - "enum": [ - "Can edit" - ] + "const": "Can edit" }, "id": { - "type": "string", - "enum": [ - "fb6c3e19-e378-47e5-b277-9732f9de6e21" - ] + "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" } } } @@ -580,29 +541,26 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.permissions.actions.allowedValues": { - "type": "array", - "enum": [ - [ - "libre.graph/driveItem/permissions/create", - "libre.graph/driveItem/children/create", - "libre.graph/driveItem/standard/delete", - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/quota/read", - "libre.graph/driveItem/content/read", - "libre.graph/driveItem/upload/create", - "libre.graph/driveItem/permissions/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/versions/read", - "libre.graph/driveItem/deleted/read", - "libre.graph/driveItem/path/update", - "libre.graph/driveItem/permissions/delete", - "libre.graph/driveItem/deleted/delete", - "libre.graph/driveItem/versions/update", - "libre.graph/driveItem/deleted/update", - "libre.graph/driveItem/basic/read", - "libre.graph/driveItem/permissions/update", - "libre.graph/driveItem/permissions/deny" - ] + "const": [ + "libre.graph/driveItem/permissions/create", + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/versions/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/permissions/delete", + "libre.graph/driveItem/deleted/delete", + "libre.graph/driveItem/versions/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read", + "libre.graph/driveItem/permissions/update", + "libre.graph/driveItem/permissions/deny" ] }, "@libre.graph.permissions.roles.allowedValues": { @@ -683,30 +641,27 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.permissions.actions.allowedValues": { - "type": "array", - "enum": [ - [ - "libre.graph/driveItem/permissions/create", - "libre.graph/driveItem/children/create", - "libre.graph/driveItem/standard/delete", - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/quota/read", - "libre.graph/driveItem/content/read", - "libre.graph/driveItem/upload/create", - "libre.graph/driveItem/permissions/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/versions/read", - "libre.graph/driveItem/deleted/read", - "libre.graph/driveItem/path/update", - "libre.graph/driveItem/permissions/delete", - "libre.graph/driveItem/deleted/delete", - "libre.graph/driveItem/versions/update", - "libre.graph/driveItem/deleted/update", - "libre.graph/driveItem/basic/read", - "libre.graph/driveItem/permissions/update", - "libre.graph/driveItem/permissions/deny" - ] - ] + "const": [ + "libre.graph/driveItem/permissions/create", + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/versions/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/permissions/delete", + "libre.graph/driveItem/deleted/delete", + "libre.graph/driveItem/versions/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read", + "libre.graph/driveItem/permissions/update", + "libre.graph/driveItem/permissions/deny" + ] }, "@libre.graph.permissions.roles.allowedValues": { "type": "array", @@ -809,30 +764,27 @@ Feature: List a sharing permissions ], "properties": { "@libre.graph.permissions.actions.allowedValues": { - "type": "array", - "enum": [ - [ - "libre.graph/driveItem/permissions/create", - "libre.graph/driveItem/children/create", - "libre.graph/driveItem/standard/delete", - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/quota/read", - "libre.graph/driveItem/content/read", - "libre.graph/driveItem/upload/create", - "libre.graph/driveItem/permissions/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/versions/read", - "libre.graph/driveItem/deleted/read", - "libre.graph/driveItem/path/update", - "libre.graph/driveItem/permissions/delete", - "libre.graph/driveItem/deleted/delete", - "libre.graph/driveItem/versions/update", - "libre.graph/driveItem/deleted/update", - "libre.graph/driveItem/basic/read", - "libre.graph/driveItem/permissions/update", - "libre.graph/driveItem/permissions/deny" - ] - ] + "const": [ + "libre.graph/driveItem/permissions/create", + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/versions/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/permissions/delete", + "libre.graph/driveItem/deleted/delete", + "libre.graph/driveItem/versions/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read", + "libre.graph/driveItem/permissions/update", + "libre.graph/driveItem/permissions/deny" + ] }, "@libre.graph.permissions.roles.allowedValues": { "type": "array", @@ -2582,4 +2534,36 @@ Feature: List a sharing permissions } } } - """ \ No newline at end of file + """ + + @issue-9764 + Scenario: user tries to list permissions of a disabled project space using root endpoint + Given using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has disabled a space "new-space" + When user "Alice" tries to list the permissions of space "new-space" using root endpoint of the Graph API + Then the HTTP status code should be "404" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["error"], + "properties": { + "error": { + "type": "object", + "required": ["code", "innererror", "message"], + "properties": { + "code": { "const": "itemNotFound" }, + "innererror": { + "type": "object", + "required": ["date", "request-id"] + }, + "message": { + "pattern": "stat: error: not found: %user_id_pattern%$" + } + } + } + } + } + """ diff --git a/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature b/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature index 175edd94c4d..de2ca7c426b 100644 --- a/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature +++ b/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature @@ -246,3 +246,37 @@ Feature: Remove access to a drive When user "Alice" removes the last link share of space "projectSpace" using permissions endpoint of the Graph API Then the HTTP status code should be "204" And user "Alice" should not have any "link" permissions on space "projectSpace" + + @env-config + Scenario: remove space share after the share role Space Editor Without Versions has been disabled + Given using spaces DAV path + And the administrator has enabled the permissions role "Space Editor Without Versions" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has sent the following space share invitation: + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Editor Without Versions | + And the administrator has disabled the permissions role "Space Editor Without Versions" + When user "Alice" removes the access of user "Brian" from space "new-space" using root endpoint of the Graph API + Then the HTTP status code should be "204" + And the user "Brian" should not have a space called "NewSpace" + + @env-config + Scenario: remove space share from group after the share role Space Editor Without Versions has been disabled + Given using spaces DAV path + And the administrator has enabled the permissions role "Space Editor Without Versions" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Alice" has sent the following space share invitation: + | space | new-space | + | sharee | group1 | + | shareType | group | + | permissionsRole | Space Editor Without Versions | + And the administrator has disabled the permissions role "Space Editor Without Versions" + When user "Alice" removes the access of group "group1" from space "new-space" using root endpoint of the Graph API + Then the HTTP status code should be "204" + And the user "Brian" should not have a space called "new-space" diff --git a/tests/acceptance/features/apiSharingNg1/removeAccessToDriveItem.feature b/tests/acceptance/features/apiSharingNg1/removeAccessToDriveItem.feature index f7af530046d..5edfa4dd9ea 100644 --- a/tests/acceptance/features/apiSharingNg1/removeAccessToDriveItem.feature +++ b/tests/acceptance/features/apiSharingNg1/removeAccessToDriveItem.feature @@ -143,3 +143,171 @@ Feature: Remove access to a drive item | Space Viewer | | Space Editor | | Manager | + + @env-config + Scenario Outline: remove share after the share role Secure Viewer has been disabled (Personal Space) + Given the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And the administrator has disabled the permissions role "Secure Viewer" + When user "Alice" removes the access of user "Brian" from resource "" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | | + Examples: + | resource | + | textfile.txt | + | folderToShare | + + @env-config + Scenario: remove share after the share role Denied has been disabled (Personal Space) + Given the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Alice" removes the access of user "Brian" from resource "folderToShare" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | folderToShare | + + @env-config + Scenario Outline: remove share after the share role Secure Viewer has been disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Secure Viewer" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt" + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And the administrator has disabled the permissions role "Secure Viewer" + When user "Alice" removes the access of user "Brian" from resource "" of space "new-space" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | | + Examples: + | resource | + | textfile.txt | + | folderToShare | + + @env-config + Scenario: remove share after the share role Denied has been disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Alice" removes the access of user "Brian" from resource "folderToShare" of space "new-space" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | folderToShare | + + @env-config + Scenario Outline: remove share from group after the share role Secure Viewer has been disabled (Personal Space) + Given the administrator has enabled the permissions role "Secure Viewer" + And group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | group1 | + | shareType | group | + | permissionsRole | Secure Viewer | + And the administrator has disabled the permissions role "Secure Viewer" + When user "Alice" removes the access of group "group1" from resource "" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | | + Examples: + | resource | + | textfile.txt | + | folderToShare | + + @env-config + Scenario: remove share from group after the share role Denied has been disabled (Personal Space) + Given the administrator has enabled the permissions role "Denied" + And group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | group1 | + | shareType | group | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Alice" removes the access of group "group1" from resource "folderToShare" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | folderToShare | + + @env-config + Scenario Outline: remove share from group after the share role Secure Viewer has been disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Secure Viewer" + And group "group1" has been created + And user "Brian" has been added to group "group1" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt" + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | new-space | + | sharee | group1 | + | shareType | group | + | permissionsRole | Secure Viewer | + And the administrator has disabled the permissions role "Secure Viewer" + When user "Alice" removes the access of group "group1" from resource "" of space "new-space" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | | + Examples: + | resource | + | textfile.txt | + | folderToShare | + + @env-config + Scenario: remove share from group after the share role Denied has been disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And group "group1" has been created + And user "Brian" has been added to group "group1" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | group1 | + | shareType | group | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Alice" removes the access of group "group1" from resource "folderToShare" of space "new-space" using the Graph API + Then the HTTP status code should be "204" + And for user "Brian" the space "Shares" should not contain these entries: + | folderToShare | diff --git a/tests/acceptance/features/apiSharingNg1/sharedByMe.feature b/tests/acceptance/features/apiSharingNg1/sharedByMe.feature index ad4df240717..71c85b51e6e 100644 --- a/tests/acceptance/features/apiSharingNg1/sharedByMe.feature +++ b/tests/acceptance/features/apiSharingNg1/sharedByMe.feature @@ -3863,217 +3863,3 @@ Feature: resources shared by user } } """ - - @env-config - Scenario Outline: sharer lists the shares shared with Secure Viewer after the role is disabled (Personal Space) - Given the administrator has enabled the permissions role "Secure Viewer" - And user "Alice" has uploaded file with content "some content" to "textfile.txt" - And user "Alice" has created folder "folderToShare" - And user "Alice" has sent the following resource share invitation: - | resource | | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Secure Viewer | - And user "Brian" has a share "" synced - And the administrator has disabled the permissions role "Secure Viewer" - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should contain resource "" with the following data: - """ - { - "type": "object", - "required": [ - "parentReference", - "permissions", - "name" - ], - "properties": { - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@libre.graph.permissions.actions", - "grantedToV2", - "id", - "invitation" - ], - "properties": { - "@libre.graph.permissions.actions": { - "const": [ - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/basic/read" - ] - }, - "roles": { "const": null } - } - } - } - } - } - """ - Examples: - | resource | - | textfile.txt | - | folderToShare | - - @env-config - Scenario: sharer lists the shares shared with Denied after the role is disabled (Personal Space) - Given the administrator has enabled the permissions role "Denied" - And user "Alice" has created folder "folderToShare" - And user "Alice" has sent the following resource share invitation: - | resource | folderToShare | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Denied | - And the administrator has disabled the permissions role "Denied" - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should contain resource "folderToShare" with the following data: - """ - { - "type": "object", - "required": [ - "parentReference", - "permissions", - "name" - ], - "properties": { - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@libre.graph.permissions.actions", - "grantedToV2", - "id", - "invitation" - ], - "properties": { - "@libre.graph.permissions.actions": { - "const": ["none"] - }, - "roles": { "const": null } - } - } - } - } - } - """ - - @env-config - Scenario Outline: sharer lists the shares shared with Secure Viewer after the role is disabled (Project Space) - Given using spaces DAV path - And the administrator has enabled the permissions role "Secure Viewer" - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "new-space" with the default quota using the Graph API - And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt" - And user "Alice" has created a folder "folderToShare" in space "new-space" - And user "Alice" has sent the following resource share invitation: - | resource | | - | space | new-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | Secure Viewer | - And user "Brian" has a share "" synced - And the administrator has disabled the permissions role "Secure Viewer" - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should contain resource "" with the following data: - """ - { - "type": "object", - "required": [ - "parentReference", - "permissions", - "name" - ], - "properties": { - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@libre.graph.permissions.actions", - "grantedToV2", - "id", - "invitation" - ], - "properties": { - "@libre.graph.permissions.actions": { - "const": [ - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/basic/read" - ] - }, - "roles": { "const": null } - } - } - } - } - } - """ - Examples: - | resource | - | textfile.txt | - | folderToShare | - - @env-config - Scenario: sharer lists the shares shared with Denied after the role is disabled (Project Space) - Given using spaces DAV path - And the administrator has enabled the permissions role "Denied" - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "new-space" with the default quota using the Graph API - And user "Alice" has created a folder "folderToShare" in space "new-space" - And user "Alice" has sent the following resource share invitation: - | resource | folderToShare | - | space | new-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | Denied | - And the administrator has disabled the permissions role "Denied" - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should contain resource "folderToShare" with the following data: - """ - { - "type": "object", - "required": [ - "parentReference", - "permissions", - "name" - ], - "properties": { - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@libre.graph.permissions.actions", - "grantedToV2", - "id", - "invitation" - ], - "properties": { - "@libre.graph.permissions.actions": { - "const": ["none"] - }, - "roles": { "const": null } - } - } - } - } - } - """ diff --git a/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature index e42c064d81d..0fec4d07354 100755 --- a/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature @@ -5268,3 +5268,110 @@ Feature: an user gets the resources shared to them Then the HTTP status code should be "200" And user "Brian" should not have a share "FolderToShare" shared by user "Alice" from space "NewSpace" And user "Brian" should not be able to download file "FolderToShare/lorem.txt" from space "Shares" + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from other roles to Denied (Personal Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has uploaded file with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Denied | + | space | Personal | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should not have a share "FolderToShare" shared by user "Alice" from space "Personal" + And user "Brian" should not be able to download file "FolderToShare/lorem.txt" from space "Shares" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from Denied to other roles (Personal Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has uploaded file with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | | + | space | Personal | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should have a share "FolderToShare" shared by user "Alice" from space "Personal" + And for user "Brian" the content of the file "FolderToShare/lorem.txt" of the space "Shares" should be "hello world" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from other roles to Denied (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + And user "Alice" has created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Denied | + | space | NewSpace | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should not have a share "FolderToShare" shared by user "Alice" from space "NewSpace" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from Denied to other roles (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + And user "Alice" has created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | | + | space | NewSpace | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should have a share "FolderToShare" shared by user "Alice" from space "NewSpace" + And for user "Brian" the content of the file "FolderToShare/lorem.txt" of the space "Shares" should be "hello world" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | diff --git a/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature b/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature index 17834133a75..8415a4c89cd 100644 --- a/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature +++ b/tests/acceptance/features/apiSharingNgLinkSharePermission/createLinkShare.feature @@ -2763,4 +2763,4 @@ Feature: Create a link share for a resource | permissions-role | | Space Viewer | | Space Editor | - | Manager | \ No newline at end of file + | Manager | diff --git a/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature b/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature index 2545d50a161..72f8d87e55d 100644 --- a/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature @@ -1,3 +1,4 @@ +@issue-10739 Feature: Send a sharing invitations As the owner of a resource I want to be able to send invitations to other users @@ -38,6 +39,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "roles", "grantedToV2" @@ -128,6 +130,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "roles", "grantedToV2" @@ -209,6 +212,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "@libre.graph.permissions.actions", "grantedToV2" @@ -297,6 +301,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "@libre.graph.permissions.actions", "grantedToV2" @@ -394,6 +399,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "@libre.graph.permissions.actions", "grantedToV2" @@ -488,6 +494,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "@libre.graph.permissions.actions", "grantedToV2" @@ -581,6 +588,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "roles", "grantedToV2", @@ -677,6 +685,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "roles", "grantedToV2", @@ -767,6 +776,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "roles", "grantedToV2" @@ -2004,6 +2014,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "grantedToV2", "roles" ], @@ -2092,6 +2103,7 @@ Feature: Send a sharing invitations "items": { "type": "object", "required": [ + "createdDateTime", "id", "roles", "grantedToV2" diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 8ed3964b2d6..65821a4ef36 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -93,3 +93,52 @@ Feature: Upload files into a space | folder-name | | foo/bar | | foo/bar/baz | + + @issue-10331 @issue-10469 + Scenario: public uploads a zero byte file to a public share folder + Given using SharingNG + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Personal | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" folder "uploadFolder" of the space "Personal" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Personal" should not contain these files: + | textfile (1).txt | + | textfile (2).txt | + + @issue-10331 @issue-10469 + Scenario: public uploads a zero byte file to a public share folder inside project space + Given using SharingNG + And user "Alice" has created a folder "/uploadFolder" in space "Project Ceres" + And user "Alice" has created the following resource link share: + | resource | uploadFolder | + | space | Project Ceres | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should contain these files: + | textfile.txt | + And for user "Alice" folder "uploadFolder" of the space "Project Ceres" should not contain these files: + | textfile (1).txt | + | textfile (2).txt | + + @issue-10331 @issue-10469 + Scenario: public uploads a zero byte file to a public share project space + Given using SharingNG + And user "Alice" has created the following space link share: + | space | Project Ceres | + | permissionsRole | createOnly | + | password | %public% | + When the public uploads file "filesForUpload/zerobyte.txt" to "textfile.txt" inside last link shared folder with password "%public%" using the public WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project Ceres" should contain these files: + | textfile.txt | + And for user "Alice" the space "Project Ceres" should not contain these files: + | textfile (1).txt | + | textfile (2).txt | diff --git a/tests/acceptance/features/cliCommands/authAppToken.feature b/tests/acceptance/features/cliCommands/authAppToken.feature new file mode 100644 index 00000000000..5e4c8037ab4 --- /dev/null +++ b/tests/acceptance/features/cliCommands/authAppToken.feature @@ -0,0 +1,16 @@ +@env-config +Feature: create auth-app token + As an admin + I want to create auth-app Tokens + So that I can use 3rd party apps + + + Scenario: creates auth-app token via CLI + Given the following configs have been set: + | config | value | + | OCIS_ADD_RUN_SERVICES | auth-app | + | PROXY_ENABLE_APP_AUTH | true | + And user "Alice" has been created with default attributes + When the administrator creates app token for user "Alice" with expiration time "72h" using the auth-app CLI + Then the command should be successful + And the command output should contain "App token created for Alice" \ No newline at end of file diff --git a/tests/acceptance/features/coreApiWebdavPreviews/previews.feature b/tests/acceptance/features/coreApiWebdavPreviews/previews.feature index dce73802297..c9d32a5052b 100644 --- a/tests/acceptance/features/coreApiWebdavPreviews/previews.feature +++ b/tests/acceptance/features/coreApiWebdavPreviews/previews.feature @@ -367,3 +367,39 @@ Feature: previews of files downloaded through the webdav API | spaces | fill | fill.png | | spaces | resize | resize.png | | spaces | thumbnail | thumbnail.png | + + @issue-10589 @env-config + Scenario Outline: try to download an image preview when the maximum thumbnail input value in the environment is set to a small value + Given the following configs have been set: + | config | value | + | THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 1KB | + | THUMBNAILS_MAX_INPUT_WIDTH | 200 | + | THUMBNAILS_MAX_INPUT_HEIGHT | 200 | + And using DAV path + And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "/testimage.jpg" + When user "Alice" downloads the preview of "/testimage.jpg" with width "36" and height "36" and processor thumbnail using the WebDAV API + Then the HTTP status code should be "403" + And the value of the item "/d:error/s:message" in the response should be "thumbnails: image is too large" + Examples: + | dav-path-version | + | old | + | new | + | spaces | + + @issue-10589 @env-config + Scenario Outline: try to download a file preview when the maximum thumbnail input value in the environment is set to a small value + Given the following configs have been set: + | config | value | + | THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 1KB | + | THUMBNAILS_MAX_INPUT_WIDTH | 200 | + | THUMBNAILS_MAX_INPUT_HEIGHT | 200 | + And using DAV path + And user "Alice" has uploaded file "filesForUpload/lorem-big.txt" to "/lorem-big.txt" + When user "Alice" downloads the preview of "/lorem-big.txt" with width "36" and height "36" and processor thumbnail using the WebDAV API + Then the HTTP status code should be "403" + And the value of the item "/d:error/s:message" in the response should be "thumbnails: image is too large" + Examples: + | dav-path-version | + | old | + | new | + | spaces | diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicstorageprovider/publicstorageprovider.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicstorageprovider/publicstorageprovider.go index c743372295d..114c674c955 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -315,6 +315,7 @@ func (s *service) InitiateFileUpload(ctx context.Context, req *provider.Initiate uReq := &provider.InitiateFileUploadRequest{ Ref: cs3Ref, Opaque: req.Opaque, + LockId: req.LockId, } gatewayClient, err := s.gatewaySelector.Next() diff --git a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/locks.go b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/locks.go index 5458ec4e58b..da986996150 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/locks.go +++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/locks.go @@ -84,6 +84,7 @@ type lockInfo struct { Shared *struct{} `xml:"lockscope>shared"` Write *struct{} `xml:"locktype>write"` Owner owner `xml:"owner"` + LockID string `xml:"locktoken>href"` } // http://www.webdav.org/specs/rfc4918.html#ELEMENT_owner @@ -144,7 +145,7 @@ type LockSystem interface { // // See http://www.webdav.org/specs/rfc4918.html#rfc.section.9.10.6 for // when to use each error. - Refresh(ctx context.Context, now time.Time, token string, duration time.Duration) (LockDetails, error) + Refresh(ctx context.Context, now time.Time, ref *provider.Reference, token string) error // Unlock unlocks the lock with the given token. // @@ -184,13 +185,6 @@ func (cls *cs3LS) Create(ctx context.Context, now time.Time, details LockDetails } */ - // Having a lock token provides no special access rights. Anyone can find out anyone - // else's lock token by performing lock discovery. Locks must be enforced based upon - // whatever authentication mechanism is used by the server, not based on the secrecy - // of the token values. - // see: http://www.webdav.org/specs/rfc2518.html#n-lock-tokens - token := uuid.New() - u := ctxpkg.ContextMustGetUser(ctx) // add metadata via opaque @@ -198,6 +192,17 @@ func (cls *cs3LS) Create(ctx context.Context, now time.Time, details LockDetails o := utils.AppendPlainToOpaque(nil, "lockownername", u.GetDisplayName()) o = utils.AppendPlainToOpaque(o, "locktime", now.Format(time.RFC3339)) + lockid := details.LockID + if lockid == "" { + // Having a lock token provides no special access rights. Anyone can find out anyone + // else's lock token by performing lock discovery. Locks must be enforced based upon + // whatever authentication mechanism is used by the server, not based on the secrecy + // of the token values. + // see: http://www.webdav.org/specs/rfc2518.html#n-lock-tokens + token := uuid.New() + + lockid = lockTokenPrefix + token.String() + } r := &provider.SetLockRequest{ Ref: details.Root, Lock: &provider.Lock{ @@ -205,7 +210,7 @@ func (cls *cs3LS) Create(ctx context.Context, now time.Time, details LockDetails Type: provider.LockType_LOCK_TYPE_EXCL, User: details.UserID, // no way to set an app lock? TODO maybe via the ownerxml //AppName: , // TODO use a urn scheme? - LockId: lockTokenPrefix + token.String(), // can be a token or a Coded-URL + LockId: lockid, }, } if details.Duration > 0 { @@ -227,15 +232,52 @@ func (cls *cs3LS) Create(ctx context.Context, now time.Time, details LockDetails } switch res.GetStatus().GetCode() { case rpc.Code_CODE_OK: - return lockTokenPrefix + token.String(), nil + return lockid, nil default: return "", ocdavErrors.NewErrFromStatus(res.GetStatus()) } } -func (cls *cs3LS) Refresh(ctx context.Context, now time.Time, token string, duration time.Duration) (LockDetails, error) { - return LockDetails{}, ocdavErrors.ErrNotImplemented +func (cls *cs3LS) Refresh(ctx context.Context, now time.Time, ref *provider.Reference, token string) error { + u := ctxpkg.ContextMustGetUser(ctx) + + // add metadata via opaque + // TODO: upate cs3api: https://github.com/cs3org/cs3apis/issues/213 + o := utils.AppendPlainToOpaque(nil, "lockownername", u.GetDisplayName()) + o = utils.AppendPlainToOpaque(o, "locktime", now.Format(time.RFC3339)) + + if token == "" { + return errors.New("token is empty") + } + + r := &provider.RefreshLockRequest{ + Ref: ref, + Lock: &provider.Lock{ + Opaque: o, + Type: provider.LockType_LOCK_TYPE_EXCL, + //AppName: , // TODO use a urn scheme? + LockId: token, + User: u.GetId(), + }, + } + + client, err := cls.selector.Next() + if err != nil { + return err + } + + res, err := client.RefreshLock(ctx, r) + if err != nil { + return err + } + switch res.GetStatus().GetCode() { + case rpc.Code_CODE_OK: + return nil + + default: + return ocdavErrors.NewErrFromStatus(res.GetStatus()) + } } func (cls *cs3LS) Unlock(ctx context.Context, now time.Time, ref *provider.Reference, token string) error { @@ -287,6 +329,8 @@ type LockDetails struct { OwnerName string // Locktime is the time the lock was created Locktime time.Time + // LockID is the lock token + LockID string } func readLockInfo(r io.Reader) (li lockInfo, status int, err error) { @@ -450,7 +494,7 @@ func (s *svc) lockReference(ctx context.Context, w http.ResponseWriter, r *http. u := ctxpkg.ContextMustGetUser(ctx) token, now, created := "", time.Now(), false - ld := LockDetails{UserID: u.Id, Root: ref, Duration: duration, OwnerName: u.GetDisplayName(), Locktime: now} + ld := LockDetails{UserID: u.Id, Root: ref, Duration: duration, OwnerName: u.GetDisplayName(), Locktime: now, LockID: li.LockID} if li == (lockInfo{}) { // An empty lockInfo means to refresh the lock. ih, ok := parseIfHeader(r.Header.Get(net.HeaderIf)) @@ -463,7 +507,7 @@ func (s *svc) lockReference(ctx context.Context, w http.ResponseWriter, r *http. if token == "" { return http.StatusBadRequest, ocdavErrors.ErrInvalidLockToken } - ld, err = s.LockSystem.Refresh(ctx, now, token, duration) + err = s.LockSystem.Refresh(ctx, now, ref, token) if err != nil { if err == ocdavErrors.ErrNoSuchLock { return http.StatusPreconditionFailed, err @@ -471,6 +515,8 @@ func (s *svc) lockReference(ctx context.Context, w http.ResponseWriter, r *http. return http.StatusInternalServerError, err } + ld.LockID = token + } else { // Section 9.10.3 says that "If no Depth header is submitted on a LOCK request, // then the request MUST act as if a "Depth:infinity" had been submitted." diff --git a/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go b/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go index fc3eb0c891b..c56b951c0e2 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/ocm/provider/authorizer/json/json.go @@ -24,6 +24,7 @@ import ( "net" "net/url" "os" + "regexp" "strings" "sync" @@ -130,7 +131,7 @@ func (a *authorizer) IsProviderAllowed(ctx context.Context, pi *ocmprovider.Prov var providerAuthorized bool if normalizedDomain != "" { for _, p := range a.providers { - if p.Domain == normalizedDomain { + if ok, err := regexp.MatchString(p.Domain, normalizedDomain); ok && err == nil { providerAuthorized = true break } diff --git a/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/ocm.go b/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/ocm.go index 1b595eb0171..02b5d8235ae 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/ocm.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/ocm.go @@ -474,20 +474,47 @@ func (d *driver) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Refer return errtypes.NotSupported("operation not supported") } +// SetLock sets a lock on a file func (d *driver) SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error { - return errtypes.NotSupported("operation not supported") + client, _, rel, err := d.webdavClient(ctx, nil, ref) + if err != nil { + return err + } + + return client.Lock(rel, lock.GetLockId()) } func (d *driver) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error) { - return nil, errtypes.NotSupported("operation not supported") + client, _, rel, err := d.webdavClient(ctx, nil, ref) + if err != nil { + return nil, err + } + + token, err := client.GetLock(rel) + if err != nil { + return nil, err + } + + return &provider.Lock{LockId: token, Type: provider.LockType_LOCK_TYPE_EXCL}, nil } func (d *driver) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock, existingLockID string) error { - return errtypes.NotSupported("operation not supported") + client, _, rel, err := d.webdavClient(ctx, nil, ref) + if err != nil { + return err + } + + return client.RefreshLock(rel, lock.GetLockId()) } +// Unlock removes a lock from a file func (d *driver) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error { - return errtypes.NotSupported("operation not supported") + client, _, rel, err := d.webdavClient(ctx, nil, ref) + if err != nil { + return err + } + + return client.Unlock(rel, lock.GetLockId()) } func (d *driver) ListStorageSpaces(ctx context.Context, filters []*provider.ListStorageSpacesRequest_Filter, _ bool) ([]*provider.StorageSpace, error) { diff --git a/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/upload.go b/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/upload.go index 05556ede47c..046a5fcc669 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/upload.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/ocm/storage/received/upload.go @@ -106,7 +106,8 @@ func (d *driver) Upload(ctx context.Context, req storage.UploadRequest, _ storag } }) - return &provider.ResourceInfo{}, client.WriteStream(rel, req.Body, 0) + locktoken, _ := ctxpkg.ContextGetLockID(ctx) + return &provider.ResourceInfo{}, client.WriteStream(rel, req.Body, 0, locktoken) } // UseIn tells the tus upload middleware which extensions it supports. @@ -356,7 +357,7 @@ func (u *upload) FinishUpload(ctx context.Context) error { return err } defer f.Close() - return client.WriteStream(rel, f, 0) + return client.WriteStream(rel, f, 0, "") } func (u *upload) Terminate(ctx context.Context) error { diff --git a/vendor/github.com/cs3org/reva/v2/pkg/owncloud/ocs/capabilities.go b/vendor/github.com/cs3org/reva/v2/pkg/owncloud/ocs/capabilities.go index 1f4bcdab6f5..8d754cd7504 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/owncloud/ocs/capabilities.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/owncloud/ocs/capabilities.go @@ -288,7 +288,8 @@ type CapabilitiesFilesSharingFederation struct { // CapabilitiesNotifications holds a list of notification endpoints type CapabilitiesNotifications struct { - Endpoints []string `json:"ocs-endpoints,omitempty" xml:"ocs-endpoints>element,omitempty" mapstructure:"endpoints"` + Endpoints []string `json:"ocs-endpoints,omitempty" xml:"ocs-endpoints>element,omitempty" mapstructure:"endpoints"` + Configurable bool `json:"configurable" xml:"configurable,omitempty" mapstructure:"configurable"` } // CapabilitiesTheme holds theming capabilities diff --git a/vendor/github.com/cs3org/reva/v2/pkg/rhttp/datatx/manager/simple/simple.go b/vendor/github.com/cs3org/reva/v2/pkg/rhttp/datatx/manager/simple/simple.go index 5074b3861d7..5cfec2ca4e0 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/rhttp/datatx/manager/simple/simple.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/rhttp/datatx/manager/simple/simple.go @@ -24,6 +24,7 @@ import ( userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" + ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -109,6 +110,10 @@ func (m *manager) Handler(fs storage.FS) (http.Handler, error) { ref := &provider.Reference{Path: fn} + if lockID := r.Header.Get("X-Lock-Id"); lockID != "" { + ctx = ctxpkg.ContextSetLockID(ctx, lockID) + } + info, err := fs.Upload(ctx, storage.UploadRequest{ Ref: ref, Body: r.Body, diff --git a/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/spaces.go b/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/spaces.go index 760ad96552c..0a369a61f94 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/spaces.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/spaces.go @@ -50,6 +50,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storagespace" "github.com/cs3org/reva/v2/pkg/utils" "github.com/pkg/errors" + "github.com/shamaton/msgpack/v2" "golang.org/x/sync/errgroup" ) @@ -744,12 +745,58 @@ func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.De return err } - // remove space metadata - if err := os.RemoveAll(fs.getSpaceRoot(spaceID)); err != nil { + root := fs.getSpaceRoot(spaceID) + + // walkfn will delete the blob if the node has one + walkfn := func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if filepath.Ext(path) != ".mpk" { + return nil + } + + b, err := os.ReadFile(path) + if err != nil { + return err + } + + m := map[string][]byte{} + if err := msgpack.Unmarshal(b, &m); err != nil { + return err + } + + bid := m["user.ocis.blobid"] + if string(bid) == "" { + return nil + } + + if err := fs.tp.DeleteBlob(&node.Node{ + BlobID: string(bid), + SpaceID: spaceID, + }); err != nil { + return err + } + + // remove .mpk file so subsequent attempts will not try to delete the blob again + return os.Remove(path) + } + + // This is deletes all blobs of the space + // NOTE: This isn't needed when no s3 is used, but we can't differentiate that here... + if err := filepath.Walk(root, walkfn); err != nil { return err } - // TODO remove space blobs with s3 backend by adding a purge method to the Blobstore interface + // remove space metadata + if err := os.RemoveAll(root); err != nil { + return err + } + + // try removing the space root node + // Note that this will fail when there are other spaceids starting with the same two digits. + _ = os.Remove(filepath.Dir(root)) return nil } diff --git a/vendor/github.com/cs3org/reva/v2/pkg/storagespace/storagespace.go b/vendor/github.com/cs3org/reva/v2/pkg/storagespace/storagespace.go index 78fa52df09e..e6412f4ae51 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/storagespace/storagespace.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/storagespace/storagespace.go @@ -75,8 +75,8 @@ func SplitStorageID(sid string) (storageID, spaceID string) { // The result format will look like: // $! func FormatResourceID(sid *provider.ResourceId) string { - if sid.OpaqueId == "" { - return FormatStorageID(sid.StorageId, sid.SpaceId) + if sid.GetOpaqueId() == "" { + return FormatStorageID(sid.GetStorageId(), sid.GetSpaceId()) } return strings.Join([]string{FormatStorageID(sid.StorageId, sid.SpaceId), sid.OpaqueId}, _idDelimiter) } diff --git a/vendor/github.com/studio-b12/gowebdav/client.go b/vendor/github.com/studio-b12/gowebdav/client.go index 99cf24adabe..7ab8e41fa4d 100644 --- a/vendor/github.com/studio-b12/gowebdav/client.go +++ b/vendor/github.com/studio-b12/gowebdav/client.go @@ -3,6 +3,7 @@ package gowebdav import ( "bytes" "encoding/xml" + "errors" "fmt" "io" "net/http" @@ -159,6 +160,10 @@ func (p *propstat) Modified() time.Time { return time.Unix(0, 0) } +func (p *propstat) Lock() string { + return p.Props.GetString(xml.Name{Space: "DAV:", Local: "lockdiscovery"}) +} + func (p *propstat) StatusCode() int { parts := strings.Split(p.Status, " ") if len(parts) < 2 { @@ -380,6 +385,37 @@ func (c *Client) Copy(oldpath, newpath string, overwrite bool) error { return c.copymove("COPY", oldpath, newpath, overwrite) } +// GetLock gets a lock +func (c *Client) GetLock(path string) (string, error) { + fi, err := c.Stat(path) + if err != nil { + return "", err + } + + f, ok := fi.(File) + if !ok { + // This won't happen unless implementation is changed + return "", errors.New("Stat did not return a File") + } + + return f.Lock(), nil +} + +// Lock locks a file +func (c *Client) Lock(path string, token string) error { + return c.lock(path, token, false) +} + +// RefreshLock refreshes a lock +func (c *Client) RefreshLock(path string, token string) error { + return c.lock(path, token, true) +} + +// Unlock unlocks a file +func (c *Client) Unlock(path string, token string) error { + return c.unlock(path, token) +} + // Read reads the contents of a remote file func (c *Client) Read(path string) ([]byte, error) { var stream io.ReadCloser @@ -456,7 +492,7 @@ func (c *Client) ReadStreamRange(path string, offset, length int64) (io.ReadClos // Write writes data to a given path func (c *Client) Write(path string, data []byte, _ os.FileMode) (err error) { - s, err := c.put(path, bytes.NewReader(data)) + s, err := c.put(path, bytes.NewReader(data), "") if err != nil { return } @@ -472,7 +508,7 @@ func (c *Client) Write(path string, data []byte, _ os.FileMode) (err error) { return } - s, err = c.put(path, bytes.NewReader(data)) + s, err = c.put(path, bytes.NewReader(data), "") if err != nil { return } @@ -485,14 +521,14 @@ func (c *Client) Write(path string, data []byte, _ os.FileMode) (err error) { } // WriteStream writes a stream -func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) (err error) { +func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode, locktoken string) (err error) { err = c.createParentCollection(path) if err != nil { return err } - s, err := c.put(path, stream) + s, err := c.put(path, stream, locktoken) if err != nil { return err } diff --git a/vendor/github.com/studio-b12/gowebdav/file.go b/vendor/github.com/studio-b12/gowebdav/file.go index e66d1a4ecf7..15f45473439 100644 --- a/vendor/github.com/studio-b12/gowebdav/file.go +++ b/vendor/github.com/studio-b12/gowebdav/file.go @@ -31,7 +31,7 @@ func newFile(path, name string, p *propstat) *File { } path = FixSlashes(path) - f.name = name + f.name = filepath.Base(name) f.path = filepath.Clean(filepath.Join(path, f.name)) f.modified = p.Modified() f.etag = p.ETag() @@ -98,6 +98,11 @@ func (f File) Sys() interface{} { return f.propstat.Props } +// Lock returns the files lock +func (f File) Lock() string { + return f.propstat.Lock() +} + func (f File) StatusCode() int { return f.propstat.StatusCode() } diff --git a/vendor/github.com/studio-b12/gowebdav/requests.go b/vendor/github.com/studio-b12/gowebdav/requests.go index 8e362e86648..26d6038b0df 100644 --- a/vendor/github.com/studio-b12/gowebdav/requests.go +++ b/vendor/github.com/studio-b12/gowebdav/requests.go @@ -105,6 +105,63 @@ func (c *Client) propfind(path string, self bool, body string, resp interface{}, return parseXML(rs.Body, resp, parse) } +func (c *Client) lock(path string, token string, refresh bool) error { + var body io.Reader + if !refresh { + b := strings.Builder{} + + // build the lockinfo xml + b.WriteString("") + // always use an exclusive lock + b.WriteString("") + // always use a write lock + b.WriteString("") + // add the lock token + b.WriteString("") + b.WriteString(token) + b.WriteString("") + // close the lockinfo xml + b.WriteString("") + + body = strings.NewReader(b.String()) + } + + rs, err := c.req("LOCK", path, body, func(rq *http.Request) { + rq.Header.Add("Content-Type", "application/xml;charset=UTF-8") + rq.Header.Add("Accept", "application/xml,text/xml") + rq.Header.Add("Accept-Charset", "utf-8") + rq.Header.Add("Accept-Encoding", "") + if refresh { + rq.Header.Add("If", "("+token+")") + } + }) + if err != nil { + return err + } + defer rs.Body.Close() + + if rs.StatusCode != 200 { + return NewPathError("LOCK", path, rs.StatusCode) + } + + return nil +} + +func (c *Client) unlock(path string, token string) error { + rs, err := c.req("UNLOCK", path, nil, func(rq *http.Request) { + rq.Header.Add("Lock-Token", "<"+token+">") + }) + if err != nil { + return err + } + defer rs.Body.Close() + + if rs.StatusCode != http.StatusNoContent { + return NewPathError("UNLOCK", path, rs.StatusCode) + } + return nil +} + func (c *Client) doCopyMove( method string, oldpath string, @@ -160,8 +217,10 @@ func (c *Client) copymove(method string, oldpath string, newpath string, overwri return NewPathError(method, oldpath, s) } -func (c *Client) put(path string, stream io.Reader) (status int, err error) { - rs, err := c.req("PUT", path, stream, nil) +func (c *Client) put(path string, stream io.Reader, locktoken string) (status int, err error) { + rs, err := c.req("PUT", path, stream, func(rq *http.Request) { + rq.Header.Add("Lock-Token", "<"+locktoken+">") + }) if err != nil { return } diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index c0d1c29e6f9..5b5ccd96f45 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -149,7 +149,7 @@ func (s *ServerConfig) AddHostKey(key Signer) { } // cachedPubKey contains the results of querying whether a public key is -// acceptable for a user. +// acceptable for a user. This is a FIFO cache. type cachedPubKey struct { user string pubKeyData []byte @@ -157,7 +157,13 @@ type cachedPubKey struct { perms *Permissions } -const maxCachedPubKeys = 16 +// maxCachedPubKeys is the number of cache entries we store. +// +// Due to consistent misuse of the PublicKeyCallback API, we have reduced this +// to 1, such that the only key in the cache is the most recently seen one. This +// forces the behavior that the last call to PublicKeyCallback will always be +// with the key that is used for authentication. +const maxCachedPubKeys = 1 // pubKeyCache caches tests for public keys. Since SSH clients // will query whether a public key is acceptable before attempting to @@ -179,9 +185,10 @@ func (c *pubKeyCache) get(user string, pubKeyData []byte) (cachedPubKey, bool) { // add adds the given tuple to the cache. func (c *pubKeyCache) add(candidate cachedPubKey) { - if len(c.keys) < maxCachedPubKeys { - c.keys = append(c.keys, candidate) + if len(c.keys) >= maxCachedPubKeys { + c.keys = c.keys[1:] } + c.keys = append(c.keys, candidate) } // ServerConn is an authenticated SSH connection, as seen from the diff --git a/vendor/golang.org/x/net/html/doctype.go b/vendor/golang.org/x/net/html/doctype.go index c484e5a94fb..bca3ae9a0c2 100644 --- a/vendor/golang.org/x/net/html/doctype.go +++ b/vendor/golang.org/x/net/html/doctype.go @@ -87,7 +87,7 @@ func parseDoctype(s string) (n *Node, quirks bool) { } } if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" && - strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" { + strings.EqualFold(lastAttr.Val, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") { quirks = true } } diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go index 9da9e9dc424..e8515d8e887 100644 --- a/vendor/golang.org/x/net/html/foreign.go +++ b/vendor/golang.org/x/net/html/foreign.go @@ -40,8 +40,7 @@ func htmlIntegrationPoint(n *Node) bool { if n.Data == "annotation-xml" { for _, a := range n.Attr { if a.Key == "encoding" { - val := strings.ToLower(a.Val) - if val == "text/html" || val == "application/xhtml+xml" { + if strings.EqualFold(a.Val, "text/html") || strings.EqualFold(a.Val, "application/xhtml+xml") { return true } } diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 46a89eda6c1..643c674e378 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -840,6 +840,10 @@ func afterHeadIM(p *parser) bool { p.parseImpliedToken(StartTagToken, a.Body, a.Body.String()) p.framesetOK = true + if p.tok.Type == ErrorToken { + // Stop parsing. + return true + } return false } @@ -1031,7 +1035,7 @@ func inBodyIM(p *parser) bool { if p.tok.DataAtom == a.Input { for _, t := range p.tok.Attr { if t.Key == "type" { - if strings.ToLower(t.Val) == "hidden" { + if strings.EqualFold(t.Val, "hidden") { // Skip setting framesetOK = false return true } @@ -1459,7 +1463,7 @@ func inTableIM(p *parser) bool { return inHeadIM(p) case a.Input: for _, t := range p.tok.Attr { - if t.Key == "type" && strings.ToLower(t.Val) == "hidden" { + if t.Key == "type" && strings.EqualFold(t.Val, "hidden") { p.addElement() p.oe.pop() return true diff --git a/vendor/modules.txt b/vendor/modules.txt index f805751dc82..1b015a15e6d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -367,7 +367,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1 github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1 -# github.com/cs3org/reva/v2 v2.27.0 +# github.com/cs3org/reva/v2 v2.27.1-0.20250107124628-bd76241aa776 ## explicit; go 1.22.0 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime @@ -1813,7 +1813,7 @@ github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml github.com/stretchr/testify/mock github.com/stretchr/testify/require -# github.com/studio-b12/gowebdav v0.9.0 => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6 +# github.com/studio-b12/gowebdav v0.9.0 => github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202 ## explicit; go 1.17 github.com/studio-b12/gowebdav # github.com/tchap/go-patricia/v2 v2.3.1 @@ -2087,7 +2087,7 @@ go.uber.org/zap/internal/color go.uber.org/zap/internal/exit go.uber.org/zap/zapcore go.uber.org/zap/zapgrpc -# golang.org/x/crypto v0.30.0 +# golang.org/x/crypto v0.31.0 ## explicit; go 1.20 golang.org/x/crypto/argon2 golang.org/x/crypto/bcrypt @@ -2141,7 +2141,7 @@ golang.org/x/image/vector golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.32.0 +# golang.org/x/net v0.33.0 ## explicit; go 1.18 golang.org/x/net/bpf golang.org/x/net/context @@ -2398,7 +2398,7 @@ sigs.k8s.io/yaml/goyaml.v2 # stash.kopano.io/kgol/rndm v1.1.2 ## explicit; go 1.13 stash.kopano.io/kgol/rndm -# github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6 +# github.com/studio-b12/gowebdav => github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202 # github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-20240802074440-aade4a234387 # github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c # github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90