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/CHANGELOG.md b/CHANGELOG.md
index 4eedbe87c10..1b3f2e1996a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,12 +6,23 @@ 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)
* 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
+* 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.
@@ -23,11 +34,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.
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/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/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/docs/services/frontend/_index.md b/docs/services/frontend/_index.md
index 097fde9320d..20ace43cb54 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 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.
+
+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
diff --git a/go.mod b/go.mod
index f62ddb8a153..d67c3645523 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ require (
github.com/ReneKroon/ttlcache/v2 v2.11.0
github.com/bbalet/stopwords v1.0.0
github.com/blevesearch/bleve/v2 v2.3.4
- 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.20220914125507-790323a570c7
github.com/disintegration/imaging v1.6.2
@@ -68,10 +68,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 3b84f58fb68..9cb8fd1b683 100644
--- a/go.sum
+++ b/go.sum
@@ -268,8 +268,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=
@@ -1270,14 +1270,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=
diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go
index 3d86d9fef4b..2c83a70722a 100644
--- a/services/graph/pkg/service/v0/drives.go
+++ b/services/graph/pkg/service/v0/drives.go
@@ -595,7 +595,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)),
@@ -642,15 +641,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.WebUrl = libregraph.PtrString(webURL.String())
+
if space.Owner != nil && space.Owner.Id != nil {
drive.Owner = &libregraph.IdentitySet{
User: &libregraph.Identity{
@@ -674,7 +681,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
}
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"
}
]
}
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 {
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.
+
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.
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-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/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)
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();
}