From 42e238c18b2a70f17350d1e29d15cdd4abb31b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 7 Dec 2021 11:26:10 +0000 Subject: [PATCH] handle sending all permissions when creating public links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/handle-public-link-permissions-all.md | 5 +++++ .../owncloud/ocs/handlers/apps/sharing/shares/public.go | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 changelog/unreleased/handle-public-link-permissions-all.md diff --git a/changelog/unreleased/handle-public-link-permissions-all.md b/changelog/unreleased/handle-public-link-permissions-all.md new file mode 100644 index 0000000000..b800ba6d6d --- /dev/null +++ b/changelog/unreleased/handle-public-link-permissions-all.md @@ -0,0 +1,5 @@ +Bugfix: handle sending all permissions when creating public links + +For backwards compatability we now reduce permissions to readonly when a create public link carries all permissions. + +https://github.com/cs3org/reva/issues/2336 \ No newline at end of file diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go index 4ce44e4703..eb0598e847 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go @@ -423,6 +423,13 @@ func (h *Handler) removePublicShare(w http.ResponseWriter, r *http.Request, shar } func ocPublicPermToCs3(permKey int, h *Handler) (*provider.ResourcePermissions, error) { + + if permKey == 31 { + // apiSharePublicLink1/createPublicLinkShare.feature:109 + // Scenario Outline: Trying to create a new public link share of a file with edit permissions only grants read access using the public WebDAV API + permKey = 1 + } + // TODO refactor this ocPublicPermToRole[permKey] check into a conversions.NewPublicSharePermissions? // not all permissions are possible for public shares _, ok := ocPublicPermToRole[permKey]