From 23da13b35fe92c085dca7c3d55d436fa86fc5292 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 09:27:30 +0200 Subject: [PATCH 1/3] add web url to graph api and update reva --- go.mod | 2 +- go.sum | 6 ++---- services/graph/pkg/service/v0/drives.go | 18 ++++++++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index b96d1282586..46e6875ed1c 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/blevesearch/bleve_index_api v1.0.3 github.com/coreos/go-oidc/v3 v3.3.0 github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d - github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b + github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index 1a87bda1533..c5e183483fa 100644 --- a/go.sum +++ b/go.sum @@ -292,8 +292,8 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4= github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A= github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d h1:toyZ7IsXlUdEPZ/IG8fg7hbM8HcLPY0bkX4FKBmgLVI= github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b h1:mRtQad2TBNE970FYntYSZJJp+Ol0fzcICf/n/UmHb1g= -github.com/cs3org/reva/v2 v2.10.1-0.20220914095102-44dc469bd48b/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 h1:siIHxgMHWCxERsHPYwHL7Pno27URyqjV2np9Mh1U84g= +github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -1074,8 +1074,6 @@ github.com/prometheus/statsd_exporter v0.22.4/go.mod h1:N4Z1+iSqc9rnxlT1N8Qn3l65 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rhafer/reva/v2 v2.0.0-20220913142514-cf5b93129713 h1:CLaGrpVJLptZk417YiW4jRHfTKiLMl9RljrxZd5u4l0= -github.com/rhafer/reva/v2 v2.0.0-20220913142514-cf5b93129713/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index a704c8ab038..6d5f2ef5074 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -525,7 +525,6 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa Id: libregraph.PtrString(spaceID), Name: &space.Name, //"createdDateTime": "string (timestamp)", // TODO read from StorageSpace ... needs Opaque for now - //"description": "string", // TODO read from StorageSpace ... needs Opaque for now DriveType: &space.SpaceType, Root: &libregraph.DriveItem{ Id: libregraph.PtrString(storagespace.FormatResourceID(spaceRid)), @@ -572,15 +571,23 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa } if baseURL != nil { - // TODO read from StorageSpace ... needs Opaque for now - // TODO how do we build the url? - // for now: read from request webDavURL := *baseURL webDavURL.Path = path.Join(webDavURL.Path, spaceID) drive.Root.WebDavUrl = libregraph.PtrString(webDavURL.String()) } - // TODO The public space has no owner ... should we even show it? + webURL, err := url.Parse(g.config.Commons.OcisURL) + if err != nil { + g.logger.Error(). + Err(err). + Str("url", g.config.Commons.OcisURL). + Msg("failed to parse base url") + return nil, err + } + + webURL.Path = path.Join(webURL.Path, "f", storagespace.FormatResourceID(spaceRid)) + drive.Root.WebUrl = libregraph.PtrString(webURL.String()) + if space.Owner != nil && space.Owner.Id != nil { drive.Owner = &libregraph.IdentitySet{ User: &libregraph.Identity{ @@ -604,7 +611,6 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa Total: &t, } } - // FIXME use coowner from https://github.com/owncloud/open-graph-api return drive, nil } From a129ea6abef654d37c812d0e87f907dee9f4b67e Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 10:42:00 +0200 Subject: [PATCH 2/3] fix unit tests --- services/graph/pkg/service/v0/drives.go | 2 +- services/graph/pkg/service/v0/graph_test.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index 6d5f2ef5074..8ff4c8c048b 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -586,7 +586,7 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa } webURL.Path = path.Join(webURL.Path, "f", storagespace.FormatResourceID(spaceRid)) - drive.Root.WebUrl = libregraph.PtrString(webURL.String()) + drive.WebUrl = libregraph.PtrString(webURL.String()) if space.Owner != nil && space.Owner.Id != nil { drive.Owner = &libregraph.IdentitySet{ diff --git a/services/graph/pkg/service/v0/graph_test.go b/services/graph/pkg/service/v0/graph_test.go index 0629e6ff674..fcd969c5821 100644 --- a/services/graph/pkg/service/v0/graph_test.go +++ b/services/graph/pkg/service/v0/graph_test.go @@ -17,6 +17,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" libregraph "github.com/owncloud/libre-graph-api-go" + "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/graph/mocks" "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults" @@ -39,6 +40,8 @@ var _ = Describe("Graph", func() { cfg = defaults.FullDefaultConfig() cfg.Identity.LDAP.CACert = "" // skip the startup checks, we don't use LDAP at all in this tests cfg.TokenManager.JWTSecret = "loremipsum" + cfg.Commons = &shared.Commons{} + cfg.Commons.OcisURL = "https://ocis.test" gatewayClient = &mocks.GatewayClient{} eventsPublisher = mocks.Publisher{} @@ -108,7 +111,8 @@ var _ = Describe("Graph", func() { "root":{ "id":"pro-1$sameID", "webDavUrl":"https://localhost:9200/dav/spaces/pro-1$sameID" - } + }, + "webUrl": "https://ocis.test/f/pro-1$sameID" } ] } @@ -178,7 +182,8 @@ var _ = Describe("Graph", func() { "eTag":"101112131415", "id":"pro-1$asameID", "webDavUrl":"https://localhost:9200/dav/spaces/pro-1$asameID" - } + }, + "webUrl": "https://ocis.test/f/pro-1$asameID" }, { "driveAlias":"bspacetype/bspacename", @@ -189,7 +194,8 @@ var _ = Describe("Graph", func() { "eTag":"123456789", "id":"pro-1$bsameID", "webDavUrl":"https://localhost:9200/dav/spaces/pro-1$bsameID" - } + }, + "webUrl": "https://ocis.test/f/pro-1$bsameID" } ] } From e092da586b34cf688bfbca4a68b5817a1cbb8d2f Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 15 Sep 2022 10:42:31 +0200 Subject: [PATCH 3/3] add changelog --- changelog/unreleased/add-web-url.md | 5 +++++ changelog/unreleased/update-reva-rc1.md | 5 +++++ go.mod | 2 +- go.sum | 2 ++ tests/acceptance/expected-failures-API-on-OCIS-storage.md | 7 ------- .../acceptance/expected-failures-webUI-on-OCIS-storage.md | 1 - 6 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 changelog/unreleased/add-web-url.md create mode 100644 changelog/unreleased/update-reva-rc1.md diff --git a/changelog/unreleased/add-web-url.md b/changelog/unreleased/add-web-url.md new file mode 100644 index 00000000000..f4826375781 --- /dev/null +++ b/changelog/unreleased/add-web-url.md @@ -0,0 +1,5 @@ +Enhancement: Add webURL to space root + +Add the web url to the space root on the graphAPI. + +https://github.com/owncloud/ocis/pull/4588 diff --git a/changelog/unreleased/update-reva-rc1.md b/changelog/unreleased/update-reva-rc1.md new file mode 100644 index 00000000000..09553bdd55c --- /dev/null +++ b/changelog/unreleased/update-reva-rc1.md @@ -0,0 +1,5 @@ +Enhancement: Update reva + +TBD + +https://github.com/owncloud/ocis/pull/4588 diff --git a/go.mod b/go.mod index 46e6875ed1c..273f32d88f3 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/blevesearch/bleve_index_api v1.0.3 github.com/coreos/go-oidc/v3 v3.3.0 github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d - github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 + github.com/cs3org/reva/v2 v2.10.1-0.20220915095422-4b099c09a66c github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index c5e183483fa..0de687f09b6 100644 --- a/go.sum +++ b/go.sum @@ -294,6 +294,8 @@ github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d h1:toyZ7IsXlUdEP github.com/cs3org/go-cs3apis v0.0.0-20220818202316-e92afdddac6d/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980 h1:siIHxgMHWCxERsHPYwHL7Pno27URyqjV2np9Mh1U84g= github.com/cs3org/reva/v2 v2.10.1-0.20220915071600-3358dc72a980/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220915095422-4b099c09a66c h1:pvbsnSl5WpS6PkSR4glwR8OJGrRdZASajAJtNwp9E+Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220915095422-4b099c09a66c/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 8a9d4aee201..ba8c9509135 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -298,13 +298,6 @@ cannot share a folder with create permission - [apiTrashbin/trashbinSharingToShares.feature:212](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinSharingToShares.feature#L212) - [apiTrashbin/trashbinSharingToShares.feature:236](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinSharingToShares.feature#L236) - -#### [oc:privatelink property not returned in webdav responses](https://github.com/owncloud/product/issues/262) - -- [apiWebdavProperties2/getFileProperties.feature:306](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L306) -- [apiWebdavProperties2/getFileProperties.feature:307](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L307) -- [apiWebdavProperties2/getFileProperties.feature:312](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L312) - #### [changing user quota gives ocs status 103 / Cannot set quota](https://github.com/owncloud/product/issues/247) - [apiShareOperationsToShares2/uploadToShare.feature:210](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares2/uploadToShare.feature#L210) diff --git a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md index c6749c82e2f..aaa5aaf48ed 100644 --- a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md @@ -74,7 +74,6 @@ Other free text and markdown formatting can be used elsewhere in the document if - [webUIPrivateLinks/accessingPrivateLinks.feature:9](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L9) - [webUIPrivateLinks/accessingPrivateLinks.feature:17](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L17) - [webUIPrivateLinks/accessingPrivateLinks.feature:25](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L25) -- [webUIPrivateLinks/accessingPrivateLinks.feature:35](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L35) ### [Share additional info](https://github.com/owncloud/ocis/issues/1253) - [webUISharingInternalUsersShareWithPage/shareWithUsers.feature:140](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalUsersShareWithPage/shareWithUsers.feature#L140)