bump reva

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-08-29 10:56:46 +02:00
parent 6002d500e2
commit ba7a5a4826
8 changed files with 76 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
Enhancement: Bump Reva
bumps reva version
https://github.com/owncloud/ocis/pull/7138

2
go.mod
View File

@@ -13,7 +13,7 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.6.0
github.com/cs3org/go-cs3apis v0.0.0-20230516150832-730ac860c71d
github.com/cs3org/reva/v2 v2.16.0
github.com/cs3org/reva/v2 v2.16.1-0.20230828111521-594d4e103741
github.com/disintegration/imaging v1.6.2
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1

4
go.sum
View File

@@ -858,8 +858,8 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo
github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4=
github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc=
github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA=
github.com/cs3org/reva/v2 v2.16.0 h1:XBFoGhzKrcDqqRvYdicOpDOpQVIsRqALmEt8X0N+wm0=
github.com/cs3org/reva/v2 v2.16.0/go.mod h1:RvhuweTFqzezjUFU0SIdTXakrEx9vJlMvQ7znPXSP1g=
github.com/cs3org/reva/v2 v2.16.1-0.20230828111521-594d4e103741 h1:y3Tw/ZVGPSDRiCslFUESomgSUOa3SAguOJKpiSk9pls=
github.com/cs3org/reva/v2 v2.16.1-0.20230828111521-594d4e103741/go.mod h1:RvhuweTFqzezjUFU0SIdTXakrEx9vJlMvQ7znPXSP1g=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

View File

