Skip to content

Commit

Permalink
Merge pull request #420 from owncloud/username-userid-split-adjustments
Browse files Browse the repository at this point in the history
environment updates for the username userid split
  • Loading branch information
Vincent Petry authored Aug 14, 2020
2 parents 308addf + b1b712a commit 6361bb5
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 61 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/updates-for-username-userid-split.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: environment updates for the username userid split

We updated the owncloud storage driver in reva to properly look up users by userid or username using the userprovider instead of taking the path segment as is. This requires the user service address as well as changing the default layout to the userid instead of the username. The latter is not considered a stable and persistent identifier.

https://github.com/owncloud/ocis-reva/pull/420
https://github.com/cs3org/reva/pull/1033
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/owncloud/ocis-reva
go 1.13

require (
github.com/cs3org/reva v0.1.1-0.20200728071211-c948977dd3a0
github.com/cs3org/reva v1.1.1-0.20200813152025-baea1c67fb87
github.com/gofrs/uuid v3.3.0+incompatible
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/micro/cli/v2 v2.1.1
Expand All @@ -13,10 +13,7 @@ require (
github.com/owncloud/flaex v0.0.0-20200411150708-dce59891a203
github.com/owncloud/ocis-pkg/v2 v2.2.1
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/prometheus/client_model v0.0.0-20191202183732-d1d2010b5bee // indirect
github.com/prometheus/procfs v0.0.8 // indirect
github.com/restic/calens v0.2.0
github.com/spf13/viper v1.6.1
github.com/uber/jaeger-client-go v2.20.1+incompatible // indirect
gopkg.in/ini.v1 v1.51.1 // indirect
)
145 changes: 131 additions & 14 deletions go.sum

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions pkg/command/storagehome.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ func StorageHome(cfg *config.Config) *cli.Command {
"root": cfg.Reva.Storages.Local.Root,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": true,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": true,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
Expand Down
11 changes: 6 additions & 5 deletions pkg/command/storagehomedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ func StorageHomeData(cfg *config.Config) *cli.Command {
"root": cfg.Reva.Storages.Local.Root,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
Expand Down
11 changes: 6 additions & 5 deletions pkg/command/storageoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ func StorageOC(cfg *config.Config) *cli.Command {
"root": cfg.Reva.Storages.Local.Root,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
Expand Down
11 changes: 6 additions & 5 deletions pkg/command/storageocdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ func StorageOCData(cfg *config.Config) *cli.Command {
"root": cfg.Reva.Storages.Local.Root,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
Expand Down
4 changes: 2 additions & 2 deletions pkg/flagset/storageeos.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ func StorageEOSWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/flagset/storageeosdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
Expand Down
14 changes: 12 additions & 2 deletions pkg/flagset/storagehome.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,20 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},

// User provider

&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
}
14 changes: 12 additions & 2 deletions pkg/flagset/storagehomedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
Expand All @@ -318,5 +318,15 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},

// User provider

&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
}
14 changes: 12 additions & 2 deletions pkg/flagset/storageoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,20 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},

// User provider

&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
}
14 changes: 12 additions & 2 deletions pkg/flagset/storageocdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
Expand All @@ -320,5 +320,15 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},

// User provider

&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
}
4 changes: 2 additions & 2 deletions pkg/flagset/storageroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: "{{.Username}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ Feature: sharing
And user "Alice" has shared folder "/folder1/folder2" with user "Emily"
When user "Alice" sends HTTP method "GET" to OCS API endpoint "/apps/files_sharing/api/v1/shares"
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "<http_status_code>"
# On OCIS and reva the response is currently not there
# And the response should contain 4 entries
# And folder "/folder1" should be included as path in the response
# And folder "/folder1/folder2" should be included as path in the response
And the HTTP status code should be "200"
And the response should contain 4 entries
And folder "/folder1" should be included as path in the response
# And folder "/folder1/folder2" should be included as path in the response
And folder "/folder2" should be included as path in the response
And user "Alice" sends HTTP method "GET" to OCS API endpoint "/apps/files_sharing/api/v1/shares?path=/folder1/folder2"
And the response should contain 2 entries
And folder "/folder1" should not be included as path in the response
# And folder "/folder1/folder2" should be included as path in the response
And folder "/folder2" should be included as path in the response
# And folder "/folder1/folder2" should be included as path in the response
Examples:
| ocs_api_version | http_status_code | ocs_status_code |
| 1 | 200 | 996 |
| 2 | 500 | 996 |
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

0 comments on commit 6361bb5

Please sign in to comment.