diff --git a/go.mod b/go.mod index fab3b2be8fb..b059a9d4505 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/blevesearch/bleve/v2 v2.3.1 github.com/coreos/go-oidc/v3 v3.1.0 github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19 - github.com/cs3org/reva/v2 v2.0.0-20220315083752-d008faf40d48 + github.com/cs3org/reva/v2 v2.0.0-20220316045927-99115670eb33 github.com/disintegration/imaging v1.6.2 github.com/glauth/glauth/v2 v2.0.0-20211021011345-ef3151c28733 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index 2dba5e80ad3..7e3327b4e31 100644 --- a/go.sum +++ b/go.sum @@ -342,8 +342,8 @@ 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/v2 v2.0.0-20220315083752-d008faf40d48 h1:BLaNoseOPNvE5Khyc0DnUBFb29oiRja1RRCLBQcrjOQ= -github.com/cs3org/reva/v2 v2.0.0-20220315083752-d008faf40d48/go.mod h1:XNtK1HEClNzmz5vyQa2DUw4KH3oqBjQoEsV1LhAGlV0= +github.com/cs3org/reva/v2 v2.0.0-20220316045927-99115670eb33 h1:XK88Fs9FteY9a+iKXqPhUK38zNQbP1jj60zy+Tx7SPI= +github.com/cs3org/reva/v2 v2.0.0-20220316045927-99115670eb33/go.mod h1:XNtK1HEClNzmz5vyQa2DUw4KH3oqBjQoEsV1LhAGlV0= 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/storage/pkg/config/config.go b/storage/pkg/config/config.go index 086f4b9ef23..df983cb340e 100644 --- a/storage/pkg/config/config.go +++ b/storage/pkg/config/config.go @@ -241,6 +241,12 @@ type DriverCommon struct { UserLayout string `ocisConfig:"user_layout"` // EnableHome enables the creation of home directories. EnableHome bool `ocisConfig:"enable_home"` + // PersonalSpaceAliasTemplate contains the template used to construct + // the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"` + PersonalSpaceAliasTemplate string `ocisConfig:"personalspacealias_template"` + // GeneralSpaceAliasTemplate contains the template used to construct + // the general space alias, eg: `{{.SpaceType}}/{{.SpaceName | replace " " "-" | lower}}` + GeneralSpaceAliasTemplate string `ocisConfig:"generalspacealias_template"` } // DriverEOS defines the available EOS driver configuration. @@ -1528,6 +1534,14 @@ 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_PERSONAL_SPACE_ALIAS_TEMPLATE"}, + Destination: &cfg.Reva.UserStorage.OCIS.PersonalSpaceAliasTemplate, + }, + { + EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_GENERAL_SPACE_ALIAS_TEMPLATE"}, + Destination: &cfg.Reva.UserStorage.OCIS.GeneralSpaceAliasTemplate, + }, // driver owncloud sql { EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DATADIR"}, @@ -1601,6 +1615,14 @@ func structMappings(cfg *Config) []shared.EnvBinding { EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SHARE_FOLDER"}, Destination: &cfg.Reva.UserStorage.S3NG.ShareFolder, }, + { + EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_PERSONAL_SPACE_ALIAS_TEMPLATE"}, + Destination: &cfg.Reva.UserStorage.S3NG.PersonalSpaceAliasTemplate, + }, + { + EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_GENERAL_SPACE_ALIAS_TEMPLATE"}, + Destination: &cfg.Reva.UserStorage.S3NG.GeneralSpaceAliasTemplate, + }, { EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_REGION"}, Destination: &cfg.Reva.UserStorage.S3NG.Region, diff --git a/storage/pkg/config/defaults/defaultconfig.go b/storage/pkg/config/defaults/defaultconfig.go index 142b05db7ff..a24319458e9 100644 --- a/storage/pkg/config/defaults/defaultconfig.go +++ b/storage/pkg/config/defaults/defaultconfig.go @@ -9,11 +9,13 @@ import ( ) const ( - defaultPublicURL = "https://localhost:9200" - defaultShareFolder = "/Shares" - defaultStorageNamespace = "/users/{{.Id.OpaqueId}}" - defaultGatewayAddr = "127.0.0.1:9142" - defaultUserLayout = "{{.Id.OpaqueId}}" + defaultPublicURL = "https://localhost:9200" + defaultShareFolder = "/Shares" + defaultStorageNamespace = "/users/{{.Id.OpaqueId}}" + defaultGatewayAddr = "127.0.0.1:9142" + defaultUserLayout = "{{.Id.OpaqueId}}" + defaultPersonalSpaceAliasTemplate = "{{.SpaceType}}/{{.User.Username | lower}}" + defaultGeneralSpaceAliasTemplate = "{{.SpaceType}}/{{.SpaceName | replace \" \" \"-\" | lower}}" ) func FullDefaultConfig() *config.Config { @@ -145,10 +147,12 @@ func DefaultConfig() *config.Config { }, S3NG: config.DriverS3NG{ DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "users"), - ShareFolder: defaultShareFolder, - UserLayout: defaultUserLayout, - EnableHome: false, + Root: path.Join(defaults.BaseDataPath(), "storage", "users"), + ShareFolder: defaultShareFolder, + UserLayout: defaultUserLayout, + PersonalSpaceAliasTemplate: defaultPersonalSpaceAliasTemplate, + GeneralSpaceAliasTemplate: defaultGeneralSpaceAliasTemplate, + EnableHome: false, }, Region: "default", AccessKey: "", @@ -158,9 +162,11 @@ func DefaultConfig() *config.Config { }, OCIS: config.DriverOCIS{ DriverCommon: config.DriverCommon{ - Root: path.Join(defaults.BaseDataPath(), "storage", "users"), - ShareFolder: defaultShareFolder, - UserLayout: defaultUserLayout, + Root: path.Join(defaults.BaseDataPath(), "storage", "users"), + ShareFolder: defaultShareFolder, + UserLayout: defaultUserLayout, + PersonalSpaceAliasTemplate: defaultPersonalSpaceAliasTemplate, + GeneralSpaceAliasTemplate: defaultGeneralSpaceAliasTemplate, }, }, },