From 1f68321acc2341ddf9167bbeda0f9ee2058916f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Fri, 9 Sep 2022 13:04:46 +0200 Subject: [PATCH 1/7] Add support for the jsoncs3 public share manager --- ocis/pkg/command/migrate.go | 7 +++++++ services/sharing/pkg/config/config.go | 15 ++++++++++++--- .../sharing/pkg/config/defaults/defaultconfig.go | 4 ++++ services/sharing/pkg/revaconfig/config.go | 7 +++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ocis/pkg/command/migrate.go b/ocis/pkg/command/migrate.go index 4aa2889fd..56df5ac86 100644 --- a/ocis/pkg/command/migrate.go +++ b/ocis/pkg/command/migrate.go @@ -275,6 +275,13 @@ func revaPublicShareConfig(cfg *sharing.Config) map[string]interface{} { "file": cfg.PublicSharingDrivers.JSON.File, "gateway_addr": cfg.Reva.Address, }, + "jsoncs3": map[string]interface{}{ + "gateway_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, + "provider_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, + "service_user_id": cfg.PublicSharingDrivers.JSONCS3.SystemUserID, + "service_user_idp": cfg.PublicSharingDrivers.JSONCS3.SystemUserIDP, + "machine_auth_apikey": cfg.PublicSharingDrivers.JSONCS3.SystemUserAPIKey, + }, "sql": map[string]interface{}{ "db_username": cfg.PublicSharingDrivers.SQL.DBUsername, "db_password": cfg.PublicSharingDrivers.SQL.DBPassword, diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index fc285665c..f9f091362 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -110,8 +110,9 @@ type UserSharingJSONCS3Driver struct { } type PublicSharingDrivers struct { - JSON PublicSharingJSONDriver `yaml:"json"` - CS3 PublicSharingCS3Driver `yaml:"cs3"` + JSON PublicSharingJSONDriver `yaml:"json"` + CS3 PublicSharingCS3Driver `yaml:"cs3"` + JSONCS3 PublicSharingJSONCS3Driver `yaml:"jsoncs3"` SQL PublicSharingSQLDriver `yaml:"sql,omitempty"` // not supported by the oCIS product, therefore not part of docs } @@ -136,7 +137,15 @@ type PublicSharingCS3Driver struct { ProviderAddr string `yaml:"provider_addr" env:"SHARING_PUBLIC_CS3_PROVIDER_ADDR" desc:"GRPC address of the STORAGE-SYSTEM service."` SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_PUBLIC_CS3_SYSTEM_USER_ID" desc:"ID of the oCIS STORAGE-SYSTEM system user. Admins need to set the ID for the STORAGE-SYSTEM system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format."` SystemUserIDP string `yaml:"system_user_idp" env:"OCIS_SYSTEM_USER_IDP;SHARING_PUBLIC_CS3_SYSTEM_USER_IDP" desc:"IDP of the oCIS STORAGE-SYSTEM system user."` - SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY;SHARING_USER_CS3_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user."` + SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY;SHARING_PUBLIC_CS3_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user."` +} + +// PublicSharingJSONCS3Driver holds the jsoncs3 driver config +type PublicSharingJSONCS3Driver struct { + ProviderAddr string `yaml:"provider_addr" env:"SHARING_PUBLIC_CS3_PROVIDER_ADDR" desc:"GRPC address of the STORAGE-SYSTEM service."` + SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_PUBLIC_CS3_SYSTEM_USER_ID" desc:"ID of the oCIS STORAGE-SYSTEM system user. Admins need to set the ID for the STORAGE-SYSTEM system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format."` + SystemUserIDP string `yaml:"system_user_idp" env:"OCIS_SYSTEM_USER_IDP;SHARING_PUBLIC_CS3_SYSTEM_USER_ID" desc:"IDP of the oCIS STORAGE-SYSTEM system user."` + SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY;SHARING_PUBLIC_CS3_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user."` } type Events struct { diff --git a/services/sharing/pkg/config/defaults/defaultconfig.go b/services/sharing/pkg/config/defaults/defaultconfig.go index 7590e2869..668e53212 100644 --- a/services/sharing/pkg/config/defaults/defaultconfig.go +++ b/services/sharing/pkg/config/defaults/defaultconfig.go @@ -62,6 +62,10 @@ func DefaultConfig() *config.Config { ProviderAddr: "127.0.0.1:9215", // system storage SystemUserIDP: "internal", }, + JSONCS3: config.PublicSharingJSONCS3Driver{ + ProviderAddr: "127.0.0.1:9215", // system storage + SystemUserIDP: "internal", + }, // TODO implement and add owncloudsql publicshare driver }, Events: config.Events{ diff --git a/services/sharing/pkg/revaconfig/config.go b/services/sharing/pkg/revaconfig/config.go index 926c84e3b..2ecc3ade3 100644 --- a/services/sharing/pkg/revaconfig/config.go +++ b/services/sharing/pkg/revaconfig/config.go @@ -89,6 +89,13 @@ func SharingConfigFromStruct(cfg *config.Config) map[string]interface{} { "service_user_idp": cfg.PublicSharingDrivers.CS3.SystemUserIDP, "machine_auth_apikey": cfg.PublicSharingDrivers.CS3.SystemUserAPIKey, }, + "jsoncs3": map[string]interface{}{ + "gateway_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, + "provider_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, + "service_user_id": cfg.PublicSharingDrivers.JSONCS3.SystemUserID, + "service_user_idp": cfg.PublicSharingDrivers.JSONCS3.SystemUserIDP, + "machine_auth_apikey": cfg.PublicSharingDrivers.JSONCS3.SystemUserAPIKey, + }, }, }, }, From 40b7aaa7ec628320c870aab32810f0386f1f2aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 9 Sep 2022 11:54:18 +0000 Subject: [PATCH 2/7] make jsoncs3 default public share backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- services/sharing/pkg/config/defaults/defaultconfig.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/sharing/pkg/config/defaults/defaultconfig.go b/services/sharing/pkg/config/defaults/defaultconfig.go index 668e53212..8e502114a 100644 --- a/services/sharing/pkg/config/defaults/defaultconfig.go +++ b/services/sharing/pkg/config/defaults/defaultconfig.go @@ -53,7 +53,7 @@ func DefaultConfig() *config.Config { DBName: "owncloud", }, }, - PublicSharingDriver: "cs3", + PublicSharingDriver: "jsoncs3", PublicSharingDrivers: config.PublicSharingDrivers{ JSON: config.PublicSharingJSONDriver{ File: filepath.Join(defaults.BaseDataPath(), "storage", "publicshares.json"), @@ -138,6 +138,14 @@ func EnsureDefaults(cfg *config.Config) { if cfg.PublicSharingDrivers.CS3.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" { cfg.PublicSharingDrivers.CS3.SystemUserID = cfg.Commons.SystemUserID } + + if cfg.PublicSharingDrivers.JSONCS3.SystemUserAPIKey == "" && cfg.Commons != nil && cfg.Commons.SystemUserAPIKey != "" { + cfg.PublicSharingDrivers.JSONCS3.SystemUserAPIKey = cfg.Commons.SystemUserAPIKey + } + + if cfg.PublicSharingDrivers.JSONCS3.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" { + cfg.PublicSharingDrivers.JSONCS3.SystemUserID = cfg.Commons.SystemUserID + } } func Sanitize(cfg *config.Config) { From a107924a4cc4032c7a981951fac063c0bfa92037 Mon Sep 17 00:00:00 2001 From: Andre Duffeck Date: Fri, 9 Sep 2022 15:25:06 +0200 Subject: [PATCH 3/7] Update services/sharing/pkg/config/config.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörn Friedrich Dreyer --- services/sharing/pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index f9f091362..9e47248b2 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -111,8 +111,8 @@ type UserSharingJSONCS3Driver struct { type PublicSharingDrivers struct { JSON PublicSharingJSONDriver `yaml:"json"` - CS3 PublicSharingCS3Driver `yaml:"cs3"` JSONCS3 PublicSharingJSONCS3Driver `yaml:"jsoncs3"` + CS3 PublicSharingCS3Driver `yaml:"cs3"` SQL PublicSharingSQLDriver `yaml:"sql,omitempty"` // not supported by the oCIS product, therefore not part of docs } From 8bdfe5f6d12843b6b7707e040aa401c895e37b89 Mon Sep 17 00:00:00 2001 From: Andre Duffeck Date: Fri, 9 Sep 2022 15:33:20 +0200 Subject: [PATCH 4/7] Update ocis/pkg/command/migrate.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörn Friedrich Dreyer --- ocis/pkg/command/migrate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocis/pkg/command/migrate.go b/ocis/pkg/command/migrate.go index 56df5ac86..1cd179f5c 100644 --- a/ocis/pkg/command/migrate.go +++ b/ocis/pkg/command/migrate.go @@ -276,7 +276,7 @@ func revaPublicShareConfig(cfg *sharing.Config) map[string]interface{} { "gateway_addr": cfg.Reva.Address, }, "jsoncs3": map[string]interface{}{ - "gateway_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, + "gateway_addr": cfg.Reva.Address, "provider_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, "service_user_id": cfg.PublicSharingDrivers.JSONCS3.SystemUserID, "service_user_idp": cfg.PublicSharingDrivers.JSONCS3.SystemUserIDP, From 291e1914906be6d6f4d437650e80b1c28dc4ec18 Mon Sep 17 00:00:00 2001 From: Andre Duffeck Date: Fri, 9 Sep 2022 15:33:31 +0200 Subject: [PATCH 5/7] Update services/sharing/pkg/revaconfig/config.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörn Friedrich Dreyer --- services/sharing/pkg/revaconfig/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/sharing/pkg/revaconfig/config.go b/services/sharing/pkg/revaconfig/config.go index 2ecc3ade3..f7b8a5bcb 100644 --- a/services/sharing/pkg/revaconfig/config.go +++ b/services/sharing/pkg/revaconfig/config.go @@ -90,7 +90,7 @@ func SharingConfigFromStruct(cfg *config.Config) map[string]interface{} { "machine_auth_apikey": cfg.PublicSharingDrivers.CS3.SystemUserAPIKey, }, "jsoncs3": map[string]interface{}{ - "gateway_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, + "gateway_addr": cfg.Reva.Address, "provider_addr": cfg.PublicSharingDrivers.JSONCS3.ProviderAddr, "service_user_id": cfg.PublicSharingDrivers.JSONCS3.SystemUserID, "service_user_idp": cfg.PublicSharingDrivers.JSONCS3.SystemUserIDP, From c6faf4ab4f5c3cd5c92c2e31fcb1669985895036 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Fri, 9 Sep 2022 16:00:32 +0200 Subject: [PATCH 6/7] Update reva --- changelog/unreleased/update-reva-beta8.md | 1 + go.mod | 2 +- go.sum | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog/unreleased/update-reva-beta8.md b/changelog/unreleased/update-reva-beta8.md index 9932fd61f..a2353daff 100644 --- a/changelog/unreleased/update-reva-beta8.md +++ b/changelog/unreleased/update-reva-beta8.md @@ -4,3 +4,4 @@ Update reva to latest edge. https://github.com/owncloud/ocis/pull/4522 https://github.com/owncloud/ocis/pull/4534 +https://github.com/owncloud/ocis/pull/4548 diff --git a/go.mod b/go.mod index 92d6f6a5b..fb78f0f60 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.8.1-0.20220908102548-7bea458e3873 + github.com/cs3org/reva/v2 v2.9.1-0.20220909134913-22e6b3280127 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 f0c359537..08609789f 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.8.1-0.20220908102548-7bea458e3873 h1:XY44uSQQFuRb7xBG47Y9zMKhGuG/++KKxL8GXmol0pI= github.com/cs3org/reva/v2 v2.8.1-0.20220908102548-7bea458e3873/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= +github.com/cs3org/reva/v2 v2.9.1-0.20220909134913-22e6b3280127 h1:pUgPEA2a7bdFM3xREBadRaROSw71SxORtRLBZtqrEdQ= +github.com/cs3org/reva/v2 v2.9.1-0.20220909134913-22e6b3280127/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= From 48e640058ac3a8dfd0fb9ac72f69e9db25cb37f5 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Fri, 9 Sep 2022 16:51:55 +0200 Subject: [PATCH 7/7] Update expected failures --- .../expected-failures-API-on-OCIS-storage.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index e9bf01355..76657619d 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -517,20 +517,6 @@ cannot share a folder with create permission - [apiSharePublicLink3/updatePublicLinkShare.feature:45](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L45) - [apiSharePublicLink3/updatePublicLinkShare.feature:46](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L46) -#### [Increasing permission of a public link of a folder that was initially shared with share+read permissions is allowed](https://github.com/owncloud/ocis/issues/3881) - -- [apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature:159](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature#L159) -- [apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature:160](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature#L160) -- [apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature:181](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature#L181) -- [apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature#L182) - -#### [Adding public upload to a read only shared folder as a recipient is allowed ](https://github.com/owncloud/ocis/issues/2164) - -- [apiSharePublicLink3/updatePublicLinkShare.feature:364](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L364) -- [apiSharePublicLink3/updatePublicLinkShare.feature:365](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L365) -- [apiSharePublicLink3/updatePublicLinkShare.feature:424](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L424) -- [apiSharePublicLink3/updatePublicLinkShare.feature:425](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L425) - #### [Upload-only shares must not overwrite but create a separate file](https://github.com/owncloud/ocis-reva/issues/286) - [apiSharePublicLink3/uploadToPublicLinkShare.feature:24](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/uploadToPublicLinkShare.feature#L24)