From 322924d1c3b5b54a4b7a9229867e41bcafde4160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 12 Sep 2022 20:29:04 +0000 Subject: [PATCH 01/13] update sharing docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- docs/services/frontend/_index.md | 21 +++++++++++++++++++++ docs/services/sharing/_index.md | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/services/frontend/_index.md b/docs/services/frontend/_index.md index 097fde9320d..6d99832a937 100644 --- a/docs/services/frontend/_index.md +++ b/docs/services/frontend/_index.md @@ -10,7 +10,28 @@ geekdocCollapseSection: true ## Abstract +The frontend service provides multiple HTTP endpoints to translate OCS, archiver and approvider requests into CS3 requests. ## Table of Contents {{< toc-tree >}} + +## OCS + +The OCS endpoint implements the open collaboration services API in a backwards compatible manner. + +### Sharing + +Aggregating share information as one of the most time consuming operations in OCIS. The service fetches a list of either received or created shares and has to stat every resource individually. While stats are fast, the default behavior scales linear with the number of shares. + +To save network trips the sharing implementation can cache the stat requests with an in memory cache or in redis. It will shorten the response time by the network rountrip overhead at the cost of the API only eventually being updated. + +Setting `FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL=60` would cache the stat info for 60 seconds. Increasing this value makes sense for large deployments with thousands of active users that keep the cache up to date. Low frequency usage scenarios should not expect a noticeable improvement. + +## Archiver + +The archiver endpoint provides bundled downloads of multiple files and folders. + +## Appprovider + +The appprovider endpoint is used to manage available apps that can be used to open different file types. \ No newline at end of file diff --git a/docs/services/sharing/_index.md b/docs/services/sharing/_index.md index be41c1be9e0..ecdc21f5f42 100644 --- a/docs/services/sharing/_index.md +++ b/docs/services/sharing/_index.md @@ -9,7 +9,7 @@ geekdocCollapseSection: true ## Abstract -This service provides sharing functionality. +This service implements the CS3 [LinkAPI](https://cs3org.github.io/cs3apis/#cs3.sharing.link.v1beta1.LinkAPI) to manage public links as well as the [CollaborationAPI](https://cs3org.github.io/cs3apis/#cs3.sharing.collaboration.v1beta1.CollaborationAPI) to manage user and group shares. ## Table of Contents From 30b41dc21c75e305e319527ade0d37d9c63643b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 14 Sep 2022 17:45:36 +0200 Subject: [PATCH 02/13] Update docs/services/frontend/_index.md Co-authored-by: Phil Davis --- docs/services/frontend/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/services/frontend/_index.md b/docs/services/frontend/_index.md index 6d99832a937..20ace43cb54 100644 --- a/docs/services/frontend/_index.md +++ b/docs/services/frontend/_index.md @@ -22,7 +22,7 @@ The OCS endpoint implements the open collaboration services API in a backwards c ### Sharing -Aggregating share information as one of the most time consuming operations in OCIS. The service fetches a list of either received or created shares and has to stat every resource individually. While stats are fast, the default behavior scales linear with the number of shares. +Aggregating share information is one of the most time consuming operations in OCIS. The service fetches a list of either received or created shares and has to stat every resource individually. While stats are fast, the default behavior scales linearly with the number of shares. To save network trips the sharing implementation can cache the stat requests with an in memory cache or in redis. It will shorten the response time by the network rountrip overhead at the cost of the API only eventually being updated. From 23da13b35fe92c085dca7c3d55d436fa86fc5292 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 09:27:30 +0200 Subject: [PATCH 03/13] add web url to graph api and update reva --- go.mod | 2 +- go.sum | 6 ++---- services/graph/pkg/service/v0/drives.go | 18 ++++++++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index b96d1282586..46e6875ed1c 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/blevesearch/bleve_index_api v1.0.3 github.com/coreos/go-oidc/v3 v3.3.0 github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d - github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b + github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index 1a87bda1533..c5e183483fa 100644 --- a/go.sum +++ b/go.sum @@ -292,8 +292,8 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4= github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A= github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d h1:toyZ7IsXlUdEPZ/IG8fg7hbM8HcLPY0bkX4FKBmgLVI= github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b h1:mRtQad2TBNE970FYntYSZJJp+Ol0fzcICf/n/UmHb1g= -github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 h1:siIHxgMHWCxERsHPYwHL7Pno27URyqjV2np9Mh1U84g= +github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -1074,8 +1074,6 @@ github.com/prometheus/statsd_exporter v0.22.4/go.mod h1:N4Z1+iSqc9rnxlT1N8Qn3l65 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rhafer/reva/v2 v2.0.0-20220913142514-cf5b93129713 h1:CLaGrpVJLptZk417YiW4jRHfTKiLMl9RljrxZd5u4l0= -github.com/rhafer/reva/v2 v2.0.0-20220913142514-cf5b93129713/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index a704c8ab038..6d5f2ef5074 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -525,7 +525,6 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa Id: libregraph.PtrString(spaceID), Name: &space.Name, //"createdDateTime": "string (timestamp)", // TODO read from StorageSpace ... needs Opaque for now - //"description": "string", // TODO read from StorageSpace ... needs Opaque for now DriveType: &space.SpaceType, Root: &libregraph.DriveItem{ Id: libregraph.PtrString(storagespace.FormatResourceID(spaceRid)), @@ -572,15 +571,23 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa } if baseURL != nil { - // TODO read from StorageSpace ... needs Opaque for now - // TODO how do we build the url? - // for now: read from request webDavURL := *baseURL webDavURL.Path = path.Join(webDavURL.Path, spaceID) drive.Root.WebDavUrl = libregraph.PtrString(webDavURL.String()) } - // TODO The public space has no owner ... should we even show it? + webURL, err := url.Parse(g.config.Commons.OcisURL) + if err != nil { + g.logger.Error(). + Err(err). + Str("url", g.config.Commons.OcisURL). + Msg("failed to parse base url") + return nil, err + } + + webURL.Path = path.Join(webURL.Path, "f", storagespace.FormatResourceID(spaceRid)) + drive.Root.WebUrl = libregraph.PtrString(webURL.String()) + if space.Owner != nil && space.Owner.Id != nil { drive.Owner = &libregraph.IdentitySet{ User: &libregraph.Identity{ @@ -604,7 +611,6 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa Total: &t, } } - // FIXME use coowner from https://github.com/owncloud/open-graph-api return drive, nil } From 5e259aa902ee7fe31c760f62e93f5bd42812a0e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 18:58:37 +0000 Subject: [PATCH 04/13] Bump go.opentelemetry.io/otel/trace from 1.9.0 to 1.10.0 Bumps [go.opentelemetry.io/otel/trace](https://github.com/open-telemetry/opentelemetry-go) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.9.0...v1.10.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel/trace dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b96d1282586..3287531e7b4 100644 --- a/go.mod +++ b/go.mod @@ -67,10 +67,10 @@ require ( go.etcd.io/bbolt v1.3.6 go.opencensus.io v0.23.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.34.0 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/jaeger v1.9.0 go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel/trace v1.10.0 golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 golang.org/x/exp v0.0.0-20220518171630-0b5c67f07fdf golang.org/x/image v0.0.0-20220321031419-a8550c1d254a diff --git a/go.sum b/go.sum index 1a87bda1533..567b42f1598 100644 --- a/go.sum +++ b/go.sum @@ -1267,14 +1267,14 @@ go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.34.0 h1:PNEMW4EvpNQ7SuoPFNkvbZqi1STkTPKq+8vfoMl/6AE= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.34.0/go.mod h1:fk1+icoN47ytLSgkoWHLJrtVTSQ+HgmkNgPTKrk/Nsc= -go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw= -go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo= +go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4= +go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ= go.opentelemetry.io/otel/exporters/jaeger v1.9.0 h1:gAEgEVGDWwFjcis9jJTOJqZNxDzoZfR12WNIxr7g9Ww= go.opentelemetry.io/otel/exporters/jaeger v1.9.0/go.mod h1:hquezOLVAybNW6vanIxkdLXTXvzlj2Vn3wevSP15RYs= go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo= go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= -go.opentelemetry.io/otel/trace v1.9.0 h1:oZaCNJUjWcg60VXWee8lJKlqhPbXAPB51URuR47pQYc= -go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo= +go.opentelemetry.io/otel/trace v1.10.0 h1:npQMbR8o7mum8uF95yFbOEJffhs1sbCOfDh8zAJiH5E= +go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= From 2d9fdf656b9887175ea5fd8254b7c3e3a8c29f33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Sep 2022 13:58:58 +0000 Subject: [PATCH 05/13] Bump github.com/coreos/go-oidc/v3 from 3.3.0 to 3.4.0 Bumps [github.com/coreos/go-oidc/v3](https://github.com/coreos/go-oidc) from 3.3.0 to 3.4.0. - [Release notes](https://github.com/coreos/go-oidc/releases) - [Commits](https://github.com/coreos/go-oidc/compare/v3.3.0...v3.4.0) --- updated-dependencies: - dependency-name: github.com/coreos/go-oidc/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 3287531e7b4..960889f257b 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/ReneKroon/ttlcache/v2 v2.11.0 github.com/blevesearch/bleve/v2 v2.3.4 github.com/blevesearch/bleve_index_api v1.0.3 - github.com/coreos/go-oidc/v3 v3.3.0 + github.com/coreos/go-oidc/v3 v3.4.0 github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b github.com/disintegration/imaging v1.6.2 diff --git a/go.sum b/go.sum index 567b42f1598..354f2afaf38 100644 --- a/go.sum +++ b/go.sum @@ -266,8 +266,8 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-oidc v2.2.1+incompatible h1:mh48q/BqXqgjVHpy2ZY7WnWAbenxRjsz9N1i1YxjHAk= github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= -github.com/coreos/go-oidc/v3 v3.3.0 h1:Y1LV3mP+QT3MEycATZpAiwfyN+uxZLqVbAHJUuOJEe4= -github.com/coreos/go-oidc/v3 v3.3.0/go.mod h1:eHUXhZtXPQLgEaDrOVTgwbgmz1xGOkJNye6h3zkD2Pw= +github.com/coreos/go-oidc/v3 v3.4.0 h1:xz7elHb/LDwm/ERpwHd+5nb7wFHL32rsr6bBOgaeu6g= +github.com/coreos/go-oidc/v3 v3.4.0/go.mod h1:eHUXhZtXPQLgEaDrOVTgwbgmz1xGOkJNye6h3zkD2Pw= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -1074,8 +1074,6 @@ github.com/prometheus/statsd_exporter v0.22.4/go.mod h1:N4Z1+iSqc9rnxlT1N8Qn3l65 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rhafer/reva/v2 v2.0.0-20220913142514-cf5b93129713 h1:CLaGrpVJLptZk417YiW4jRHfTKiLMl9RljrxZd5u4l0= -github.com/rhafer/reva/v2 v2.0.0-20220913142514-cf5b93129713/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= From 0ee2b7b33c431e7f43a82b5f3ece6edb345c2091 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Wed, 14 Sep 2022 17:40:39 +0200 Subject: [PATCH 06/13] add README to notifications service Signed-off-by: jkoberg --- services/notifications/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 services/notifications/README.md diff --git a/services/notifications/README.md b/services/notifications/README.md new file mode 100644 index 00000000000..439247e162d --- /dev/null +++ b/services/notifications/README.md @@ -0,0 +1,4 @@ +#### Notification service + +The notification service is responsible for sending emails to users informing them about events that happened. To do this it hooks into the event system and listens for certain events that the users need to be informed about. + From a129ea6abef654d37c812d0e87f907dee9f4b67e Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 10:42:00 +0200 Subject: [PATCH 07/13] fix unit tests --- services/graph/pkg/service/v0/drives.go | 2 +- services/graph/pkg/service/v0/graph_test.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index 6d5f2ef5074..8ff4c8c048b 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -586,7 +586,7 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa } webURL.Path = path.Join(webURL.Path, "f", storagespace.FormatResourceID(spaceRid)) - drive.Root.WebUrl = libregraph.PtrString(webURL.String()) + drive.WebUrl = libregraph.PtrString(webURL.String()) if space.Owner != nil && space.Owner.Id != nil { drive.Owner = &libregraph.IdentitySet{ diff --git a/services/graph/pkg/service/v0/graph_test.go b/services/graph/pkg/service/v0/graph_test.go index 0629e6ff674..fcd969c5821 100644 --- a/services/graph/pkg/service/v0/graph_test.go +++ b/services/graph/pkg/service/v0/graph_test.go @@ -17,6 +17,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" libregraph "github.com/owncloud/libre-graph-api-go" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/graph/mocks" "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults" @@ -39,6 +40,8 @@ var _ = Describe("Graph", func() { cfg = defaults.FullDefaultConfig() cfg.Identity.LDAP.CACert = "" // skip the startup checks, we don't use LDAP at all in this tests cfg.TokenManager.JWTSecret = "loremipsum" + cfg.Commons = &shared.Commons{} + cfg.Commons.OcisURL = "https://ocis.test" gatewayClient = &mocks.GatewayClient{} eventsPublisher = mocks.Publisher{} @@ -108,7 +111,8 @@ var _ = Describe("Graph", func() { "root":{ "id":"pro-1$sameID", "webDavUrl":"https://localhost:9200/dav/spaces/pro-1$sameID" - } + }, + "webUrl": "https://ocis.test/f/pro-1$sameID" } ] } @@ -178,7 +182,8 @@ var _ = Describe("Graph", func() { "eTag":"101112131415", "id":"pro-1$asameID", "webDavUrl":"https://localhost:9200/dav/spaces/pro-1$asameID" - } + }, + "webUrl": "https://ocis.test/f/pro-1$asameID" }, { "driveAlias":"bspacetype/bspacename", @@ -189,7 +194,8 @@ var _ = Describe("Graph", func() { "eTag":"123456789", "id":"pro-1$bsameID", "webDavUrl":"https://localhost:9200/dav/spaces/pro-1$bsameID" - } + }, + "webUrl": "https://ocis.test/f/pro-1$bsameID" } ] } From e092da586b34cf688bfbca4a68b5817a1cbb8d2f Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 10:42:31 +0200 Subject: [PATCH 08/13] add changelog --- changelog/unreleased/add-web-url.md | 5 +++++ changelog/unreleased/update-reva-rc1.md | 5 +++++ go.mod | 2 +- go.sum | 2 ++ tests/acceptance/expected-failures-API-on-OCIS-storage.md | 7 ------- .../acceptance/expected-failures-webUI-on-OCIS-storage.md | 1 - 6 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 changelog/unreleased/add-web-url.md create mode 100644 changelog/unreleased/update-reva-rc1.md diff --git a/changelog/unreleased/add-web-url.md b/changelog/unreleased/add-web-url.md new file mode 100644 index 00000000000..f4826375781 --- /dev/null +++ b/changelog/unreleased/add-web-url.md @@ -0,0 +1,5 @@ +Enhancement: Add webURL to space root + +Add the web url to the space root on the graphAPI. + +https://github.com/owncloud/ocis/pull/4588 diff --git a/changelog/unreleased/update-reva-rc1.md b/changelog/unreleased/update-reva-rc1.md new file mode 100644 index 00000000000..09553bdd55c --- /dev/null +++ b/changelog/unreleased/update-reva-rc1.md @@ -0,0 +1,5 @@ +Enhancement: Update reva + +TBD + +https://github.com/owncloud/ocis/pull/4588 diff --git a/go.mod b/go.mod index 46e6875ed1c..273f32d88f3 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/blevesearch/bleve_index_api v1.0.3 github.com/coreos/go-oidc/v3 v3.3.0 github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d - github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 + github.com/cs3org/reva/v2 v2.10.1-0.20220915095422-4b099c09a66c github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index c5e183483fa..0de687f09b6 100644 --- a/go.sum +++ b/go.sum @@ -294,6 +294,8 @@ github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d h1:toyZ7IsXlUdEP github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 h1:siIHxgMHWCxERsHPYwHL7Pno27URyqjV2np9Mh1U84g= github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220915095422-4b099c09a66c h1:pvbsnSl5WpS6PkSR4glwR8OJGrRdZASajAJtNwp9E+Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220915095422-4b099c09a66c/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 8a9d4aee201..ba8c9509135 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -298,13 +298,6 @@ cannot share a folder with create permission - [apiTrashbin/trashbinSharingToShares.feature:212](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinSharingToShares.feature#L212) - [apiTrashbin/trashbinSharingToShares.feature:236](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinSharingToShares.feature#L236) - -#### [oc:privatelink property not returned in webdav responses](https://github.com/owncloud/product/issues/262) - -- [apiWebdavProperties2/getFileProperties.feature:306](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L306) -- [apiWebdavProperties2/getFileProperties.feature:307](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L307) -- [apiWebdavProperties2/getFileProperties.feature:312](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L312) - #### [changing user quota gives ocs status 103 / Cannot set quota](https://github.com/owncloud/product/issues/247) - [apiShareOperationsToShares2/uploadToShare.feature:210](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares2/uploadToShare.feature#L210) diff --git a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md index c6749c82e2f..aaa5aaf48ed 100644 --- a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md @@ -74,7 +74,6 @@ Other free text and markdown formatting can be used elsewhere in the document if - [webUIPrivateLinks/accessingPrivateLinks.feature:9](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L9) - [webUIPrivateLinks/accessingPrivateLinks.feature:17](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L17) - [webUIPrivateLinks/accessingPrivateLinks.feature:25](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L25) -- [webUIPrivateLinks/accessingPrivateLinks.feature:35](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L35) ### [Share additional info](https://github.com/owncloud/ocis/issues/1253) - [webUISharingInternalUsersShareWithPage/shareWithUsers.feature:140](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalUsersShareWithPage/shareWithUsers.feature#L140) From cb7d26d061071b34d7a1a2425e1db27438d2086a Mon Sep 17 00:00:00 2001 From: David Christofas Date: Thu, 15 Sep 2022 13:39:26 +0200 Subject: [PATCH 09/13] remove the Open Sans font --- services/idp/public/index.html | 1 - services/idp/src/app.css | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/services/idp/public/index.html b/services/idp/public/index.html index 8dccae78b8d..a8307ad824d 100644 --- a/services/idp/public/index.html +++ b/services/idp/public/index.html @@ -5,7 +5,6 @@ - Sign in - ownCloud diff --git a/services/idp/src/app.css b/services/idp/src/app.css index 531d4a056b0..a2636504c1d 100644 --- a/services/idp/src/app.css +++ b/services/idp/src/app.css @@ -11,7 +11,7 @@ html { } body { - font-family: Inter, 'Open Sans', sans-serif; + font-family: Inter, sans-serif; } strong { From fbbbb82bda81cefb7f2578b1e05d8098d5ee601a Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 12:10:41 +0000 Subject: [PATCH 10/13] Automated changelog update [skip ci] --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eedbe87c10..7cf116a557f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ The following sections list the changes for unreleased. * Bugfix - Render webdav permissions as string in search report: [#4575](https://github.com/owncloud/ocis/issues/4575) * Bugfix - Graph service now forwards trace context: [#4582](https://github.com/owncloud/ocis/pull/4582) +* Enhancement - Add webURL to space root: [#4588](https://github.com/owncloud/ocis/pull/4588) * Enhancement - Allow to configure applications in Web: [#4578](https://github.com/owncloud/ocis/pull/4578) +* Enhancement - Update reva: [#4588](https://github.com/owncloud/ocis/pull/4588) ## Details @@ -23,11 +25,23 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/pull/4582 +* Enhancement - Add webURL to space root: [#4588](https://github.com/owncloud/ocis/pull/4588) + + Add the web url to the space root on the graphAPI. + + https://github.com/owncloud/ocis/pull/4588 + * Enhancement - Allow to configure applications in Web: [#4578](https://github.com/owncloud/ocis/pull/4578) We've added the possibility to configure applications in the Web configuration. https://github.com/owncloud/ocis/pull/4578 + +* Enhancement - Update reva: [#4588](https://github.com/owncloud/ocis/pull/4588) + + TBD + + https://github.com/owncloud/ocis/pull/4588 # Changelog for [2.0.0-beta.8] (2022-09-13) The following sections list the changes for 2.0.0-beta.8. From 0387e15d347d49853ce52cd1a9b39e69f5f98ff4 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 14 Sep 2022 13:38:15 +0545 Subject: [PATCH 11/13] Reuse the core code --- .drone.env | 2 +- ...ected-failures-localAPI-on-OCIS-storage.md | 4 +- .../features/apiSpaces/changeSpaces.feature | 1 + .../features/apiSpaces/copySpaces.feature | 13 +- ...eateFileFolderWhenSharesSpaceExist.feature | 22 +- .../features/apiSpaces/download.feature | 1 + .../apiSpaces/editPublicLinkOfSpace.feature | 1 + .../features/apiSpaces/filePreviews.feature | 1 + .../features/apiSpaces/listSpaces.feature | 1 + .../features/apiSpaces/moveSpaces.feature | 1 + .../features/apiSpaces/quota.feature | 1 + .../apiSpaces/removeSpaceObjects.feature | 1 + .../apiSpaces/restoreSpaceObjects.feature | 1 + .../features/apiSpaces/restoreSpaces.feature | 1 + .../features/apiSpaces/search.feature | 10 +- .../features/apiSpaces/shareSpaces.feature | 1 + .../apiSpaces/shareSpacesViaLink.feature | 1 + .../apiSpaces/shareSubItemOfSpace.feature | 6 +- .../shareSubItemOfSpaceViaPublicLink.feature | 1 + .../features/apiSpaces/uploadSpaces.feature | 1 + .../features/bootstrap/SpacesContext.php | 385 +++--------------- 21 files changed, 92 insertions(+), 364 deletions(-) diff --git a/.drone.env b/.drone.env index 35be598948f..8c9cf337ab7 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=67fad9d49fa7f3f42f77e882ee4cbb206464ca5d +CORE_COMMITID=82a05d010110c0b4b2513c22185eac28b5dce054 CORE_BRANCH=master # The test runner source for UI tests diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 5330a6acb7f..58bdd3ad640 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -32,8 +32,8 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSpaces/changingFilesShare.feature:12](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changingFilesShare.feature#L12) ### [copy to overwrite (file and folder) from Personal to Shares Jail behaves differently](https://github.com/owncloud/ocis/issues/4393) -- [apiSpaces/copySpaces.feature:487](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L487) -- [apiSpaces/copySpaces.feature:501](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L501) +- [apiSpaces/copySpaces.feature:488](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L488) +- [apiSpaces/copySpaces.feature:502](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L502) ### [search doesn't find the project space by name](https://github.com/owncloud/ocis/issues/4506) - [apiSpaces/search.feature:95](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L95) diff --git a/tests/acceptance/features/apiSpaces/changeSpaces.feature b/tests/acceptance/features/apiSpaces/changeSpaces.feature index 2ea08dfb430..629ce61601c 100644 --- a/tests/acceptance/features/apiSpaces/changeSpaces.feature +++ b/tests/acceptance/features/apiSpaces/changeSpaces.feature @@ -16,6 +16,7 @@ Feature: Change data of space And user "Alice" has created a space "Project Jupiter" of type "project" with quota "20" And user "Alice" has shared a space "Project Jupiter" to user "Brian" with role "editor" And user "Alice" has shared a space "Project Jupiter" to user "Bob" with role "viewer" + And using spaces DAV path Scenario Outline: Only space admin user can change the name of a Space via the Graph API diff --git a/tests/acceptance/features/apiSpaces/copySpaces.feature b/tests/acceptance/features/apiSpaces/copySpaces.feature index 11a5b57bfd1..09de24ed33d 100644 --- a/tests/acceptance/features/apiSpaces/copySpaces.feature +++ b/tests/acceptance/features/apiSpaces/copySpaces.feature @@ -9,6 +9,7 @@ Feature: copy file | username | | Alice | | Brian | + And using spaces DAV path Scenario Outline: Copying a file within a same space project with role manager and editor @@ -527,9 +528,9 @@ Feature: copy file Then the HTTP status code should be "204" And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares Jail" should contain these entries: - | /second-level-folder/third-level-folder/sample-folder-c | + | /second-level-folder/third-level-folder/sample-folder-c/ | And for user "Brian" folder "BRIAN-FOLDER" of the space "Personal" should contain these files: - | /second-level-folder/third-level-folder/sample-folder-c | + | /second-level-folder/third-level-folder/sample-folder-c/ | And the response when user "Alice" gets the info of the last share should include | file_target | /Shares/BRIAN-FOLDER | @@ -594,7 +595,7 @@ Feature: copy file And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares Jail" should contain these entries: | /second-level-folder/third-level-file.txt/third-level-folder | And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares Jail" should not contain these entries: - | /second-level-folder/second-level-folder | + | /second-level-folder/second-level-folder/ | And the response when user "Alice" gets the info of the last share should include | file_target | /Shares/BRIAN-FOLDER | @@ -616,7 +617,7 @@ Feature: copy file Then the HTTP status code should be "204" And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares Jail" should contain these files: - | /second-level-folder/third-level-folder/sample-folder-c | + | /second-level-folder/third-level-folder/sample-folder-c/ | And the response when user "Alice" gets the info of the last share should include | file_target | /Shares/BRIAN-FOLDER | @@ -684,8 +685,8 @@ Feature: copy file When user "Alice" copies folder "/FOLDER/second-level-folder" from space "Personal" to "/BRIAN-FOLDER/second-level-folder/third-level-file.txt" inside space "Shares Jail" using the WebDAV API Then the HTTP status code should be "204" And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares Jail" should contain these files: - | /second-level-folder/third-level-file.txt | - | /second-level-folder/third-level-file.txt/third-level-folder | + | /second-level-folder/third-level-file.txt/ | + | /second-level-folder/third-level-file.txt/third-level-folder/ | And as "Alice" folder "FOLDER/second-level-folder/third-level-folder" should exist And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares Jail" should not contain these files: | /second-level-folder/second-level-folder | diff --git a/tests/acceptance/features/apiSpaces/createFileFolderWhenSharesSpaceExist.feature b/tests/acceptance/features/apiSpaces/createFileFolderWhenSharesSpaceExist.feature index 912225f6adf..2d657526059 100644 --- a/tests/acceptance/features/apiSpaces/createFileFolderWhenSharesSpaceExist.feature +++ b/tests/acceptance/features/apiSpaces/createFileFolderWhenSharesSpaceExist.feature @@ -18,12 +18,12 @@ Feature: create file or folder named similar to Shares folder When user "Brian" creates folder "" using the WebDAV API Then the HTTP status code should be "201" And for user "Brian" the space "Personal" should contain these entries: - | / | + | / | Examples: | folder_name | - | /Share | - | /shares | - | /Share1 | + | Share | + | shares | + | Share1 | Scenario Outline: create a file with a name similar to Shares Given using spaces DAV path @@ -31,25 +31,25 @@ Feature: create file or folder named similar to Shares folder Then the HTTP status code should be "201" And the content of file "" for user "Brian" should be "some text" And for user "Brian" the space "Personal" should contain these entries: - | / | + | | And for user "Brian" the space "Shares Jail" should contain these entries: - | /FOLDER | + | FOLDER/ | Examples: | file_name | - | /Share | - | /shares | - | /Share1 | + | Share | + | shares | + | Share1 | Scenario: try to create a folder named Shares Given using spaces DAV path When user "Brian" creates folder "/Shares" using the WebDAV API Then the HTTP status code should be "201" And for user "Brian" the space "Shares Jail" should contain these entries: - | /FOLDER | + | FOLDER/ | Scenario: try to create a file named Shares Given using spaces DAV path When user "Brian" uploads file with content "some text" to "/Shares" using the WebDAV API Then the HTTP status code should be "201" And for user "Brian" the space "Shares Jail" should contain these entries: - | /FOLDER | + | FOLDER/ | diff --git a/tests/acceptance/features/apiSpaces/download.feature b/tests/acceptance/features/apiSpaces/download.feature index 983c8b58afe..af74af5841b 100644 --- a/tests/acceptance/features/apiSpaces/download.feature +++ b/tests/acceptance/features/apiSpaces/download.feature @@ -11,6 +11,7 @@ Feature: Download file in project space | Alice | | Brian | | Bob | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "download file" with the default quota using the GraphApi And user "Alice" has uploaded a file inside space "download file" with content "some content" to "file.txt" diff --git a/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature b/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature index 29e4a96f902..e065f30815e 100644 --- a/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature +++ b/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature @@ -14,6 +14,7 @@ Feature: A manager of the space can edit public link | username | | Alice | | Brian | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "edit space" with the default quota using the GraphApi And user "Alice" has created a public link share of the space "edit space" with settings: diff --git a/tests/acceptance/features/apiSpaces/filePreviews.feature b/tests/acceptance/features/apiSpaces/filePreviews.feature index 93f9009cb74..6d861d3e832 100644 --- a/tests/acceptance/features/apiSpaces/filePreviews.feature +++ b/tests/acceptance/features/apiSpaces/filePreviews.feature @@ -11,6 +11,7 @@ Feature: Preview file in project space | Alice | And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "previews of the files" with the default quota using the GraphApi + And using spaces DAV path Scenario Outline: An user can preview created txt files in the project space diff --git a/tests/acceptance/features/apiSpaces/listSpaces.feature b/tests/acceptance/features/apiSpaces/listSpaces.feature index f4f3e96a0a4..bf80f38ac79 100644 --- a/tests/acceptance/features/apiSpaces/listSpaces.feature +++ b/tests/acceptance/features/apiSpaces/listSpaces.feature @@ -8,6 +8,7 @@ Feature: List and create spaces Background: Given user "Alice" has been created with default attributes and without skeleton files + And using spaces DAV path Scenario: An ordinary user can request information about their Space via the Graph API diff --git a/tests/acceptance/features/apiSpaces/moveSpaces.feature b/tests/acceptance/features/apiSpaces/moveSpaces.feature index dc7297f6e84..4a04c377314 100644 --- a/tests/acceptance/features/apiSpaces/moveSpaces.feature +++ b/tests/acceptance/features/apiSpaces/moveSpaces.feature @@ -9,6 +9,7 @@ Feature: move (rename) file | username | | Alice | | Brian | + And using spaces DAV path Scenario Outline: Moving a file within same space project with role manager and editor Given the administrator has given "Brian" the role "Space Admin" using the settings api diff --git a/tests/acceptance/features/apiSpaces/quota.feature b/tests/acceptance/features/apiSpaces/quota.feature index 781d6b1ce6b..72f29d5bf5a 100644 --- a/tests/acceptance/features/apiSpaces/quota.feature +++ b/tests/acceptance/features/apiSpaces/quota.feature @@ -14,6 +14,7 @@ Feature: State of the quota Background: Given user "Alice" has been created with default attributes and without skeleton files And the administrator has given "Alice" the role "Space Admin" using the settings api + And using spaces DAV path Scenario Outline: Quota information is returned in the list of spaces returned via the Graph API diff --git a/tests/acceptance/features/apiSpaces/removeSpaceObjects.feature b/tests/acceptance/features/apiSpaces/removeSpaceObjects.feature index e7650acb72b..bdcd09eaaf0 100644 --- a/tests/acceptance/features/apiSpaces/removeSpaceObjects.feature +++ b/tests/acceptance/features/apiSpaces/removeSpaceObjects.feature @@ -13,6 +13,7 @@ Feature: Remove files, folder | username | | Alice | | Brian | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "delete objects" with the default quota using the GraphApi And user "Alice" has created a folder "folderForDeleting/sub1/sub2" in space "delete objects" diff --git a/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature b/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature index b1c970c6280..74c81fd48a9 100644 --- a/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature +++ b/tests/acceptance/features/apiSpaces/restoreSpaceObjects.feature @@ -14,6 +14,7 @@ Feature: Restore files, folder | Brian | | Bob | | Carol | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" creates a space "restore objects" of type "project" with the default quota using the GraphApi And user "Alice" has created a folder "newFolder" in space "restore objects" diff --git a/tests/acceptance/features/apiSpaces/restoreSpaces.feature b/tests/acceptance/features/apiSpaces/restoreSpaces.feature index cc881478610..e2a4b8db9c4 100644 --- a/tests/acceptance/features/apiSpaces/restoreSpaces.feature +++ b/tests/acceptance/features/apiSpaces/restoreSpaces.feature @@ -16,6 +16,7 @@ Feature: Restoring space | Bob | And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "restore a space" of type "project" with quota "10" + And using spaces DAV path Scenario: An owner can restore a Space via the Graph API diff --git a/tests/acceptance/features/apiSpaces/search.feature b/tests/acceptance/features/apiSpaces/search.feature index ade0b35c12f..8fcd40f5c57 100644 --- a/tests/acceptance/features/apiSpaces/search.feature +++ b/tests/acceptance/features/apiSpaces/search.feature @@ -10,12 +10,12 @@ Feature: Search | username | | Alice | | Brian | - And using new DAV path + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "find data" with the default quota using the GraphApi And user "Alice" has created a folder "folder/SubFolder1/subFOLDER2" in space "find data" And user "Alice" has uploaded a file inside space "find data" with content "some content" to "folder/SubFolder1/subFOLDER2/insideTheFolder.txt" - + And using new DAV path Scenario: Alice can find data from the project space When user "Alice" searches for "fol" using the WebDAV API @@ -51,7 +51,7 @@ Feature: Search | /SubFolder1/subFOLDER2 | | /SubFolder1/subFOLDER2/insideTheFolder.txt | And for user "Brian" the search result should contain space "mountpoint/folder" - + Scenario: User can find hidden file Given user "Alice" has created a folder ".space" in space "find data" @@ -72,7 +72,7 @@ Feature: Search | /SubFolder1/subFOLDER2 | | /SubFolder1/subFOLDER2/insideTheFolder.txt | - + Scenario: User cannot find declined folder Given user "Alice" shares the following entity "folder" inside of space "find data" with user "Brian" with role "viewer" And user "Brian" has declined share "/folder" offered by user "Alice" @@ -90,7 +90,7 @@ Feature: Search When user "Alice" searches for "folder" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries - + Scenario: User can find project space by name When user "Alice" searches for "find data" using the WebDAV API diff --git a/tests/acceptance/features/apiSpaces/shareSpaces.feature b/tests/acceptance/features/apiSpaces/shareSpaces.feature index 176423df0f7..e95c97f2ee4 100644 --- a/tests/acceptance/features/apiSpaces/shareSpaces.feature +++ b/tests/acceptance/features/apiSpaces/shareSpaces.feature @@ -14,6 +14,7 @@ Feature: Share spaces | Bob | And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "share space" with the default quota using the GraphApi + And using spaces DAV path Scenario Outline:: A user can share a space to another user diff --git a/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature b/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature index 643157df974..49b7d2cbb99 100644 --- a/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature +++ b/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature @@ -11,6 +11,7 @@ Feature: Share spaces via link | username | | Alice | | Brian | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "share space" with the default quota using the GraphApi And user "Alice" has uploaded a file inside space "share space" with content "some content" to "test.txt" diff --git a/tests/acceptance/features/apiSpaces/shareSubItemOfSpace.feature b/tests/acceptance/features/apiSpaces/shareSubItemOfSpace.feature index 184fae7da6b..228524400d9 100644 --- a/tests/acceptance/features/apiSpaces/shareSubItemOfSpace.feature +++ b/tests/acceptance/features/apiSpaces/shareSubItemOfSpace.feature @@ -13,13 +13,15 @@ Feature: Share a file or folder that is inside a space | Alice | | Brian | | Bob | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "share sub-item" with the default quota using the GraphApi And user "Alice" has created a folder "folder" in space "share sub-item" And user "Alice" has uploaded a file inside space "share sub-item" with content "some content" to "file.txt" + And using new DAV path - - Scenario Outline: A manager of the space can share an entity inside project space to another user with role: + + Scenario Outline: A manager of the space can share an entity inside project space to another user with role When user "Alice" shares the following entity "" inside of space "share sub-item" with user "Brian" with role "" Then the HTTP status code should be "200" And the OCS status code should be "200" diff --git a/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature b/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature index 96f74ad2bdd..ca027bcf380 100644 --- a/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature +++ b/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature @@ -23,6 +23,7 @@ Feature: Share a file or folder that is inside a space via public link | username | | Alice | | Brian | + And using spaces DAV path And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "share sub-item" with the default quota using the GraphApi And user "Alice" has created a folder "folder" in space "share sub-item" diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 9b170787cf9..c987c688d25 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -14,6 +14,7 @@ Feature: Upload files into a space | Bob | And the administrator has given "Alice" the role "Space Admin" using the settings api And user "Alice" has created a space "Project Ceres" of type "project" with quota "2000" + And using spaces DAV path Scenario Outline: An user creates a folder in the Space via the Graph API diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index dac9c6fc2b0..fc999aab846 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -69,7 +69,10 @@ class SpacesContext implements Context { * @var ChecksumContext */ private ChecksumContext $checksumContext; - + /** + * @var FilesVersionsContext + */ + private FilesVersionsContext $filesVersionsContext; /** * @var string */ @@ -107,18 +110,6 @@ class SpacesContext implements Context { */ private $storedEtags = []; - /** - * - * @var string[][] - */ - private $tokenOfLastLock = []; - - private $etagPropfindBody = '' - . '' - . ''; - /** * @param string $spaceName * @@ -192,22 +183,6 @@ class SpacesContext implements Context { */ private string $responseSpaceId; - /** - * @param string $responseSpaceId - * - * @return void - */ - public function setResponseSpaceId(string $responseSpaceId): void { - $this->responseSpaceId = $responseSpaceId; - } - - /** - * @return string - */ - public function getResponseSpaceId(): string { - return $this->responseSpaceId; - } - /** * Get SpaceId by Name * @@ -285,6 +260,8 @@ class SpacesContext implements Context { */ public function setSpaceIDByName(string $user, string $spaceName): void { $space = $this->getSpaceByName($user, $spaceName); + Assert::assertIsArray($space, "Space with name $spaceName not found"); + Assert::assertNotEmpty($space["root"]["webDavUrl"], "WebDavUrl for space with name $spaceName not found"); WebDavHelper::$SPACE_ID_FROM_OCIS = $space['id']; } @@ -340,29 +317,6 @@ class SpacesContext implements Context { return $this->featureContext->getResponse(); } - /** - * Download a file using user password - * - * @param string $fullUrl - * @param string $user - * - * @return void - */ - public function downloadFileAsUserUsingPassword( - string $fullUrl, - string $user - ):void { - $this->featureContext->setResponse( - HttpRequestHelper::sendRequest( - $fullUrl, - $this->featureContext->getStepLineRef(), - 'GET', - $user, - $this->featureContext->getPasswordForUser($user), - ) - ); - } - /** * The method returns fileId * @@ -456,6 +410,7 @@ class SpacesContext implements Context { $this->webDavPropertiesContext = $environment->getContext('WebDavPropertiesContext'); $this->favoritesContext = $environment->getContext('FavoritesContext'); $this->checksumContext = $environment->getContext('ChecksumContext'); + $this->filesVersionsContext = $environment->getContext('FilesVersionsContext'); // Run the BeforeScenario function in OCSContext to set it up correctly $this->ocsContext->before($scope); $this->baseUrl = \trim($this->featureContext->getBaseUrl(), "/"); @@ -542,31 +497,6 @@ class SpacesContext implements Context { return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PROPFIND', $user, $password, $headers, $body); } - /** - * Send Put Request to Url - * - * @param string $fullUrl - * @param string $user - * @param string $password - * @param string $xRequestId - * @param array $headers - * @param string $content - * - * @return ResponseInterface - * - * @throws GuzzleException - */ - public function sendPutRequestToUrl( - string $fullUrl, - string $user, - string $password, - string $xRequestId = '', - array $headers = [], - string $content = "" - ): ResponseInterface { - return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PUT', $user, $password, $headers, $content); - } - /** * Send POST Request to url * @@ -856,24 +786,20 @@ class SpacesContext implements Context { string $spaceName, string $foldersPath = '' ): void { - $space = $this->getSpaceByName($user, $spaceName); - Assert::assertIsArray($space); - Assert::assertNotEmpty($spaceId = $space["id"]); - Assert::assertNotEmpty($spaceWebDavUrl = $space["root"]["webDavUrl"]); - $headers['Depth'] = 'infinity'; + $this->setSpaceIDByName($user, $spaceName); $this->featureContext->setResponse( - $this->sendPropfindRequestToUrl( - $spaceWebDavUrl . '/' . $foldersPath, + WebDavHelper::propfind( + $this->featureContext->getBaseUrl(), $user, $this->featureContext->getPasswordForUser($user), + $foldersPath, + [], '', - $headers + 'infinity', + 'files', + WebDavHelper::DAV_VERSION_SPACES ) ); - $this->setResponseSpaceId($spaceId); - $this->setResponseXml( - HttpRequestHelper::parseResponseAsXml($this->featureContext->getResponse()) - ); } /** @@ -890,10 +816,11 @@ class SpacesContext implements Context { string $shouldOrNot, TableNode $expectedFiles ): void { - $this->propfindResultShouldContainEntries( + $this->featureContext->propfindResultShouldContainEntries( $shouldOrNot, $expectedFiles, ); + WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } /** @@ -912,14 +839,18 @@ class SpacesContext implements Context { string $shouldOrNot, TableNode $expectedFiles ): void { + $spaceCreator = $this->getSpaceCreator($spaceName); + $space = $this->getSpaceByName($spaceCreator, $spaceName); $this->theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi( - $this->getSpaceCreator($spaceName), + $spaceCreator, $spaceName ); - $this->propfindResultShouldContainEntries( + WebDavHelper::$SPACE_ID_FROM_OCIS = $space['id']; + $this->featureContext->propfindResultShouldContainEntries( $shouldOrNot, $expectedFiles, ); + WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } /** @@ -940,14 +871,14 @@ class SpacesContext implements Context { string $shouldOrNot, TableNode $expectedFiles ): void { + $space = $this->getSpaceByName($user, $spaceName); $this->theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi( $user, $spaceName ); - $this->propfindResultShouldContainEntries( - $shouldOrNot, - $expectedFiles - ); + WebDavHelper::$SPACE_ID_FROM_OCIS = $space['id']; + $this->featureContext->propfindResultShouldContainEntries($shouldOrNot, $expectedFiles, $user, 'PROPFIND'); + WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } /** @@ -970,16 +901,21 @@ class SpacesContext implements Context { string $shouldOrNot, TableNode $expectedFiles ): void { + $space = $this->getSpaceByName($user, $spaceName); $this->theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi( $user, $spaceName, $folderPath ); - $this->propfindResultShouldContainEntries( + WebDavHelper::$SPACE_ID_FROM_OCIS = $space['id']; + $this->featureContext->propfindResultShouldContainEntries( $shouldOrNot, $expectedFiles, + $this->featureContext->getActualUsername($user), + 'PROPFIND', $folderPath ); + WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } /** @@ -1214,43 +1150,6 @@ class SpacesContext implements Context { } } - /** - * @param string $shouldOrNot (not|) - * @param TableNode $expectedFiles - * @param string $folderPath - * - * @return void - * - * @throws Exception - */ - public function propfindResultShouldContainEntries( - string $shouldOrNot, - TableNode $expectedFiles, - string $folderPath = '' - ): void { - $this->verifyTableNodeColumnsCount($expectedFiles, 1); - $elementRows = $expectedFiles->getRows(); - $should = ($shouldOrNot !== "not"); - - foreach ($elementRows as $expectedFile) { - $fileFound = $this->findEntryFromPropfindResponse( - $expectedFile[0], - $folderPath - ); - if ($should) { - Assert::assertNotEmpty( - $fileFound, - "response does not contain the entry '$expectedFile[0]'" - ); - } else { - Assert::assertEmpty( - $fileFound, - "response does contain the entry '$expectedFile[0]' but should not" - ); - } - } - } - /** * Verify that the tableNode contains expected number of columns * @@ -1288,72 +1187,6 @@ class SpacesContext implements Context { return \str_replace([" ", "(", ")"], ["%20", "%28", "%29"], $path); } - /** - * parses a PROPFIND response from $this->response into xml - * and returns found search results if found else returns false - * - * @param string|null $entryNameToSearch - * @param string $folderPath - * - * @return array - * string if $entryNameToSearch is given and is found - * array if $entryNameToSearch is not given - * boolean false if $entryNameToSearch is given and is not found - */ - public function findEntryFromPropfindResponse( - string $entryNameToSearch = null, - string $folderPath = '' - ): array { - $spaceId = $this->getResponseSpaceId(); - //if we are using that step the second time in a scenario e.g. 'But ... should not' - //then don't parse the result again, because the result is in a ResponseInterface - if (empty($this->getResponseXml())) { - $this->setResponseXml( - HttpRequestHelper::parseResponseAsXml($this->featureContext->getResponse()) - ); - } - Assert::assertNotEmpty($this->getResponseXml(), __METHOD__ . ' Response is empty'); - Assert::assertNotEmpty($spaceId, __METHOD__ . ' SpaceId is empty'); - - // trim any leading "/" passed by the caller, we can just match the "raw" name - $trimmedEntryNameToSearch = \trim($entryNameToSearch, "/"); - - // url encode for spaces and brackets that may appear in the filePath - $folderPath = $this->escapePath($folderPath); - - // topWebDavPath should be something like /remote.php/webdav/ or - // /remote.php/dav/files/alice/ - $topWebDavPath = "/" . "dav/spaces/" . $spaceId . "/" . $folderPath; - - Assert::assertIsArray( - $this->responseXml, - __METHOD__ . " responseXml for space $spaceId is not an array" - ); - Assert::assertArrayHasKey( - "value", - $this->responseXml, - __METHOD__ . " responseXml for space $spaceId does not have key 'value'" - ); - $multistatusResults = $this->responseXml["value"]; - $results = []; - if ($multistatusResults !== null) { - foreach ($multistatusResults as $multistatusResult) { - $entryPath = \urldecode($multistatusResult['value'][0]['value']); - $entryName = \str_replace($topWebDavPath, "", $entryPath); - $entryName = \rawurldecode($entryName); - $entryName = \trim($entryName, "/"); - if ($trimmedEntryNameToSearch === $entryName) { - return $multistatusResult; - } - $results[] = $entryName; - } - } - if ($entryNameToSearch === null) { - return $results; - } - return []; - } - /** * @When /^user "([^"]*)" creates a (?:folder|subfolder) "([^"]*)" in space "([^"]*)" using the WebDav Api$/ * @@ -1423,19 +1256,8 @@ class SpacesContext implements Context { if ($ownerUser === '') { $ownerUser = $user; } - - $space = $this->getSpaceByName($ownerUser, $spaceName); - - $fullUrl = $this->baseUrl . "/dav/spaces/" . $space['id'] . '/' . $folder; - - $this->featureContext->setResponse( - $this->sendCreateFolderRequest( - $fullUrl, - "MKCOL", - $user, - $this->featureContext->getPasswordForUser($user) - ) - ); + $this->setSpaceIDByName($ownerUser, $spaceName); + $this->featureContext->userCreatesFolder($user, $folder); } /** @@ -1456,20 +1278,8 @@ class SpacesContext implements Context { string $content, string $destination ): void { - $space = $this->getSpaceByName($user, $spaceName); - Assert::assertIsArray($space, "Space with name $spaceName not found"); - Assert::assertNotEmpty($space["root"]["webDavUrl"], "WebDavUrl for space with name $spaceName not found"); - - $this->featureContext->setResponse( - $this->sendPutRequestToUrl( - $space["root"]["webDavUrl"] . "/" . $destination, - $user, - $this->featureContext->getPasswordForUser($user), - "", - [], - $content - ) - ); + $this->setSpaceIDByName($user, $spaceName); + $this->featureContext->uploadFileWithContent($user, $content, $destination); } /** @@ -1492,20 +1302,8 @@ class SpacesContext implements Context { string $content, string $destination ): void { - $space = $this->getSpaceByName($ownerUser, $spaceName); - Assert::assertIsArray($space, "Space with name $spaceName not found"); - Assert::assertNotEmpty($space["root"]["webDavUrl"], "WebDavUrl for space with name $spaceName not found"); - - $this->featureContext->setResponse( - $this->sendPutRequestToUrl( - $space["root"]["webDavUrl"] . "/" . $destination, - $user, - $this->featureContext->getPasswordForUser($user), - "", - [], - $content - ) - ); + $this->setSpaceIDByName($ownerUser, $spaceName); + $this->featureContext->uploadFileWithContent($user, $content, $destination); } /** @@ -1917,7 +1715,7 @@ class SpacesContext implements Context { ):void { $space = $this->getSpaceByName($user, $spaceName); $fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileName, "/"); - $this->downloadFileAsUserUsingPassword($fullUrl, $user); + $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName, $this->featureContext->getPasswordForUser($user)); Assert::assertGreaterThanOrEqual( 400, $this->featureContext->getResponse()->getStatusCode(), @@ -2017,22 +1815,7 @@ class SpacesContext implements Context { string $destination ): void { $this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user); - - $space = $this->getSpaceByName($user, $spaceName); - Assert::assertIsArray($space, "Space with name $spaceName not found"); - Assert::assertNotEmpty($space["root"]["webDavUrl"], "WebDavUrl for space with name $spaceName not found"); - - $this->featureContext->setResponse( - $this->sendPutRequestToUrl( - $space["root"]["webDavUrl"] . "/" . $destination, - $user, - $this->featureContext->getPasswordForUser($user), - "", - [], - $fileContent - ) - ); - + $this->theUserUploadsAFileToSpace($user, $spaceName, $fileContent, $destination); $this->featureContext->theHTTPStatusCodeShouldBeOr(201, 204); } @@ -2098,7 +1881,6 @@ class SpacesContext implements Context { ]; $fullUrl = $this->baseUrl . $this->ocsApiUrl; - $this->featureContext->setResponse( $this->sendPostRequestToUrl( $fullUrl, @@ -2671,20 +2453,8 @@ class SpacesContext implements Context { string $fileName, string $spaceName ): void { - $space = $this->getSpaceByName($user, $spaceName); - $fullUrl = $this->baseUrl . $this->davSpacesUrl . $space['id'] . '/' . $fileName; - - $this->featureContext->setResponse( - HttpRequestHelper::sendRequest( - $fullUrl, - "", - 'HEAD', - $user, - $this->featureContext->getPasswordForUser($user), - [], - "" - ) - ); + $this->setSpaceIDByName($user, $spaceName); + $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName, $this->featureContext->getPasswordForUser($user)); } /** @@ -2746,56 +2516,9 @@ class SpacesContext implements Context { string $index, string $spaceName ): void { - $fileVersion = $this->listFileVersion($user, $fileName, $spaceName); - if (!isset($fileVersion[$index])) { - Assert::fail( - 'could not find version of file "' . $fileName . '" with index "' . $index . '"' - ); - } - $url = $this->baseUrl . $fileVersion[$index][0]; - - $this->featureContext->setResponse( - HttpRequestHelper::sendRequest( - $url, - "", - 'HEAD', - $user, - $this->featureContext->getPasswordForUser($user), - [], - "" - ) - ); - } - - /** - * Method returns an array with url values from the propfind request - * like: /remote.php/dav/meta/spaceUuid%fileUuid/v/fileUuid.REV.2022-05-17T10:39:49.672285951Z - * - * @param string $user - * @param string $fileName - * @param string $spaceName - * - * @return array - * @throws GuzzleException - */ - public function listFileVersion( - string $user, - string $fileName, - string $spaceName - ): array { - $fileId = $this->getFileId($user, $spaceName, $fileName); - $fullUrl = $this->baseUrl . '/remote.php/dav/meta/' . $fileId . '/v'; - - $this->featureContext->setResponse( - $this->sendPropfindRequestToUrl( - $fullUrl, - $user, - $this->featureContext->getPasswordForUser($user) - ) - ); - - $responseXml = HttpRequestHelper::getResponseXml($this->featureContext->getResponse()); - return $responseXml->xpath("//d:response/d:href"); + $this->setSpaceIDByName($user, $spaceName); + $this->filesVersionsContext->downloadVersion($user, $fileName, $index); + WebDavHelper::$SPACE_ID_FROM_OCIS = ''; } /** @@ -2809,20 +2532,8 @@ class SpacesContext implements Context { * @throws GuzzleException */ public function userGetsEtagOfElementInASpace(string $user, string $space, string $path) { - $user = $this->featureContext->getActualUsername($user); - $space = $this->getSpaceByName($user, $space); - - $fullUrl = $space['root']['webDavUrl'] . '/' . ltrim($path, '/'); - $response = $this->sendPropfindRequestToUrl( - $fullUrl, - $user, - $this->featureContext->getPasswordForUser($user), - $this->featureContext->getStepLineRef(), - [], - $this->etagPropfindBody - ); - $responseXml = HttpRequestHelper::getResponseXml($response); - $this->featureContext->setResponseXmlObject($responseXml); + $this->setSpaceIDByName($user, $space); + $this->webDavPropertiesContext->storeEtagOfElement($user, $path); return $this->featureContext->getEtagFromResponseXmlObject(); } From 2d16779652c6e853c7a570f1545a814a7a68b5bc Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Fri, 16 Sep 2022 11:20:40 +0200 Subject: [PATCH 12/13] fix the oidc provider cache --- changelog/unreleased/fix-oidc-provider-cache.md | 6 ++++++ services/proxy/pkg/middleware/oidc_auth.go | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 changelog/unreleased/fix-oidc-provider-cache.md diff --git a/changelog/unreleased/fix-oidc-provider-cache.md b/changelog/unreleased/fix-oidc-provider-cache.md new file mode 100644 index 00000000000..bfc4e222895 --- /dev/null +++ b/changelog/unreleased/fix-oidc-provider-cache.md @@ -0,0 +1,6 @@ +Bugfix: Fix the OIDC provider cache + +We've fixed the OIDC provider cache. It never had a cache hit before this fix. +Under some circumstances it could cause a painfully slow OCIS if the IDP wellknown endpoint takes some time to respond. + +https://github.com/owncloud/ocis/pull/4600 diff --git a/services/proxy/pkg/middleware/oidc_auth.go b/services/proxy/pkg/middleware/oidc_auth.go index c89f83d5ccd..f0dabbd7522 100644 --- a/services/proxy/pkg/middleware/oidc_auth.go +++ b/services/proxy/pkg/middleware/oidc_auth.go @@ -32,9 +32,9 @@ type OIDCProvider interface { // NewOIDCAuthenticator returns a ready to use authenticator which can handle OIDC authentication. func NewOIDCAuthenticator(logger log.Logger, tokenCacheTTL int, oidcHTTPClient *http.Client, oidcIss string, providerFunc func() (OIDCProvider, error), - jwksOptions config.JWKS, accessTokenVerifyMethod string) OIDCAuthenticator { + jwksOptions config.JWKS, accessTokenVerifyMethod string) *OIDCAuthenticator { tokenCache := osync.NewCache(tokenCacheTTL) - return OIDCAuthenticator{ + return &OIDCAuthenticator{ Logger: logger, tokenCache: &tokenCache, TokenCacheTTL: time.Duration(tokenCacheTTL), @@ -66,7 +66,7 @@ type OIDCAuthenticator struct { JWKS *keyfunc.JWKS } -func (m OIDCAuthenticator) getClaims(token string, req *http.Request) (map[string]interface{}, error) { +func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[string]interface{}, error) { var claims map[string]interface{} hit := m.tokenCache.Load(token) if hit == nil { @@ -168,7 +168,7 @@ type jwksJSON struct { JWKSURL string `json:"jwks_uri"` } -func (m OIDCAuthenticator) getKeyfunc() *keyfunc.JWKS { +func (m *OIDCAuthenticator) getKeyfunc() *keyfunc.JWKS { m.jwksLock.Lock() defer m.jwksLock.Unlock() if m.JWKS == nil { @@ -219,7 +219,7 @@ func (m OIDCAuthenticator) getKeyfunc() *keyfunc.JWKS { return m.JWKS } -func (m OIDCAuthenticator) getProvider() OIDCProvider { +func (m *OIDCAuthenticator) getProvider() OIDCProvider { m.providerLock.Lock() defer m.providerLock.Unlock() if m.provider == nil { @@ -240,7 +240,7 @@ func (m OIDCAuthenticator) getProvider() OIDCProvider { } // Authenticate implements the authenticator interface to authenticate requests via oidc auth. -func (m OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) { +func (m *OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) { // there is no bearer token on the request, if !m.shouldServe(r) || isPublicPath(r.URL.Path) { // The authentication of public path requests is handled by another authenticator. From b8cce99e7a827f8b462165b6061dfff95d62e782 Mon Sep 17 00:00:00 2001 From: Willy Kloucek <34452982+wkloucek@users.noreply.github.com> Date: Fri, 16 Sep 2022 11:39:36 +0000 Subject: [PATCH 13/13] Automated changelog update [skip ci] --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cf116a557f..1b3f2e1996a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The following sections list the changes for unreleased. ## Summary +* Bugfix - Fix the OIDC provider cache: [#4600](https://github.com/owncloud/ocis/pull/4600) * Bugfix - Render webdav permissions as string in search report: [#4575](https://github.com/owncloud/ocis/issues/4575) * Bugfix - Graph service now forwards trace context: [#4582](https://github.com/owncloud/ocis/pull/4582) * Enhancement - Add webURL to space root: [#4588](https://github.com/owncloud/ocis/pull/4588) @@ -14,6 +15,14 @@ The following sections list the changes for unreleased. ## Details +* Bugfix - Fix the OIDC provider cache: [#4600](https://github.com/owncloud/ocis/pull/4600) + + We've fixed the OIDC provider cache. It never had a cache hit before this fix. Under some + circumstances it could cause a painfully slow OCIS if the IDP wellknown endpoint takes some + time to respond. + + https://github.com/owncloud/ocis/pull/4600 + * Bugfix - Render webdav permissions as string in search report: [#4575](https://github.com/owncloud/ocis/issues/4575) We now correctly render the `oc:permissions` of resources as a string.