From d363b74dac11e884f89672172c7d2a34d1a5a7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Thu, 11 Aug 2022 09:56:58 +0200 Subject: [PATCH] Add support for the jsoncs3 share manager --- services/sharing/pkg/config/config.go | 8 ++++++++ services/sharing/pkg/config/defaults/defaultconfig.go | 6 +++++- services/sharing/pkg/revaconfig/config.go | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index bada48551..fe8e74cf4 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -61,6 +61,7 @@ type GRPCConfig struct { } type UserSharingDrivers struct { + JSONCS3 UserSharingJSONCS3Driver `yaml:"jsoncs3"` JSON UserSharingJSONDriver `yaml:"json"` CS3 UserSharingCS3Driver `yaml:"cs3"` OwnCloudSQL UserSharingOwnCloudSQLDriver `yaml:"owncloudsql"` @@ -100,6 +101,13 @@ type UserSharingCS3Driver struct { 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."` } +type UserSharingJSONCS3Driver struct { + ProviderAddr string `yaml:"provider_addr" env:"SHARING_USER_CS3_PROVIDER_ADDR" desc:"GRPC address of the STORAGE-SYSTEM service."` + SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_USER_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_USER_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."` +} + type PublicSharingDrivers struct { JSON PublicSharingJSONDriver `yaml:"json"` CS3 PublicSharingCS3Driver `yaml:"cs3"` diff --git a/services/sharing/pkg/config/defaults/defaultconfig.go b/services/sharing/pkg/config/defaults/defaultconfig.go index 205d7ccb5..6d11a7e3b 100644 --- a/services/sharing/pkg/config/defaults/defaultconfig.go +++ b/services/sharing/pkg/config/defaults/defaultconfig.go @@ -33,7 +33,7 @@ func DefaultConfig() *config.Config { Reva: &config.Reva{ Address: "127.0.0.1:9142", }, - UserSharingDriver: "cs3", + UserSharingDriver: "jsoncs3", UserSharingDrivers: config.UserSharingDrivers{ JSON: config.UserSharingJSONDriver{ File: filepath.Join(defaults.BaseDataPath(), "storage", "shares.json"), @@ -42,6 +42,10 @@ func DefaultConfig() *config.Config { ProviderAddr: "127.0.0.1:9215", // system storage SystemUserIDP: "internal", }, + JSONCS3: config.UserSharingJSONCS3Driver{ + ProviderAddr: "127.0.0.1:9215", // system storage + SystemUserIDP: "internal", + }, OwnCloudSQL: config.UserSharingOwnCloudSQLDriver{ DBUsername: "owncloud", DBHost: "mysql", diff --git a/services/sharing/pkg/revaconfig/config.go b/services/sharing/pkg/revaconfig/config.go index 5b5634f1f..297042c4c 100644 --- a/services/sharing/pkg/revaconfig/config.go +++ b/services/sharing/pkg/revaconfig/config.go @@ -56,6 +56,13 @@ func SharingConfigFromStruct(cfg *config.Config) map[string]interface{} { "service_user_idp": cfg.UserSharingDrivers.CS3.SystemUserIDP, "machine_auth_apikey": cfg.UserSharingDrivers.CS3.SystemUserAPIKey, }, + "jsoncs3": map[string]interface{}{ + "gateway_addr": cfg.UserSharingDrivers.JSONCS3.ProviderAddr, + "provider_addr": cfg.UserSharingDrivers.JSONCS3.ProviderAddr, + "service_user_id": cfg.UserSharingDrivers.JSONCS3.SystemUserID, + "service_user_idp": cfg.UserSharingDrivers.JSONCS3.SystemUserIDP, + "machine_auth_apikey": cfg.UserSharingDrivers.JSONCS3.SystemUserAPIKey, + }, }, }, "publicshareprovider": map[string]interface{}{