Skip to content

Commit

Permalink
Merge pull request #1186 from ishank011/home_mapping
Browse files Browse the repository at this point in the history
Functionality to map home directory to different storage providers
  • Loading branch information
butonic authored Jan 29, 2021
2 parents b7f02b0 + a4480ed commit 91b4158
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions changelog/unreleased/home-mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Enhancement: Functionality to map home directory to different storage providers

We added a parameter in reva that allows us to redirect /home requests to
different storage providers based on a mapping derived from the user attributes,
which was previously not possible since we hardcode the /home path for all
users. For example, having its value as `/home/{{substr 0 1 .Username}}` can be
used to redirect home requests for different users to different storage
providers.

https://github.com/owncloud/ocis/pull/1186
https://github.com/cs3org/reva/pull/1142
1 change: 1 addition & 0 deletions storage/pkg/command/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func Gateway(cfg *config.Config) *cli.Command {
"datagateway": cfg.Reva.DataGateway.PublicURL,
"transfer_shared_secret": cfg.Reva.TransferSecret,
"transfer_expires": cfg.Reva.TransferExpires,
"home_mapping": cfg.Reva.Gateway.HomeMapping,
},
"authregistry": map[string]interface{}{
"driver": "static",
Expand Down
3 changes: 2 additions & 1 deletion storage/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ type Gateway struct {
Port
CommitShareToStorageGrant bool
CommitShareToStorageRef bool
DisableHomeCreationOnLogin bool
ShareFolder string
LinkGrants string
DisableHomeCreationOnLogin bool
HomeMapping string
}

// StorageRegistry defines the available storage registry configuration
Expand Down
7 changes: 7 additions & 0 deletions storage/pkg/flagset/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"STORAGE_GATEWAY_DISABLE_HOME_CREATION_ON_LOGIN"},
Destination: &cfg.Reva.Gateway.DisableHomeCreationOnLogin,
},
&cli.StringFlag{
Name: "storage-home-mapping",
Value: "",
Usage: "mapping template for user home paths to user-specific mount points, e.g. /home/{{substr 0 1 .Username}}",
EnvVars: []string{"STORAGE_GATEWAY_HOME_MAPPING"},
Destination: &cfg.Reva.Gateway.HomeMapping,
},

// other services

Expand Down

0 comments on commit 91b4158

Please sign in to comment.