From 44042f82870976872c1f90ca9f6e0857ef01a578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 23 Feb 2022 15:57:15 +0000 Subject: [PATCH] update reva to unclude decomposedfs nodes-per-space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- go.mod | 2 + go.sum | 4 +- ocis-pkg/metadata_storage/metadata_storage.go | 3 ++ settings/pkg/service/v0/settings.go | 45 +++++++++++++++++++ .../pkg/command/storagedrivers/metadata.go | 5 +-- storage/pkg/command/storagedrivers/user.go | 6 +-- storage/pkg/config/config.go | 29 +++--------- storage/pkg/config/defaultconfig.go | 24 +++++----- 8 files changed, 71 insertions(+), 47 deletions(-) diff --git a/go.mod b/go.mod index 7b9425c0925..ceb1e3d6909 100644 --- a/go.mod +++ b/go.mod @@ -268,3 +268,5 @@ require ( // we need to use a fork to make the windows build pass replace github.com/pkg/xattr => github.com/micbar/xattr v0.4.6-0.20220215112335-88e74d648fb7 + +replace github.com/cs3org/reva => github.com/butonic/reva v0.0.0-20220223150629-d510a2f63f5b diff --git a/go.sum b/go.sum index 4643f0bee54..63622b64138 100644 --- a/go.sum +++ b/go.sum @@ -258,6 +258,8 @@ github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f/go.mod h1:8rLXio+Wji github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/butonic/reva v0.0.0-20220223150629-d510a2f63f5b h1:pzeoOElf+DDdA8zFMMx7MRdwkXhGEDoV36xc/vWTvLw= +github.com/butonic/reva v0.0.0-20220223150629-d510a2f63f5b/go.mod h1:M+Nausi93NaMDoinwiUX/Ekgrp/RrYv715FG5KrIarY= github.com/c-bata/go-prompt v0.2.5/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -339,8 +341,6 @@ github.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4= github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19 h1:1jqPH58jCxvbaJ9WLIJ7W2/m622bWS6ChptzljSG6IQ= github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva v1.16.1-0.20220221135950-8cc813ecfc4c h1:52qF91Pu/jUVVWgZo4kl2GaQT5SPCdV0b5s6SQG2jrM= -github.com/cs3org/reva v1.16.1-0.20220221135950-8cc813ecfc4c/go.mod h1:M+Nausi93NaMDoinwiUX/Ekgrp/RrYv715FG5KrIarY= 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/ocis-pkg/metadata_storage/metadata_storage.go b/ocis-pkg/metadata_storage/metadata_storage.go index 51c293ec67a..b99a813ac59 100644 --- a/ocis-pkg/metadata_storage/metadata_storage.go +++ b/ocis-pkg/metadata_storage/metadata_storage.go @@ -89,6 +89,9 @@ func (ms MetadataStorage) SimpleUpload(ctx context.Context, uploadpath string, c if err != nil { return err } + if res.Status.Code != v1beta11.Code_CODE_OK { + return errtypes.NewErrtypeFromStatus(res.Status) + } var endpoint string diff --git a/settings/pkg/service/v0/settings.go b/settings/pkg/service/v0/settings.go index 454becfbac7..338e4d44daa 100644 --- a/settings/pkg/service/v0/settings.go +++ b/settings/pkg/service/v0/settings.go @@ -6,6 +6,9 @@ import ( ) const ( + // BundleUUIDRoleMetadata represents the metadata user role + BundleUUIDRoleMetadata = "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad" + // BundleUUIDRoleAdmin represents the admin role BundleUUIDRoleAdmin = "71881883-1768-46bd-a24d-a356a2afdf7f" @@ -366,6 +369,24 @@ func generatePermissionRequests() []*settingssvc.AddSettingToBundleRequest { }, }, }, + { + BundleId: BundleUUIDRoleUser, + Setting: &settingsmsg.Setting{ + Id: CreateSpacePermissionID, + Name: CreateSpacePermissionName, + DisplayName: "Create own Space", + Description: "This permission allows to create a space owned by the current user.", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SYSTEM, // TODO resource type space? self? me? own? + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_CREATE, + Constraint: settingsmsg.Permission_CONSTRAINT_OWN, + }, + }, + }, + }, { BundleId: BundleUUIDRoleAdmin, Setting: &settingsmsg.Setting{ @@ -402,11 +423,35 @@ func generatePermissionRequests() []*settingssvc.AddSettingToBundleRequest { }, }, }, + { + BundleId: BundleUUIDRoleMetadata, + Setting: &settingsmsg.Setting{ + Id: CreateSpacePermissionID, + Name: CreateSpacePermissionName, + DisplayName: "Create own Space", + Description: "This permission allows to create a space owned by the current user.", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SYSTEM, // TODO resource type space? self? me? own? + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_CREATE, + Constraint: settingsmsg.Permission_CONSTRAINT_OWN, + }, + }, + }, + }, } } func defaultRoleAssignments() []*settingsmsg.UserRoleAssignment { return []*settingsmsg.UserRoleAssignment{ + // accounts service user for the metadata user is allowed to create spaces + + { + AccountUuid: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad", + RoleId: BundleUUIDRoleAdmin, + }, // default admin users { AccountUuid: "058bff95-6708-4fe5-91e4-9ea3d377588b", diff --git a/storage/pkg/command/storagedrivers/metadata.go b/storage/pkg/command/storagedrivers/metadata.go index 6aa840296e1..445d386c2c5 100644 --- a/storage/pkg/command/storagedrivers/metadata.go +++ b/storage/pkg/command/storagedrivers/metadata.go @@ -50,11 +50,10 @@ func MetadataDrivers(cfg *config.Config) map[string]interface{} { }, "ocis": map[string]interface{}{ "root": cfg.Reva.MetadataStorage.OCIS.Root, - "enable_home": false, "user_layout": cfg.Reva.MetadataStorage.OCIS.UserLayout, "treetime_accounting": false, "treesize_accounting": false, - "owner": cfg.Reva.MetadataStorage.OCIS.ServiceUserUUID, // the accounts service system account uuid + "permissionssvc": cfg.Reva.Permissions.Endpoint, }, "s3": map[string]interface{}{ "region": cfg.Reva.MetadataStorage.S3.Region, @@ -69,7 +68,7 @@ func MetadataDrivers(cfg *config.Config) map[string]interface{} { "user_layout": cfg.Reva.MetadataStorage.S3NG.UserLayout, "treetime_accounting": false, "treesize_accounting": false, - "owner": cfg.Reva.MetadataStorage.S3NG.ServiceUserUUID, // the accounts service system account uuid + "permissionssvc": cfg.Reva.Permissions.Endpoint, "s3.region": cfg.Reva.MetadataStorage.S3NG.Region, "s3.access_key": cfg.Reva.MetadataStorage.S3NG.AccessKey, "s3.secret_key": cfg.Reva.MetadataStorage.S3NG.SecretKey, diff --git a/storage/pkg/command/storagedrivers/user.go b/storage/pkg/command/storagedrivers/user.go index 11b60a0312c..412f08deef6 100644 --- a/storage/pkg/command/storagedrivers/user.go +++ b/storage/pkg/command/storagedrivers/user.go @@ -90,12 +90,11 @@ func UserDrivers(cfg *config.Config) map[string]interface{} { }, "ocis": map[string]interface{}{ "root": cfg.Reva.UserStorage.OCIS.Root, - "enable_home": false, "user_layout": cfg.Reva.UserStorage.OCIS.UserLayout, "share_folder": cfg.Reva.UserStorage.OCIS.ShareFolder, "treetime_accounting": true, "treesize_accounting": true, - "owner": cfg.Reva.UserStorage.OCIS.ServiceUserUUID, // the accounts service system account uuid + "permissionssvc": cfg.Reva.Permissions.Endpoint, }, "s3": map[string]interface{}{ "enable_home": false, @@ -108,12 +107,11 @@ func UserDrivers(cfg *config.Config) map[string]interface{} { }, "s3ng": map[string]interface{}{ "root": cfg.Reva.UserStorage.S3NG.Root, - "enable_home": false, "user_layout": cfg.Reva.UserStorage.S3NG.UserLayout, "share_folder": cfg.Reva.UserStorage.S3NG.ShareFolder, "treetime_accounting": true, "treesize_accounting": true, - "owner": cfg.Reva.UserStorage.S3NG.ServiceUserUUID, // the accounts service system account uuid + "permissionssvc": cfg.Reva.Permissions.Endpoint, "s3.region": cfg.Reva.UserStorage.S3NG.Region, "s3.access_key": cfg.Reva.UserStorage.S3NG.AccessKey, "s3.secret_key": cfg.Reva.UserStorage.S3NG.SecretKey, diff --git a/storage/pkg/config/config.go b/storage/pkg/config/config.go index 7541633f58b..086f4b9ef23 100644 --- a/storage/pkg/config/config.go +++ b/storage/pkg/config/config.go @@ -307,8 +307,6 @@ type DriverEOS struct { // DriverOCIS defines the available oCIS storage driver configuration. type DriverOCIS struct { DriverCommon - - ServiceUserUUID string `ocisConfig:"service_user_uuid"` } // DriverOwnCloudSQL defines the available ownCloudSQL storage driver configuration. @@ -338,12 +336,11 @@ type DriverS3 struct { type DriverS3NG struct { DriverCommon - ServiceUserUUID string `ocisConfig:"service_user_uuid"` - Region string `ocisConfig:"region"` - AccessKey string `ocisConfig:"access_key"` - SecretKey string `ocisConfig:"secret_key"` - Endpoint string `ocisConfig:"endpoint"` - Bucket string `ocisConfig:"bucket"` + Region string `ocisConfig:"region"` + AccessKey string `ocisConfig:"access_key"` + SecretKey string `ocisConfig:"secret_key"` + Endpoint string `ocisConfig:"endpoint"` + Bucket string `ocisConfig:"bucket"` } // OIDC defines the available OpenID Connect configuration. @@ -1531,10 +1528,6 @@ func structMappings(cfg *Config) []shared.EnvBinding { EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SHARE_FOLDER"}, Destination: &cfg.Reva.UserStorage.OCIS.ShareFolder, }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SERVICE_USER_UUID"}, - Destination: &cfg.Reva.UserStorage.OCIS.ServiceUserUUID, - }, // driver owncloud sql { EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DATADIR"}, @@ -1604,10 +1597,6 @@ func structMappings(cfg *Config) []shared.EnvBinding { EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_LAYOUT"}, Destination: &cfg.Reva.UserStorage.S3NG.UserLayout, }, - { - EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SERVICE_USER_UUID"}, - Destination: &cfg.Reva.UserStorage.S3NG.ServiceUserUUID, - }, { EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SHARE_FOLDER"}, Destination: &cfg.Reva.UserStorage.S3NG.ShareFolder, @@ -1718,10 +1707,6 @@ func structMappings(cfg *Config) []shared.EnvBinding { EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_LAYOUT"}, Destination: &cfg.Reva.MetadataStorage.OCIS.UserLayout, }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_SERVICE_USER_UUID"}, - Destination: &cfg.Reva.MetadataStorage.OCIS.ServiceUserUUID, - }, // metadata driver s3 { @@ -1754,10 +1739,6 @@ func structMappings(cfg *Config) []shared.EnvBinding { EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_LAYOUT"}, Destination: &cfg.Reva.MetadataStorage.S3NG.UserLayout, }, - { - EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_SERVICE_USER_UUID"}, - Destination: &cfg.Reva.MetadataStorage.S3NG.ServiceUserUUID, - }, { EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_REGION"}, Destination: &cfg.Reva.MetadataStorage.S3NG.Region, diff --git a/storage/pkg/config/defaultconfig.go b/storage/pkg/config/defaultconfig.go index e186f492096..9ec857bbc5a 100644 --- a/storage/pkg/config/defaultconfig.go +++ b/storage/pkg/config/defaultconfig.go @@ -141,12 +141,11 @@ func DefaultConfig() *Config { UserLayout: defaultUserLayout, EnableHome: false, }, - ServiceUserUUID: defaultServiceUserUUID, - Region: "default", - AccessKey: "", - SecretKey: "", - Endpoint: "", - Bucket: "", + Region: "default", + AccessKey: "", + SecretKey: "", + Endpoint: "", + Bucket: "", }, OCIS: DriverOCIS{ DriverCommon: DriverCommon{ @@ -154,7 +153,6 @@ func DefaultConfig() *Config { ShareFolder: defaultShareFolder, UserLayout: defaultUserLayout, }, - ServiceUserUUID: defaultServiceUserUUID, }, }, MetadataStorage: StorageConfig{ @@ -197,12 +195,11 @@ func DefaultConfig() *Config { UserLayout: defaultUserLayout, EnableHome: false, }, - ServiceUserUUID: defaultServiceUserUUID, - Region: "default", - AccessKey: "", - SecretKey: "", - Endpoint: "", - Bucket: "", + Region: "default", + AccessKey: "", + SecretKey: "", + Endpoint: "", + Bucket: "", }, OCIS: DriverOCIS{ DriverCommon: DriverCommon{ @@ -211,7 +208,6 @@ func DefaultConfig() *Config { UserLayout: defaultUserLayout, EnableHome: false, }, - ServiceUserUUID: defaultServiceUserUUID, }, }, Frontend: FrontendPort{