From 6ac8212e9930461363c35c2330fcaf09f4d44300 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Thu, 14 Apr 2022 13:13:34 +0200 Subject: [PATCH] fix webdav permissions for single file public shares --- changelog/unreleased/single-file-edit.md | 5 +++++ internal/http/services/owncloud/ocs/conversions/role.go | 5 ++++- internal/http/services/owncloud/ocs/data/capabilities.go | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/single-file-edit.md diff --git a/changelog/unreleased/single-file-edit.md b/changelog/unreleased/single-file-edit.md new file mode 100644 index 0000000000..7f9a4dca17 --- /dev/null +++ b/changelog/unreleased/single-file-edit.md @@ -0,0 +1,5 @@ +Enhancement: Add capability for public link single file edit + +It is now possible to share a single file by link with edit permissions. Therefore we need a public share capability to enable that feature in the clients. At the same time we improved the WebDAV permissions for public links. + +https://github.com/cs3org/reva/pull/2743 diff --git a/internal/http/services/owncloud/ocs/conversions/role.go b/internal/http/services/owncloud/ocs/conversions/role.go index e7a97b4ddd..3741c4f6c6 100644 --- a/internal/http/services/owncloud/ocs/conversions/role.go +++ b/internal/http/services/owncloud/ocs/conversions/role.go @@ -105,7 +105,10 @@ func (r *Role) WebDAVPermissions(isDir, isShared, isMountpoint, isPublic bool) s fmt.Fprintf(&b, "D") // TODO oc10 shows received shares as deletable } if r.ocsPermissions.Contain(PermissionWrite) { - fmt.Fprintf(&b, "NV") + // Single file public link shares cannot be renamed + if !isPublic || (isPublic && r.cS3ResourcePermissions != nil && r.cS3ResourcePermissions.Move) { + fmt.Fprintf(&b, "NV") + } if !isDir { fmt.Fprintf(&b, "W") } diff --git a/internal/http/services/owncloud/ocs/data/capabilities.go b/internal/http/services/owncloud/ocs/data/capabilities.go index 134f5720d8..f619adb215 100644 --- a/internal/http/services/owncloud/ocs/data/capabilities.go +++ b/internal/http/services/owncloud/ocs/data/capabilities.go @@ -168,6 +168,7 @@ type CapabilitiesFilesSharingPublic struct { SupportsUploadOnly ocsBool `json:"supports_upload_only" xml:"supports_upload_only" mapstructure:"supports_upload_only"` Password *CapabilitiesFilesSharingPublicPassword `json:"password" xml:"password"` ExpireDate *CapabilitiesFilesSharingPublicExpireDate `json:"expire_date" xml:"expire_date" mapstructure:"expire_date"` + CanEdit ocsBool `json:"can_edit" xml:"can_edit" mapstructure:"can_edit"` } // CapabilitiesFilesSharingPublicPassword TODO document