@@ -1059,7 +1059,7 @@ func (s *service) resolveAcceptedShare(ctx context.Context, ref *provider.Refere
if receivedShare.State != collaboration.ShareState_SHARE_STATE_ACCEPTED {
continue
}
if strings.HasPrefix(strings.TrimPrefix(ref.Path, "./"), receivedShare.MountPoint.Path) {
if isMountPointForPath(receivedShare.MountPoint.Path, ref.Path) {
return receivedShare, lsRes.Status, nil
}
}
@@ -1069,6 +1069,17 @@ func (s *service) resolveAcceptedShare(ctx context.Context, ref *provider.Refere
return nil, status.NewNotFound(ctx, "sharesstorageprovider: not found "+ref.String()), nil
}
func isMountPointForPath(mountpoint, path string) bool {
requiredSegments := strings.Split(strings.TrimPrefix(mountpoint, "./"), "/")
pathSegments := strings.Split(strings.TrimPrefix(path, "./"), "/")
for i := range requiredSegments {
if pathSegments[i] != requiredSegments[i] {
return false
}
}
return true
}
func (s *service) rejectReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare) error {
receivedShare.State = collaboration.ShareState_SHARE_STATE_REJECTED
receivedShare.MountPoint = nil

View File

@@ -42,6 +42,7 @@ import (
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/google/uuid"
"go.opentelemetry.io/otel/attribute"
)
@@ -190,11 +191,19 @@ func (cls *cs3LS) Create(ctx context.Context, now time.Time, details LockDetails
// see: http://www.webdav.org/specs/rfc2518.html#n-lock-tokens
token := uuid.New()
u := ctxpkg.ContextMustGetUser(ctx)
// add metadata via opaque
// TODO: upate cs3api: https://github.com/cs3org/cs3apis/issues/213
o := utils.AppendPlainToOpaque(nil, "lockownername", u.GetDisplayName())
o = utils.AppendPlainToOpaque(o, "locktime", now.Format(time.RFC3339))
r := &provider.SetLockRequest{
Ref: details.Root,
Lock: &provider.Lock{
Type: provider.LockType_LOCK_TYPE_EXCL,
User: details.UserID, // no way to set an app lock? TODO maybe via the ownerxml
Opaque: o,
Type: provider.LockType_LOCK_TYPE_EXCL,
User: details.UserID, // no way to set an app lock? TODO maybe via the ownerxml
//AppName: , // TODO use a urn scheme?
LockId: lockTokenPrefix + token.String(), // can be a token or a Coded-URL
},
@@ -278,6 +287,10 @@ type LockDetails struct {
// ZeroDepth is whether the lock has zero depth. If it does not have zero
// depth, it has infinite depth.
ZeroDepth bool
// OwnerName is the name of the lock owner
OwnerName string
// Locktime is the time the lock was created
Locktime time.Time
}
func readLockInfo(r io.Reader) (li lockInfo, status int, err error) {
@@ -440,7 +453,8 @@ func (s *svc) lockReference(ctx context.Context, w http.ResponseWriter, r *http.
}
u := ctxpkg.ContextMustGetUser(ctx)
token, ld, now, created := "", LockDetails{UserID: u.Id, Root: ref, Duration: duration}, time.Now(), false
token, now, created := "", time.Now(), false
ld := LockDetails{UserID: u.Id, Root: ref, Duration: duration, OwnerName: u.GetDisplayName(), Locktime: now}
if li == (lockInfo{}) {
// An empty lockInfo means to refresh the lock.
ih, ok := parseIfHeader(r.Header.Get(net.HeaderIf))
@@ -547,7 +561,7 @@ func writeLockInfo(w io.Writer, token string, ld LockDetails) (int, error) {
lockdiscovery := strings.Builder{}
lockdiscovery.WriteString(xml.Header)
lockdiscovery.WriteString("<d:prop xmlns:d=\"DAV:\"><d:lockdiscovery><d:activelock>\n")
lockdiscovery.WriteString("<d:prop xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\"><d:lockdiscovery><d:activelock>\n")
lockdiscovery.WriteString(" <d:locktype><d:write/></d:locktype>\n")
lockdiscovery.WriteString(" <d:lockscope><d:exclusive/></d:lockscope>\n")
lockdiscovery.WriteString(fmt.Sprintf(" <d:depth>%s</d:depth>\n", depth))
@@ -566,6 +580,13 @@ func writeLockInfo(w io.Writer, token string, ld LockDetails) (int, error) {
if href != "" {
lockdiscovery.WriteString(fmt.Sprintf(" <d:lockroot><d:href>%s</d:href></d:lockroot>\n", prop.Escape(href)))
}
if ld.OwnerName != "" {
lockdiscovery.WriteString(fmt.Sprintf(" <oc:ownername>%s</oc:ownername>\n", prop.Escape(ld.OwnerName)))
}
if !ld.Locktime.IsZero() {
lockdiscovery.WriteString(fmt.Sprintf(" <oc:locktime>%s</oc:locktime>\n", prop.Escape(ld.Locktime.Format(time.RFC3339))))
}
lockdiscovery.WriteString("</d:activelock></d:lockdiscovery></d:prop>")
return fmt.Fprint(w, lockdiscovery.String())

View File

@@ -1635,6 +1635,17 @@ func activeLocks(log *zerolog.Logger, lock *provider.Lock) string {
}
activelocks.WriteString("</d:owner>")
}
if un := utils.ReadPlainFromOpaque(lock.Opaque, "lockownername"); un != "" {
activelocks.WriteString("<oc:ownername>")
activelocks.WriteString(un)
activelocks.WriteString("</oc:ownername>")
}
if lt := utils.ReadPlainFromOpaque(lock.Opaque, "locktime"); lt != "" {
activelocks.WriteString("<oc:locktime>")
activelocks.WriteString(lt)
activelocks.WriteString("</oc:locktime>")
}
activelocks.WriteString("<d:timeout>")
activelocks.WriteString(expiration)
activelocks.WriteString("</d:timeout>")

19
vendor/github.com/cs3org/reva/v2/pkg/events/sse.go generated vendored Normal file
View File

@@ -0,0 +1,19 @@
package events
import (
"encoding/json"
)
// SendSEE instructs the sse service to send a notification to a user
type SendSSE struct {
UserID string
Type string
Message []byte
}
// Unmarshal to fulfill umarshaller interface
func (SendSSE) Unmarshal(v []byte) (interface{}, error) {
e := SendSSE{}
err := json.Unmarshal(v, &e)
return e, err
}

2
vendor/modules.txt vendored
View File

@@ -354,7 +354,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.16.0
# github.com/cs3org/reva/v2 v2.16.1-0.20230828111521-594d4e103741
## explicit; go 1.20
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime