mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-03 19:00:05 -06:00
add space alias config to s3ng and ocis driver
This commit is contained in:
2
go.mod
2
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
|
||||
|
||||
4
go.sum
4
go.sum
@@ -341,8 +341,8 @@ github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD9
|
||||
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=
|
||||
|
||||
@@ -89,12 +89,14 @@ func UserDrivers(cfg *config.Config) map[string]interface{} {
|
||||
"userprovidersvc": cfg.Reva.Users.Endpoint,
|
||||
},
|
||||
"ocis": map[string]interface{}{
|
||||
"root": cfg.Reva.UserStorage.OCIS.Root,
|
||||
"user_layout": cfg.Reva.UserStorage.OCIS.UserLayout,
|
||||
"share_folder": cfg.Reva.UserStorage.OCIS.ShareFolder,
|
||||
"treetime_accounting": true,
|
||||
"treesize_accounting": true,
|
||||
"permissionssvc": cfg.Reva.Permissions.Endpoint,
|
||||
"root": cfg.Reva.UserStorage.OCIS.Root,
|
||||
"user_layout": cfg.Reva.UserStorage.OCIS.UserLayout,
|
||||
"share_folder": cfg.Reva.UserStorage.OCIS.ShareFolder,
|
||||
"personalspacealias_template": cfg.Reva.UserStorage.OCIS.PersonalSpaceAliasTemplate,
|
||||
"generalspacealias_template": cfg.Reva.UserStorage.OCIS.GeneralSpaceAliasTemplate,
|
||||
"treetime_accounting": true,
|
||||
"treesize_accounting": true,
|
||||
"permissionssvc": cfg.Reva.Permissions.Endpoint,
|
||||
},
|
||||
"s3": map[string]interface{}{
|
||||
"enable_home": false,
|
||||
@@ -106,17 +108,19 @@ func UserDrivers(cfg *config.Config) map[string]interface{} {
|
||||
"prefix": cfg.Reva.UserStorage.S3.Root,
|
||||
},
|
||||
"s3ng": map[string]interface{}{
|
||||
"root": cfg.Reva.UserStorage.S3NG.Root,
|
||||
"user_layout": cfg.Reva.UserStorage.S3NG.UserLayout,
|
||||
"share_folder": cfg.Reva.UserStorage.S3NG.ShareFolder,
|
||||
"treetime_accounting": true,
|
||||
"treesize_accounting": true,
|
||||
"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,
|
||||
"s3.endpoint": cfg.Reva.UserStorage.S3NG.Endpoint,
|
||||
"s3.bucket": cfg.Reva.UserStorage.S3NG.Bucket,
|
||||
"root": cfg.Reva.UserStorage.S3NG.Root,
|
||||
"user_layout": cfg.Reva.UserStorage.S3NG.UserLayout,
|
||||
"share_folder": cfg.Reva.UserStorage.S3NG.ShareFolder,
|
||||
"personalspacealias_template": cfg.Reva.UserStorage.S3NG.PersonalSpaceAliasTemplate,
|
||||
"generalspacealias_template": cfg.Reva.UserStorage.S3NG.GeneralSpaceAliasTemplate,
|
||||
"treetime_accounting": true,
|
||||
"treesize_accounting": true,
|
||||
"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,
|
||||
"s3.endpoint": cfg.Reva.UserStorage.S3NG.Endpoint,
|
||||
"s3.bucket": cfg.Reva.UserStorage.S3NG.Bucket,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -15,7 +15,7 @@ Feature: List and create spaces
|
||||
And the json responded should contain a space "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| driveAlias | personal/Alice |
|
||||
| driveAlias | personal/alice |
|
||||
| id | %space_id% |
|
||||
| name | Alice Hansen |
|
||||
| quota@@@state | normal |
|
||||
@@ -100,6 +100,7 @@ Feature: List and create spaces
|
||||
And the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| driveAlias | project/project-venus |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
@@ -107,6 +108,7 @@ Feature: List and create spaces
|
||||
Then the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| driveAlias | project/project-venus |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
|
||||
Reference in New Issue
Block a user