Merge pull request #6216 from owncloud/bump-reva-ad3e2d1c

[full-ci] bump reva to 2118139f5420
This commit is contained in:
Michael Barz
2023-05-03 19:41:56 +02:00
committed by GitHub
11 changed files with 80 additions and 22 deletions

4
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.4.0
github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965
github.com/cs3org/reva/v2 v2.12.1-0.20230428092715-44a95fb7c7df
github.com/cs3org/reva/v2 v2.13.1-0.20230503120957-2118139f5420
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
@@ -90,6 +90,7 @@ require (
golang.org/x/image v0.6.0
golang.org/x/net v0.8.0
golang.org/x/oauth2 v0.6.0
golang.org/x/sync v0.1.0
golang.org/x/term v0.6.0
golang.org/x/text v0.9.0
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f
@@ -308,7 +309,6 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.7.0 // indirect

4
go.sum
View File

@@ -627,8 +627,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.12.1-0.20230428092715-44a95fb7c7df h1:3fcCvjkxk6RcAKMWjxzvSsLFIsgEr1REYAXBE8HGNOs=
github.com/cs3org/reva/v2 v2.12.1-0.20230428092715-44a95fb7c7df/go.mod h1:VxBmpOvIKlgKLPOsHun+fABopzX+3ZELPAp3N5bQMsM=
github.com/cs3org/reva/v2 v2.13.1-0.20230503120957-2118139f5420 h1:ovI/eQ/KPib0T5RmpEuObnisnJy/AB389vODJVDGuN8=
github.com/cs3org/reva/v2 v2.13.1-0.20230503120957-2118139f5420/go.mod h1:VxBmpOvIKlgKLPOsHun+fABopzX+3ZELPAp3N5bQMsM=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=

View File

@@ -75,9 +75,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:168](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L168)
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:169](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L169)
#### [Public cannot download folder via the public link of the folder inside the project space](https://github.com/owncloud/ocis/issues/5229)
- [apiSpacesShares/publicLinkDownload.feature:30](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature#L30)
#### [A User can get information of another user with Graph API](https://github.com/owncloud/ocis/issues/5125)
- [apiGraph/getUser.feature:83](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L83)
- [apiGraph/getUser.feature:84](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L84)

View File

@@ -251,16 +251,25 @@ func checkIfNestedResource(ctx context.Context, ref *provider.Reference, parent
// We mint a token as the owner of the public share and try to stat the reference
// TODO(ishank011): We need to find a better alternative to this
userResp, err := client.GetUser(ctx, &userpb.GetUserRequest{UserId: statResponse.Info.Owner, SkipFetchingUserGroups: true})
if err != nil || userResp.Status.Code != rpc.Code_CODE_OK {
return false, err
var user *userpb.User
if statResponse.GetInfo().GetOwner().GetType() == userpb.UserType_USER_TYPE_SPACE_OWNER {
// fake a space owner user
user = &userpb.User{
Id: statResponse.GetInfo().GetOwner(),
}
} else {
userResp, err := client.GetUser(ctx, &userpb.GetUserRequest{UserId: statResponse.Info.Owner, SkipFetchingUserGroups: true})
if err != nil || userResp.Status.Code != rpc.Code_CODE_OK {
return false, err
}
user = userResp.User
}
scope, err := scope.AddOwnerScope(map[string]*authpb.Scope{})
if err != nil {
return false, err
}
token, err := mgr.MintToken(ctx, userResp.User, scope)
token, err := mgr.MintToken(ctx, user, scope)
if err != nil {
return false, err
}

View File

@@ -728,7 +728,7 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide
span.SetAttributes(attribute.KeyValue{
Key: "reference",
Value: attribute.StringValue(req.Ref.String()),
Value: attribute.StringValue(req.GetRef().String()),
})
md, err := s.storage.GetMD(ctx, req.GetRef(), req.GetArbitraryMetadataKeys(), req.GetFieldMask().GetPaths())

View File

@@ -519,9 +519,24 @@ func (m *manager) ListPublicShares(ctx context.Context, u *user.User, filters []
key := strings.Join([]string{local.ResourceId.StorageId, local.ResourceId.OpaqueId}, "!")
if _, hit := cache[key]; !hit && !publicshare.IsCreatedByUser(local.PublicShare, u) {
sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: local.ResourceId}})
if err != nil || sRes.Status.Code != rpc.Code_CODE_OK {
if err != nil {
log.Error().
Err(err).
Interface("resource_id", local.ResourceId).
Msg("ListShares: an error occurred during stat on the resource")
continue
}
if sRes.Status.Code != rpc.Code_CODE_OK {
if sRes.Status.Code == rpc.Code_CODE_NOT_FOUND {
log.Debug().
Str("message", sRes.Status.Message).
Interface("status", sRes.Status).
Interface("resource_id", local.ResourceId).
Msg("ListShares: Resource not found")
continue
}
log.Error().
Str("message", sRes.Status.Message).
Interface("status", sRes.Status).
Interface("resource_id", local.ResourceId).
Msg("ListShares: could not stat resource")

View File

@@ -438,11 +438,18 @@ func (fs *Decomposedfs) GetQuota(ctx context.Context, ref *provider.Reference) (
quotaStr = string(ri.Opaque.Map["quota"].Value)
}
// FIXME this reads remaining disk size from the local disk, not the blobstore
remaining, err = node.GetAvailableSize(n.InternalPath())
if err != nil {
return 0, 0, 0, err
}
return fs.calculateTotalUsedRemaining(quotaStr, ri.Size, remaining)
}
func (fs *Decomposedfs) calculateTotalUsedRemaining(quotaStr string, inUse, remaining uint64) (uint64, uint64, uint64, error) {
var err error
var total uint64
switch quotaStr {
case node.QuotaUncalculated, node.QuotaUnknown:
// best we can do is return current total
@@ -457,15 +464,14 @@ func (fs *Decomposedfs) GetQuota(ctx context.Context, ref *provider.Reference) (
if total <= remaining {
// Prevent overflowing
if ri.Size >= total {
if inUse >= total {
remaining = 0
} else {
remaining = total - ri.Size
remaining = total - inUse
}
}
}
return total, ri.Size, remaining, nil
return total, inUse, remaining, nil
}
// CreateHome creates a new home node for the given user
@@ -553,6 +559,9 @@ func (fs *Decomposedfs) CreateDir(ctx context.Context, ref *provider.Reference)
// verify parent exists
var n *node.Node
if n, err = fs.lu.NodeFromResource(ctx, parentRef); err != nil {
if e, ok := err.(errtypes.NotFound); ok {
return errtypes.PreconditionFailed(e.Error())
}
return
}
// TODO check if user has access to root / space

View File

@@ -146,7 +146,7 @@ func (p *Permissions) AssemblePermissions(ctx context.Context, n *Node) (ap prov
// continue with next segment
}
if cn, err = cn.Parent(); err != nil {
return ap, errors.Wrap(err, "Decomposedfs: error getting parent "+cn.ParentID)
return ap, errors.Wrap(err, "Decomposedfs: error getting parent for node "+cn.ID)
}
}

View File

@@ -25,6 +25,7 @@ import (
"math"
"os"
"path/filepath"
"strconv"
"strings"
"time"
@@ -38,6 +39,7 @@ import (
"github.com/cs3org/reva/v2/pkg/errtypes"
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
sdk "github.com/cs3org/reva/v2/pkg/sdk/common"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
@@ -988,6 +990,7 @@ func (fs *Decomposedfs) storageSpaceFromNode(ctx context.Context, n *node.Node,
QuotaMaxBytes: uint64(q),
QuotaMaxFiles: math.MaxUint64, // TODO MaxUInt64? = unlimited? why even max files? 0 = unlimited?
}
}
if si := spaceAttributes.String(prefixes.SpaceImageAttr); si != "" {
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "image", storagespace.FormatResourceID(
@@ -1008,7 +1011,28 @@ func (fs *Decomposedfs) storageSpaceFromNode(ctx context.Context, n *node.Node,
// add rootinfo
ps, _ := n.SpaceRoot.PermissionSet(ctx)
space.RootInfo, _ = n.SpaceRoot.AsResourceInfo(ctx, &ps, nil, nil, false)
space.RootInfo, _ = n.SpaceRoot.AsResourceInfo(ctx, &ps, []string{"quota"}, nil, false)
// we cannot put free, used and remaining into the quota, as quota, when set would always imply a quota limit
// for now we use opaque properties with a 'quota.' prefix
quotaStr := node.QuotaUnknown
if quotaInOpaque := sdk.DecodeOpaqueMap(space.RootInfo.Opaque)["quota"]; quotaInOpaque != "" {
quotaStr = quotaInOpaque
}
// FIXME this reads remaining disk size from the local disk, not the blobstore
remaining, err := node.GetAvailableSize(n.InternalPath())
if err != nil {
return nil, err
}
total, used, remaining, err := fs.calculateTotalUsedRemaining(quotaStr, space.GetRootInfo().GetSize(), remaining)
if err != nil {
return nil, err
}
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.total", strconv.FormatUint(total, 10))
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.used", strconv.FormatUint(used, 10))
space.Opaque = utils.AppendPlainToOpaque(space.Opaque, "quota.remaining", strconv.FormatUint(remaining, 10))
return space, nil
}

View File

@@ -165,10 +165,14 @@ func (fs *Decomposedfs) InitiateUpload(ctx context.Context, ref *provider.Refere
if metadata != nil {
info.MetaData["providerID"] = metadata["providerID"]
if mtime, ok := metadata["mtime"]; ok {
info.MetaData["mtime"] = mtime
if mtime != "null" {
info.MetaData["mtime"] = mtime
}
}
if expiration, ok := metadata["expires"]; ok {
info.MetaData["expires"] = expiration
if expiration != "null" {
info.MetaData["expires"] = expiration
}
}
if _, ok := metadata["sizedeferred"]; ok {
info.SizeIsDeferred = true

2
vendor/modules.txt vendored
View File

@@ -349,7 +349,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.12.1-0.20230428092715-44a95fb7c7df
# github.com/cs3org/reva/v2 v2.13.1-0.20230503120957-2118139f5420
## explicit; go 1.19
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime