mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-03 02:39:52 -06:00
2
go.mod
2
go.mod
@@ -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.1-0.20230831084113-cb0897d2eefe
|
||||
github.com/cs3org/reva/v2 v2.16.1-0.20230904124812-2ebd3e92cdb9
|
||||
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
4
go.sum
@@ -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.1-0.20230831084113-cb0897d2eefe h1:kCM/ZPcbG0wWDgOFrvHV/KP6d1l1PVbcPje9QfQUVAU=
|
||||
github.com/cs3org/reva/v2 v2.16.1-0.20230831084113-cb0897d2eefe/go.mod h1:RvhuweTFqzezjUFU0SIdTXakrEx9vJlMvQ7znPXSP1g=
|
||||
github.com/cs3org/reva/v2 v2.16.1-0.20230904124812-2ebd3e92cdb9 h1:YWkkoagYryRH56z5pw04Py0Ebg7spCZaWpsxjwGiNgU=
|
||||
github.com/cs3org/reva/v2 v2.16.1-0.20230904124812-2ebd3e92cdb9/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=
|
||||
|
||||
@@ -301,7 +301,9 @@ func (s *service) UpdateReceivedShare(ctx context.Context, req *collaboration.Up
|
||||
}, nil
|
||||
}
|
||||
|
||||
share, err := s.sm.UpdateReceivedShare(ctx, req.Share, req.UpdateMask)
|
||||
var uid userpb.UserId
|
||||
_ = utils.ReadJSONFromOpaque(req.Opaque, "userid", &uid)
|
||||
share, err := s.sm.UpdateReceivedShare(ctx, req.Share, req.UpdateMask, &uid)
|
||||
if err != nil {
|
||||
return &collaboration.UpdateReceivedShareResponse{
|
||||
Status: status.NewInternal(ctx, "error updating received share"),
|
||||
|
||||
3
vendor/github.com/cs3org/reva/v2/pkg/cbox/share/sql/sql.go
generated
vendored
3
vendor/github.com/cs3org/reva/v2/pkg/cbox/share/sql/sql.go
generated
vendored
@@ -27,6 +27,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
@@ -453,7 +454,7 @@ func (m *mgr) GetReceivedShare(ctx context.Context, ref *collaboration.ShareRefe
|
||||
|
||||
}
|
||||
|
||||
func (m *mgr) UpdateReceivedShare(ctx context.Context, share *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error) {
|
||||
func (m *mgr) UpdateReceivedShare(ctx context.Context, share *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, _ *userpb.UserId) (*collaboration.ReceivedShare, error) {
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
|
||||
rs, err := m.GetReceivedShare(ctx, &collaboration.ShareReference{Spec: &collaboration.ShareReference_Id{Id: share.Share.Id}})
|
||||
|
||||
11
vendor/github.com/cs3org/reva/v2/pkg/share/manager/cs3/cs3.go
generated
vendored
11
vendor/github.com/cs3org/reva/v2/pkg/share/manager/cs3/cs3.go
generated
vendored
@@ -343,7 +343,7 @@ func (m *Manager) GetShare(ctx context.Context, ref *collaboration.ShareReferenc
|
||||
|
||||
// check if we are the owner or the grantee
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
if share.IsCreatedByUser(s, user) || share.IsGrantedToUser(s, user) {
|
||||
if user.GetId().GetType() == userpb.UserType_USER_TYPE_SERVICE || share.IsCreatedByUser(s, user) || share.IsGrantedToUser(s, user) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ func (m *Manager) GetReceivedShare(ctx context.Context, ref *collaboration.Share
|
||||
}
|
||||
|
||||
// UpdateReceivedShare updates the received share with share state.
|
||||
func (m *Manager) UpdateReceivedShare(ctx context.Context, rshare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error) {
|
||||
func (m *Manager) UpdateReceivedShare(ctx context.Context, rshare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, forUser *userpb.UserId) (*collaboration.ReceivedShare, error) {
|
||||
if err := m.initialize(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -643,7 +643,12 @@ func (m *Manager) UpdateReceivedShare(ctx context.Context, rshare *collaboration
|
||||
}
|
||||
}
|
||||
|
||||
err = m.persistReceivedShare(ctx, user.Id, rs)
|
||||
uid := user.GetId()
|
||||
if user.GetId().GetType() == userpb.UserType_USER_TYPE_SERVICE {
|
||||
uid = forUser
|
||||
}
|
||||
|
||||
err = m.persistReceivedShare(ctx, uid, rs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
22
vendor/github.com/cs3org/reva/v2/pkg/share/manager/json/json.go
generated
vendored
22
vendor/github.com/cs3org/reva/v2/pkg/share/manager/json/json.go
generated
vendored
@@ -542,13 +542,13 @@ func (m *mgr) getReceived(ctx context.Context, ref *collaboration.ShareReference
|
||||
return nil, err
|
||||
}
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
if !share.IsGrantedToUser(s, user) {
|
||||
if user.GetId().GetType() != userv1beta1.UserType_USER_TYPE_SERVICE && !share.IsGrantedToUser(s, user) {
|
||||
return nil, errtypes.NotFound(ref.String())
|
||||
}
|
||||
return m.convert(user.Id, s), nil
|
||||
}
|
||||
|
||||
func (m *mgr) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error) {
|
||||
func (m *mgr) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, forUser *userv1beta1.UserId) (*collaboration.ReceivedShare, error) {
|
||||
rs, err := m.getReceived(ctx, &collaboration.ShareReference{Spec: &collaboration.ShareReference_Id{Id: receivedShare.Share.Id}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -568,27 +568,31 @@ func (m *mgr) UpdateReceivedShare(ctx context.Context, receivedShare *collaborat
|
||||
}
|
||||
}
|
||||
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
u := ctxpkg.ContextMustGetUser(ctx)
|
||||
uid := u.GetId().String()
|
||||
if u.GetId().GetType() == userv1beta1.UserType_USER_TYPE_SERVICE {
|
||||
uid = forUser.String()
|
||||
}
|
||||
// Persist state
|
||||
if v, ok := m.model.State[user.Id.String()]; ok {
|
||||
if v, ok := m.model.State[uid]; ok {
|
||||
v[rs.Share.Id.String()] = rs.State
|
||||
m.model.State[user.Id.String()] = v
|
||||
m.model.State[uid] = v
|
||||
} else {
|
||||
a := map[string]collaboration.ShareState{
|
||||
rs.Share.Id.String(): rs.State,
|
||||
}
|
||||
m.model.State[user.Id.String()] = a
|
||||
m.model.State[uid] = a
|
||||
}
|
||||
|
||||
// Persist mount point
|
||||
if v, ok := m.model.MountPoint[user.Id.String()]; ok {
|
||||
if v, ok := m.model.MountPoint[uid]; ok {
|
||||
v[rs.Share.Id.String()] = rs.MountPoint
|
||||
m.model.MountPoint[user.Id.String()] = v
|
||||
m.model.MountPoint[uid] = v
|
||||
} else {
|
||||
a := map[string]*provider.Reference{
|
||||
rs.Share.Id.String(): rs.MountPoint,
|
||||
}
|
||||
m.model.MountPoint[user.Id.String()] = a
|
||||
m.model.MountPoint[uid] = a
|
||||
}
|
||||
|
||||
if err := m.model.Save(); err != nil {
|
||||
|
||||
13
vendor/github.com/cs3org/reva/v2/pkg/share/manager/jsoncs3/jsoncs3.go
generated
vendored
13
vendor/github.com/cs3org/reva/v2/pkg/share/manager/jsoncs3/jsoncs3.go
generated
vendored
@@ -955,7 +955,7 @@ func (m *Manager) getReceived(ctx context.Context, ref *collaboration.ShareRefer
|
||||
return nil, err
|
||||
}
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
if !share.IsGrantedToUser(s, user) {
|
||||
if user.GetId().GetType() != userv1beta1.UserType_USER_TYPE_SERVICE && !share.IsGrantedToUser(s, user) {
|
||||
return nil, errtypes.NotFound(ref.String())
|
||||
}
|
||||
if share.IsExpired(s) {
|
||||
@@ -978,7 +978,7 @@ func (m *Manager) getReceived(ctx context.Context, ref *collaboration.ShareRefer
|
||||
}
|
||||
|
||||
// UpdateReceivedShare updates the received share with share state.
|
||||
func (m *Manager) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error) {
|
||||
func (m *Manager) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, forUser *userv1beta1.UserId) (*collaboration.ReceivedShare, error) {
|
||||
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "UpdateReceivedShare")
|
||||
defer span.End()
|
||||
|
||||
@@ -1003,10 +1003,13 @@ func (m *Manager) UpdateReceivedShare(ctx context.Context, receivedShare *collab
|
||||
}
|
||||
|
||||
// write back
|
||||
u := ctxpkg.ContextMustGetUser(ctx)
|
||||
uid := u.GetId().GetOpaqueId()
|
||||
if u.GetId().GetType() == userv1beta1.UserType_USER_TYPE_SERVICE {
|
||||
uid = forUser.GetOpaqueId()
|
||||
}
|
||||
|
||||
userID := ctxpkg.ContextMustGetUser(ctx)
|
||||
|
||||
err = m.UserReceivedStates.Add(ctx, userID.GetId().GetOpaqueId(), rs.Share.ResourceId.StorageId+shareid.IDDelimiter+rs.Share.ResourceId.SpaceId, rs)
|
||||
err = m.UserReceivedStates.Add(ctx, uid, rs.Share.ResourceId.StorageId+shareid.IDDelimiter+rs.Share.ResourceId.SpaceId, rs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
24
vendor/github.com/cs3org/reva/v2/pkg/share/manager/memory/memory.go
generated
vendored
24
vendor/github.com/cs3org/reva/v2/pkg/share/manager/memory/memory.go
generated
vendored
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/cs3org/reva/v2/pkg/share"
|
||||
"google.golang.org/genproto/protobuf/field_mask"
|
||||
|
||||
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
@@ -334,7 +335,7 @@ func (m *manager) getReceived(ctx context.Context, ref *collaboration.ShareRefer
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
for _, s := range m.shares {
|
||||
if sharesEqual(ref, s) {
|
||||
if share.IsGrantedToUser(s, user) {
|
||||
if user.GetId().GetType() == userv1beta1.UserType_USER_TYPE_SERVICE || share.IsGrantedToUser(s, user) {
|
||||
rs := m.convert(ctx, s)
|
||||
return rs, nil
|
||||
}
|
||||
@@ -343,13 +344,12 @@ func (m *manager) getReceived(ctx context.Context, ref *collaboration.ShareRefer
|
||||
return nil, errtypes.NotFound(ref.String())
|
||||
}
|
||||
|
||||
func (m *manager) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error) {
|
||||
func (m *manager) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, forUser *userv1beta1.UserId) (*collaboration.ReceivedShare, error) {
|
||||
rs, err := m.getReceived(ctx, &collaboration.ShareReference{Spec: &collaboration.ShareReference_Id{Id: receivedShare.Share.Id}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
user := ctxpkg.ContextMustGetUser(ctx)
|
||||
m.lock.Lock()
|
||||
defer m.lock.Unlock()
|
||||
|
||||
@@ -364,25 +364,31 @@ func (m *manager) UpdateReceivedShare(ctx context.Context, receivedShare *collab
|
||||
}
|
||||
}
|
||||
|
||||
u := ctxpkg.ContextMustGetUser(ctx)
|
||||
uid := u.GetId().String()
|
||||
if u.GetId().GetType() == userv1beta1.UserType_USER_TYPE_SERVICE {
|
||||
uid = forUser.String()
|
||||
}
|
||||
|
||||
// Persist state
|
||||
if v, ok := m.shareState[user.Id.String()]; ok {
|
||||
if v, ok := m.shareState[uid]; ok {
|
||||
v[rs.Share.Id] = rs.State
|
||||
m.shareState[user.Id.String()] = v
|
||||
m.shareState[uid] = v
|
||||
} else {
|
||||
a := map[*collaboration.ShareId]collaboration.ShareState{
|
||||
rs.Share.Id: rs.State,
|
||||
}
|
||||
m.shareState[user.Id.String()] = a
|
||||
m.shareState[uid] = a
|
||||
}
|
||||
// Persist mount point
|
||||
if v, ok := m.shareMountPoint[user.Id.String()]; ok {
|
||||
if v, ok := m.shareMountPoint[uid]; ok {
|
||||
v[rs.Share.Id] = rs.MountPoint
|
||||
m.shareMountPoint[user.Id.String()] = v
|
||||
m.shareMountPoint[uid] = v
|
||||
} else {
|
||||
a := map[*collaboration.ShareId]*provider.Reference{
|
||||
rs.Share.Id: rs.MountPoint,
|
||||
}
|
||||
m.shareMountPoint[user.Id.String()] = a
|
||||
m.shareMountPoint[uid] = a
|
||||
}
|
||||
|
||||
return rs, nil
|
||||
|
||||
4
vendor/github.com/cs3org/reva/v2/pkg/share/manager/owncloudsql/owncloudsql.go
generated
vendored
4
vendor/github.com/cs3org/reva/v2/pkg/share/manager/owncloudsql/owncloudsql.go
generated
vendored
@@ -27,6 +27,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
@@ -422,7 +423,8 @@ func (m *mgr) GetReceivedShare(ctx context.Context, ref *collaboration.ShareRefe
|
||||
|
||||
}
|
||||
|
||||
func (m *mgr) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error) {
|
||||
func (m *mgr) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, _ *userpb.UserId) (*collaboration.ReceivedShare, error) {
|
||||
// TODO: How to inject the uid when a UserId is set? override it in the ctx? Add parameter to GetReceivedShare?
|
||||
rs, err := m.GetReceivedShare(ctx, &collaboration.ShareReference{Spec: &collaboration.ShareReference_Id{Id: receivedShare.Share.Id}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
2
vendor/github.com/cs3org/reva/v2/pkg/share/share.go
generated
vendored
2
vendor/github.com/cs3org/reva/v2/pkg/share/share.go
generated
vendored
@@ -69,7 +69,7 @@ type Manager interface {
|
||||
GetReceivedShare(ctx context.Context, ref *collaboration.ShareReference) (*collaboration.ReceivedShare, error)
|
||||
|
||||
// UpdateReceivedShare updates the received share with share state.
|
||||
UpdateReceivedShare(ctx context.Context, share *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error)
|
||||
UpdateReceivedShare(ctx context.Context, share *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, forUser *userv1beta1.UserId) (*collaboration.ReceivedShare, error)
|
||||
}
|
||||
|
||||
// ReceivedShareWithUser holds the relevant information for representing a received share of a user
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -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.1-0.20230831084113-cb0897d2eefe
|
||||
# github.com/cs3org/reva/v2 v2.16.1-0.20230904124812-2ebd3e92cdb9
|
||||
## explicit; go 1.20
|
||||
github.com/cs3org/reva/v2/cmd/revad/internal/grace
|
||||
github.com/cs3org/reva/v2/cmd/revad/runtime
|
||||
|
||||
Reference in New Issue
Block a user