From 6bcf17a7cc1e7d5eb36dd7d131258c70c0e2ac92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Tue, 13 Sep 2022 09:42:14 +0200 Subject: [PATCH 1/3] Add config variable for configuring the jsoncs3 share manager cache ttl --- services/sharing/pkg/config/config.go | 9 +++++---- services/sharing/pkg/revaconfig/config.go | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index 9e47248b21..396272601c 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -103,10 +103,11 @@ type UserSharingCS3Driver struct { // UserSharingJSONCS3Driver holds the jsoncs3 driver config 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."` + ProviderAddr string `yaml:"provider_addr" env:"SHARING_USER_JSONCS3_PROVIDER_ADDR" desc:"GRPC address of the STORAGE-SYSTEM service."` + SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_USER_JSONCS3_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_JSONCS3_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_JSONCS3_SYSTEM_USER_API_KEY" desc:"API key for the STORAGE-SYSTEM system user."` + CacheTTL int `yaml:"cache_ttl" env:"SHARING_USER_JSONCS3_CACHE_TTL" desc:"TTL for the internal caches in seconds."` } type PublicSharingDrivers struct { diff --git a/services/sharing/pkg/revaconfig/config.go b/services/sharing/pkg/revaconfig/config.go index f7b8a5bcb8..e66cf07f25 100644 --- a/services/sharing/pkg/revaconfig/config.go +++ b/services/sharing/pkg/revaconfig/config.go @@ -62,6 +62,7 @@ func SharingConfigFromStruct(cfg *config.Config) map[string]interface{} { "service_user_id": cfg.UserSharingDrivers.JSONCS3.SystemUserID, "service_user_idp": cfg.UserSharingDrivers.JSONCS3.SystemUserIDP, "machine_auth_apikey": cfg.UserSharingDrivers.JSONCS3.SystemUserAPIKey, + "ttl": cfg.UserSharingDrivers.JSONCS3.CacheTTL, }, }, }, From e0aab33ca2e306e301604c069be8167309fedad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Tue, 13 Sep 2022 13:54:34 +0200 Subject: [PATCH 2/3] Fix test expectations --- .../shareSubItemOfSpaceViaPublicLink.feature | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature b/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature index e9bb47d8af..96f74ad2bd 100644 --- a/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature +++ b/tests/acceptance/features/apiSpaces/shareSubItemOfSpaceViaPublicLink.feature @@ -41,15 +41,15 @@ Feature: Share a file or folder that is inside a space via public link And the OCS status code should be "200" And the OCS status message should be "OK" And the fields of the last response to user "Alice" should include - | path | / | + | path | | Examples: - | entity | permissions | password | name | expireDate | - | folder | 1 | 123 | link | 2042-03-25T23:59:59+0100 | - | folder | 4 | | | | - | folder | 5 | 200 | | 2042-03-25T23:59:59+0100 | - | folder | 15 | | link | | - | folder/file.txt | 1 | 123 | link | 2042-03-25T23:59:59+0100 | - | folder/file.txt | 3 | 123 | link | 2042-03-25T23:59:59+0100 | + | entity | path | permissions | password | name | expireDate | + | folder | /folder |1 | 123 | link | 2042-03-25T23:59:59+0100 | + | folder | /folder |4 | | | | + | folder | /folder |5 | 200 | | 2042-03-25T23:59:59+0100 | + | folder | /folder |15 | | link | | + | folder/file.txt | /file.txt |1 | 123 | link | 2042-03-25T23:59:59+0100 | + | folder/file.txt | /file.txt |3 | 123 | link | 2042-03-25T23:59:59+0100 | Scenario Outline: An user participant of the project space with space manager role can share an entity inside project space via public link @@ -65,11 +65,11 @@ Feature: Share a file or folder that is inside a space via public link And the OCS status code should be "200" And the OCS status message should be "OK" And the fields of the last response to user "Alice" should include - | path | / | + | path | | Examples: - | entity | - | folder | - | folder/file.txt | + | entity | path | + | folder | /folder | + | folder/file.txt | /file.txt | Scenario Outline: An user participant of the project space without space manager role cannot share an entity inside project space via public link From 0c4074239ed40cc219e72c2274092f6315a94cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Tue, 13 Sep 2022 14:57:36 +0200 Subject: [PATCH 3/3] Bump reva --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index ca0f0e38d4..38c6a3e2bd 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.0 + github.com/cs3org/reva/v2 v2.10.1-0.20220912153139-05271421a667 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 50a11ef515..8bf7dc4e36 100644 --- a/go.sum +++ b/go.sum @@ -292,10 +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.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/cs3org/reva/v2 v2.10.0 h1:PNGA856qrVYaPlW0KukiG+GctR0VVIhGxKAZjdvwH80= -github.com/cs3org/reva/v2 v2.10.0/go.mod h1:+BYVpRV8g1hL8wF3+3BunL9BKPsXVyJYmH8COxq/V7Y= +github.com/cs3org/reva/v2 v2.10.1-0.20220912153139-05271421a667 h1:Bb6P6zXtDtSkX5Whs2DWyS01Z+8nXWvqaxRgHV8JbiA= +github.com/cs3org/reva/v2 v2.10.1-0.20220912153139-05271421a667/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=