Skip to content

Commit

Permalink
Expose secureview as 'X' in dav permissions
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 committed May 22, 2024
1 parent 8fb71ad commit 3ba2052
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/dav-expose-secureview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Expose SecureView in WebDAV permissions

When a file or folder can be securelyviewed we now add an `X` to the permissions.

https://github.com/cs3org/reva/pull/4694
8 changes: 8 additions & 0 deletions pkg/conversions/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (r *Role) OCSPermissions() Permissions {
// M = Mounted
// Z = Deniable (NEW)
// P = Purge from trashbin
// X = SecureViewable
func (r *Role) WebDAVPermissions(isDir, isShared, isMountpoint, isPublic bool) string {
var b strings.Builder
if !isPublic && isShared {
Expand Down Expand Up @@ -141,6 +142,10 @@ func (r *Role) WebDAVPermissions(isDir, isShared, isMountpoint, isPublic bool) s
fmt.Fprintf(&b, "P")
}

if r.Name == RoleSecureViewer {
fmt.Fprintf(&b, "X")
}

return b.String()
}

Expand Down Expand Up @@ -541,6 +546,9 @@ func RoleFromResourcePermissions(rp *provider.ResourcePermissions, islink bool)
r.Name = RoleViewer
return r
}
} else if rp.Stat && rp.GetPath && rp.ListContainer && !rp.InitiateFileUpload && !rp.Delete && !rp.AddGrant {
r.Name = RoleSecureViewer
return r
}
if r.ocsPermissions == PermissionCreate {
if rp.GetPath && rp.InitiateFileDownload && rp.ListContainer && rp.Move {
Expand Down

0 comments on commit 3ba2052

Please sign in to comment.