From a3a4232387b62b932fddc20c0f5f89c7c0137e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 4 Feb 2020 11:43:38 +0100 Subject: [PATCH] allow different namespaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .drone.star | 1 - changelog/unreleased/pull-77.md | 16 ++++++++++++++++ pkg/command/frontend.go | 4 ++-- pkg/config/config.go | 3 ++- pkg/flagset/frontend.go | 18 ++++++++++++++---- 5 files changed, 34 insertions(+), 8 deletions(-) create mode 100755 changelog/unreleased/pull-77.md diff --git a/.drone.star b/.drone.star index de1132338..fc3a1f226 100644 --- a/.drone.star +++ b/.drone.star @@ -140,7 +140,6 @@ def testing(ctx): 'REVA_STORAGE_LOCAL_ROOT': '/srv/app/tmp/reva/root', 'REVA_STORAGE_OWNCLOUD_DATADIR': '/srv/app/tmp/reva/data', 'REVA_STORAGE_OC_DATA_TEMP_FOLDER': '/srv/app/tmp/', - 'WEBDAV_NAMESPACE_JAIL': '/' }, 'commands': [ 'mkdir -p /srv/app/tmp/reva', diff --git a/changelog/unreleased/pull-77.md b/changelog/unreleased/pull-77.md new file mode 100755 index 000000000..fce0b1e65 --- /dev/null +++ b/changelog/unreleased/pull-77.md @@ -0,0 +1,16 @@ +Bugfix: Allow different namespaces for /webdav and /dav/files + +After fbf131c the path for the "new" webdav path does not contain a username `/remote.php/dav/files/textfile0.txt`. It used to be `/remote.php/dav/files/oc/einstein/textfile0.txt` So it lost `oc/einstein`. + +This PR allows setting up different namespaces for `/webav` and `/dav/files`: + +`/webdav` is jailed into `/home` - which uses the home storage driver and uses the logged in user to construct the path +`/dav/files` is jailed into `/oc` - which uses the owncloud storage driver and expects a username as the first path segment + +This mimics oc10 + +The `WEBDAV_NAMESPACE_JAIL` environment variable is split into +- `WEBDAV_NAMESPACE` and +- `DAV_FILES_NAMESPACE` accordingly. + +Related: https://github.com/owncloud/ocis-reva/pull/68 diff --git a/pkg/command/frontend.go b/pkg/command/frontend.go index 51dd56d91..ed0895209 100644 --- a/pkg/command/frontend.go +++ b/pkg/command/frontend.go @@ -187,8 +187,8 @@ func Frontend(cfg *config.Config) *cli.Command { "prefix": "", "chunk_folder": "/var/tmp/revad/chunks", "gateway": cfg.Reva.Gateway.URL, - "files_namespace": cfg.Reva.OCDav.NamespaceJail, - "webdav_namespace": cfg.Reva.OCDav.NamespaceJail, + "files_namespace": cfg.Reva.OCDav.DavFilesNamespace, + "webdav_namespace": cfg.Reva.OCDav.WebdavNamespace, }, "ocs": map[string]interface{}{ "gateway": cfg.Reva.Gateway.URL, diff --git a/pkg/config/config.go b/pkg/config/config.go index c2f2cc6f5..ff4de607a 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -180,7 +180,8 @@ type LDAPSchema struct { // OCDav defines the available ocdav configuration. type OCDav struct { - NamespaceJail string + WebdavNamespace string + DavFilesNamespace string } // Reva defines the available reva configuration. diff --git a/pkg/flagset/frontend.go b/pkg/flagset/frontend.go index 4f55967ef..33c8668cd 100644 --- a/pkg/flagset/frontend.go +++ b/pkg/flagset/frontend.go @@ -92,11 +92,21 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { // OCDav &cli.StringFlag{ - Name: "webdav-namespace-jail", + Name: "webdav-namespace", Value: "/home/", - Usage: "Namespace prefix for the webdav endpoints /dav/files and /webdav", - EnvVars: []string{"WEBDAV_NAMESPACE_JAIL"}, - Destination: &cfg.Reva.OCDav.NamespaceJail, + Usage: "Namespace prefix for the /webdav endpoint", + EnvVars: []string{"WEBDAV_NAMESPACE"}, + Destination: &cfg.Reva.OCDav.WebdavNamespace, + }, + + // the /dav/files endpoint expects a username as the first path segment + // this can eg. be set to /eos/users + &cli.StringFlag{ + Name: "dav-files-namespace", + Value: "/oc/", + Usage: "Namespace prefix for the webdav /dav/files endpoint", + EnvVars: []string{"DAV_FILES_NAMESPACE"}, + Destination: &cfg.Reva.OCDav.DavFilesNamespace, }, // OIDC