Merge branch 'master' into MergeMasterIntoExperimental

This commit is contained in:
jkoberg committed 2022-09-16 13:46:14 +02:00
commit 1cde36436f
37 files changed
+194 -399

No files matched your search

+1 -1
View File
@@ -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
+23
View File
@@ -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.
+5
View File
@@ -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
@@ -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
+5
View File
@@ -0,0 +1,5 @@
Enhancement: Update reva
TBD
https://github.com/owncloud/ocis/pull/4588
+21
View File
@@ -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.
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+6 -6
View File
@@ -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=
+12 -6
View File
@@ -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
}
+9 -3
View File
@@ -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"
}
]
}
-1
View File
@@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#1b223d">
<link rel="shortcut icon" href="%PUBLIC_URL%/static/favicon.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet">
<meta property="csp-nonce" content="__CSP_NONCE__">
<title>Sign in - ownCloud</title>
</head>
+1 -1
View File
@@ -11,7 +11,7 @@ html {
}
body {
font-family: Inter, 'Open Sans', sans-serif;
font-family: Inter, sans-serif;
}
strong {
+4
View File
@@ -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.
+6 -6
View File
@@ -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.
@@ -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)
@@ -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)
@@ -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)
@@ -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
@@ -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 |
@@ -18,12 +18,12 @@ Feature: create file or folder named similar to Shares folder
When user "Brian" creates folder "<folder_name>" using the WebDAV API
Then the HTTP status code should be "201"
And for user "Brian" the space "Personal" should contain these entries:
| /<folder_name> |
| <folder_name>/ |
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 "<file_name>" for user "Brian" should be "some text"
And for user "Brian" the space "Personal" should contain these entries:
| /<file_name> |
| <file_name> |
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/ |
@@ -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"
@@ -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:
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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"
@@ -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"
@@ -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
@@ -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
@@ -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
@@ -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"
@@ -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 "<entity>" inside of space "share sub-item" with user "Brian" with role "<role>"
Then the HTTP status code should be "200"
And the OCS status code should be "200"
@@ -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"
@@ -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
@@ -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 = '<?xml version="1.0"?>'
. '<d:propfind xmlns:d="DAV:" '
. 'xmlns:oc="http://owncloud.org/ns" '
. 'xmlns:ocs="http://open-collaboration-services.org/ns">'
. '<d:prop><d:getetag/></d:prop></d:propfind>';
/**
* @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();
}