Skip to content

Commit

Permalink
Fix public link webdav permissions (#1461)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored Feb 8, 2021
1 parent 201ba2b commit 990ed1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-public-link-permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix public link webdav permissions

We now correctly render `oc:permissions` on the root collection of a publicly shared folder when it has more than read permissions.

https://github.com/cs3org/reva/pull/1461
15 changes: 4 additions & 11 deletions internal/http/services/owncloud/ocdav/propfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,13 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide

isShared := !isCurrentUserOwner(ctx, md.Owner)
var wdp string
switch {
case ls != nil:
// link share only appears on root collection
wdp = ""
case md.PermissionSet != nil:
isPublic := ls != nil
if md.PermissionSet != nil {
wdp = role.WebDAVPermissions(
md.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER,
isShared,
false,
false,
isPublic,
)
sublog.Debug().Interface("role", role).Str("dav-permissions", wdp).Msg("converted PermissionSet")
}
Expand Down Expand Up @@ -490,11 +487,7 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide
// R = Shareable (Reshare)
// M = Mounted
// in contrast, the ocs:share-permissions further down below indicate clients the maximum permissions that can be granted
if md.PermissionSet != nil {
propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:permissions", wdp))
} else {
propstatNotFound.Prop = append(propstatNotFound.Prop, s.newProp("oc:permissions", ""))
}
propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:permissions", wdp))
case "public-link-permission": // only on a share root node
if ls != nil && md.PermissionSet != nil {
propstatOK.Prop = append(
Expand Down

0 comments on commit 990ed1b

Please sign in to comment.