From e7bee4a1ea95bd03d18db1463f59ec1ac86dd46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 7 Dec 2021 11:46:20 +0000 Subject: [PATCH] remove 2 expected failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .../handle-public-link-permissions-all.md | 3 ++- .../ocs/handlers/apps/sharing/shares/public.go | 14 +++++++++----- .../expected-failures-on-OCIS-storage.md | 5 ----- .../expected-failures-on-S3NG-storage.md | 5 ----- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/changelog/unreleased/handle-public-link-permissions-all.md b/changelog/unreleased/handle-public-link-permissions-all.md index b800ba6d6d..5b36bfb13b 100644 --- a/changelog/unreleased/handle-public-link-permissions-all.md +++ b/changelog/unreleased/handle-public-link-permissions-all.md @@ -2,4 +2,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 +https://github.com/cs3org/reva/issues/2336 +https://github.com/owncloud/ocis/issues/1269 \ 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 eb0598e847..4c8e73396f 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 @@ -422,13 +422,17 @@ func (h *Handler) removePublicShare(w http.ResponseWriter, r *http.Request, shar response.WriteOCSSuccess(w, r, nil) } +// for public links oc10 api decreases all permissions to read: stay compatible! +func decreasePermissionsIfNecessary(perm int) int { + if perm == int(conversions.PermissionAll) { + perm = int(conversions.PermissionRead) + } + return perm +} + 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 - } + permKey = decreasePermissionsIfNecessary(permKey) // TODO refactor this ocPublicPermToRole[permKey] check into a conversions.NewPublicSharePermissions? // not all permissions are possible for public shares diff --git a/tests/acceptance/expected-failures-on-OCIS-storage.md b/tests/acceptance/expected-failures-on-OCIS-storage.md index 151ef824e4..a92c9b75bc 100644 --- a/tests/acceptance/expected-failures-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-on-OCIS-storage.md @@ -382,11 +382,6 @@ The first two tests work against ocis. There must be something wrong in the CI s - [apiSharePublicLink1/changingPublicLinkShare.feature:51](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/changingPublicLinkShare.feature#L51) - [apiSharePublicLink1/changingPublicLinkShare.feature:90](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/changingPublicLinkShare.feature#L90) -#### [Public link enforce permissions](https://github.com/owncloud/ocis/issues/1269) - -- [apiSharePublicLink1/createPublicLinkShare.feature:141](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature#L141) -- [apiSharePublicLink1/createPublicLinkShare.feature:142](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature#L142) - #### [various sharing settings cannot be set](https://github.com/owncloud/ocis/issues/1328) - [apiSharePublicLink1/createPublicLinkShare.feature:319](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature#L319) diff --git a/tests/acceptance/expected-failures-on-S3NG-storage.md b/tests/acceptance/expected-failures-on-S3NG-storage.md index b900e4f1b6..703c1ed5ce 100644 --- a/tests/acceptance/expected-failures-on-S3NG-storage.md +++ b/tests/acceptance/expected-failures-on-S3NG-storage.md @@ -392,11 +392,6 @@ File and sync features in a shared scenario - [apiSharePublicLink1/changingPublicLinkShare.feature:51](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/changingPublicLinkShare.feature#L51) - [apiSharePublicLink1/changingPublicLinkShare.feature:90](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/changingPublicLinkShare.feature#L90) -#### [Public link enforce permissions](https://github.com/owncloud/ocis/issues/1269) - -- [apiSharePublicLink1/createPublicLinkShare.feature:141](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature#L141) -- [apiSharePublicLink1/createPublicLinkShare.feature:142](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature#L142) - #### [various sharing settings cannot be set](https://github.com/owncloud/ocis/issues/1328) - [apiSharePublicLink1/createPublicLinkShare.feature:319](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature#L319)