Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix public link webdav permissions #1461

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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