From f57f7d16a00ea58c21efa693cd5d967b80ca3c1c Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Tue, 8 Oct 2024 18:57:46 +0200 Subject: [PATCH] Kept historical resource naming after renaming in activity for shares and public links. --- changelog/unreleased/fix-activity-rename.md | 6 ++ go.mod | 4 + go.sum | 4 +- services/activitylog/pkg/service/http.go | 25 ++++-- .../apiActivities/shareActivities.feature | 78 ++----------------- .../eventsmiddleware/conversion.go | 16 ++-- .../publicshareprovider.go | 22 +++--- .../usershareprovider/usershareprovider.go | 3 + .../http/services/owncloud/ocdav/trashbin.go | 36 +++++---- .../cs3org/reva/v2/pkg/events/sharing.go | 21 +++-- vendor/modules.txt | 3 +- 11 files changed, 102 insertions(+), 116 deletions(-) create mode 100644 changelog/unreleased/fix-activity-rename.md diff --git a/changelog/unreleased/fix-activity-rename.md b/changelog/unreleased/fix-activity-rename.md new file mode 100644 index 00000000000..6ad23f289cf --- /dev/null +++ b/changelog/unreleased/fix-activity-rename.md @@ -0,0 +1,6 @@ +Bugfix: Kept historical resource naming in activity + +Kept historical resource naming after renaming in activity for shares and public links. + +https://github.com/owncloud/ocis/pull/10266 +https://github.com/owncloud/ocis/issues/10210 diff --git a/go.mod b/go.mod index 59ba7005840..67268787846 100644 --- a/go.mod +++ b/go.mod @@ -368,3 +368,7 @@ replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/pl // exclude the v2 line of go-sqlite3 which was released accidentally and prevents pulling in newer versions of go-sqlite3 // see https://github.com/mattn/go-sqlite3/issues/965 for more details exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible + +//replace github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.24.1-0.20241008163420-64f5373a2500 + +replace github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d diff --git a/go.sum b/go.sum index 04856023a82..8ce809ff81f 100644 --- a/go.sum +++ b/go.sum @@ -39,6 +39,8 @@ contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9 dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d h1:4BLvpjBits1saRN5AUNWp5GQFbWAwaoaTKxe8MuTFI8= +github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI= github.com/Acconut/go-httptest-recorder v1.0.0 h1:TAv2dfnqp/l+SUvIaMAUK4GeN4+wqb6KZsFFFTGhoJg= github.com/Acconut/go-httptest-recorder v1.0.0/go.mod h1:CwQyhTH1kq/gLyWiRieo7c0uokpu3PXeyF/nZjUNtmM= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= @@ -255,8 +257,6 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c= github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME= github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU= github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE= -github.com/cs3org/reva/v2 v2.25.1-0.20241004072335-2a6fdbed139d h1:ETrSkU/XK50QzsxCAHQrr0b7klOHb9TVmJjmOsjMhr8= -github.com/cs3org/reva/v2 v2.25.1-0.20241004072335-2a6fdbed139d/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= diff --git a/services/activitylog/pkg/service/http.go b/services/activitylog/pkg/service/http.go index 349f8787a53..7afe8b745fc 100644 --- a/services/activitylog/pkg/service/http.go +++ b/services/activitylog/pkg/service/http.go @@ -160,22 +160,37 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h case events.ShareCreated: message = MessageShareCreated ts = utils.TSToTime(ev.CTime) - vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil), WithSharee(ev.GranteeUserID, ev.GranteeGroupID)) + vars, err = s.GetVars(ctx, + WithResource(toRef(ev.ItemID), false), + WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName), + WithUser(ev.Executant, nil, nil), + WithSharee(ev.GranteeUserID, ev.GranteeGroupID)) case events.ShareUpdated: if ev.Sharer != nil && ev.ItemID != nil && ev.Sharer.GetOpaqueId() == ev.ItemID.GetSpaceId() { continue } message = MessageShareUpdated ts = utils.TSToTime(ev.MTime) - vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil), WithTranslation(&t, loc, "field", ev.UpdateMask)) + vars, err = s.GetVars(ctx, + WithResource(toRef(ev.ItemID), false), + WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName), + WithUser(ev.Executant, nil, nil), + WithTranslation(&t, loc, "field", ev.UpdateMask)) case events.ShareRemoved: message = MessageShareDeleted ts = ev.Timestamp - vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil), WithSharee(ev.GranteeUserID, ev.GranteeGroupID)) + vars, err = s.GetVars(ctx, + WithResource(toRef(ev.ItemID), false), + WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName), + WithUser(ev.Executant, nil, nil), + WithSharee(ev.GranteeUserID, ev.GranteeGroupID)) case events.LinkCreated: message = MessageLinkCreated ts = utils.TSToTime(ev.CTime) - vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil)) + vars, err = s.GetVars(ctx, + WithResource(toRef(ev.ItemID), false), + WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName), + WithUser(ev.Executant, nil, nil)) case events.LinkUpdated: if ev.Sharer != nil && ev.ItemID != nil && ev.Sharer.GetOpaqueId() == ev.ItemID.GetSpaceId() { continue @@ -183,7 +198,7 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h message = MessageLinkUpdated ts = utils.TSToTime(ev.MTime) vars, err = s.GetVars(ctx, - WithResource(toRef(ev.ItemID), false), + WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName), WithUser(ev.Executant, nil, nil), WithTranslation(&t, loc, "field", []string{ev.FieldUpdated}), WithVar("token", ev.ItemID.GetOpaqueId(), ev.Token)) diff --git a/tests/acceptance/features/apiActivities/shareActivities.feature b/tests/acceptance/features/apiActivities/shareActivities.feature index 0b419afdd55..e89a345d27c 100644 --- a/tests/acceptance/features/apiActivities/shareActivities.feature +++ b/tests/acceptance/features/apiActivities/shareActivities.feature @@ -1128,7 +1128,7 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["field","folder","resource","token","user"], + "required": ["field","resource","token","user"], "properties": { "field": { "type": "object", @@ -1139,15 +1139,6 @@ Feature: check share activity } } }, - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "new-space" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -1211,7 +1202,7 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["field","folder","resource","token","user"], + "required": ["field","resource","token","user"], "properties": { "field": { "type": "object", @@ -1222,15 +1213,6 @@ Feature: check share activity } } }, - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "new-space" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -1294,7 +1276,7 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["field","folder","resource","token","user"], + "required": ["field","resource","token","user"], "properties": { "field": { "type": "object", @@ -1305,15 +1287,6 @@ Feature: check share activity } } }, - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "new-space" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -1467,7 +1440,7 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["field","folder","resource","token","user"], + "required": ["field","resource","token","user"], "properties": { "field": { "type": "object", @@ -1478,15 +1451,6 @@ Feature: check share activity } } }, - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "new-space" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -1550,7 +1514,7 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["field","folder","resource","token","user"], + "required": ["field","resource","token","user"], "properties": { "field": { "type": "object", @@ -1561,15 +1525,6 @@ Feature: check share activity } } }, - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "new-space" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -1633,7 +1588,7 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["field","folder","resource","token","user"], + "required": ["field","resource","token","user"], "properties": { "field": { "type": "object", @@ -1644,15 +1599,6 @@ Feature: check share activity } } }, - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "new-space" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -2064,17 +2010,8 @@ Feature: check share activity }, "variables": { "type": "object", - "required": ["folder","resource","user"], + "required": ["resource","user"], "properties": { - "folder": { - "type": "object", - "required": ["id","name"], - "properties": { - "name": { - "const": "Alice Hansen" - } - } - }, "resource": { "type": "object", "required": ["id","name"], @@ -2287,4 +2224,3 @@ Feature: check share activity } } """ - diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/interceptors/eventsmiddleware/conversion.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/interceptors/eventsmiddleware/conversion.go index 0bdedfe4ce6..1ed9ac92999 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/interceptors/eventsmiddleware/conversion.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/interceptors/eventsmiddleware/conversion.go @@ -51,6 +51,7 @@ func ShareCreated(r *collaboration.CreateShareResponse, executant *user.User) ev GranteeUserID: r.Share.GetGrantee().GetUserId(), GranteeGroupID: r.Share.GetGrantee().GetGroupId(), ItemID: r.Share.ResourceId, + ResourceName: utils.ReadPlainFromOpaque(r.Opaque, "resourcename"), CTime: r.Share.Ctime, Permissions: r.Share.Permissions, } @@ -73,6 +74,7 @@ func ShareRemoved(r *collaboration.RemoveShareResponse, req *collaboration.Remov GranteeUserID: userid, GranteeGroupID: groupid, ItemID: rid, + ResourceName: utils.ReadPlainFromOpaque(r.Opaque, "resourcename"), Timestamp: time.Now(), } } @@ -83,6 +85,7 @@ func ShareUpdated(r *collaboration.UpdateShareResponse, req *collaboration.Updat Executant: executant.GetId(), ShareID: r.Share.Id, ItemID: r.Share.ResourceId, + ResourceName: utils.ReadPlainFromOpaque(r.Opaque, "resourcename"), Permissions: r.Share.Permissions, GranteeUserID: r.Share.GetGrantee().GetUserId(), GranteeGroupID: r.Share.GetGrantee().GetGroupId(), @@ -114,6 +117,7 @@ func LinkCreated(r *link.CreatePublicShareResponse, executant *user.User) events ShareID: r.Share.Id, Sharer: r.Share.Creator, ItemID: r.Share.ResourceId, + ResourceName: utils.ReadPlainFromOpaque(r.Opaque, "resourcename"), Permissions: r.Share.Permissions, DisplayName: r.Share.DisplayName, Expiration: r.Share.Expiration, @@ -130,6 +134,7 @@ func LinkUpdated(r *link.UpdatePublicShareResponse, req *link.UpdatePublicShareR ShareID: r.Share.Id, Sharer: r.Share.Creator, ItemID: r.Share.ResourceId, + ResourceName: utils.ReadPlainFromOpaque(r.Opaque, "resourcename"), Permissions: r.Share.Permissions, DisplayName: r.Share.DisplayName, Expiration: r.Share.Expiration, @@ -177,11 +182,12 @@ func LinkRemoved(r *link.RemovePublicShareResponse, req *link.RemovePublicShareR var rid *provider.ResourceId _ = utils.ReadJSONFromOpaque(r.Opaque, "resourceid", &rid) return events.LinkRemoved{ - Executant: executant.GetId(), - ShareID: req.Ref.GetId(), - ShareToken: req.Ref.GetToken(), - Timestamp: utils.TSNow(), - ItemID: rid, + Executant: executant.GetId(), + ShareID: req.Ref.GetId(), + ShareToken: req.Ref.GetToken(), + Timestamp: utils.TSNow(), + ItemID: rid, + ResourceName: utils.ReadPlainFromOpaque(r.Opaque, "resourcename"), } } diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go index 7876750b670..1c97430457e 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go @@ -332,6 +332,7 @@ func (s *service) CreatePublicShare(ctx context.Context, req *link.CreatePublicS default: res.Status = status.NewOK(ctx) res.Share = share + res.Opaque = utils.AppendPlainToOpaque(nil, "resourcename", sRes.GetInfo().GetName()) } return res, nil @@ -353,15 +354,15 @@ func (s *service) RemovePublicShare(ctx context.Context, req *link.RemovePublicS Status: status.NewInternal(ctx, "error loading public share"), }, err } - if !publicshare.IsCreatedByUser(ps, user) { - sRes, err := gatewayClient.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ps.ResourceId}}) - if err != nil { - log.Err(err).Interface("resource_id", ps.ResourceId).Msg("failed to stat shared resource") - return &link.RemovePublicShareResponse{ - Status: status.NewInternal(ctx, "failed to stat shared resource"), - }, err - } + sRes, err := gatewayClient.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ps.ResourceId}}) + if err != nil { + log.Err(err).Interface("resource_id", ps.ResourceId).Msg("failed to stat shared resource") + return &link.RemovePublicShareResponse{ + Status: status.NewInternal(ctx, "failed to stat shared resource"), + }, err + } + if !publicshare.IsCreatedByUser(ps, user) { if !sRes.GetInfo().GetPermissionSet().RemoveGrant { return &link.RemovePublicShareResponse{ Status: status.NewPermissionDenied(ctx, nil, "no permission to delete public share"), @@ -374,8 +375,10 @@ func (s *service) RemovePublicShare(ctx context.Context, req *link.RemovePublicS Status: status.NewInternal(ctx, "error deleting public share"), }, err } + o := utils.AppendJSONToOpaque(nil, "resourceid", ps.GetResourceId()) + o = utils.AppendPlainToOpaque(o, "resourcename", sRes.GetInfo().GetName()) return &link.RemovePublicShareResponse{ - Opaque: utils.AppendJSONToOpaque(nil, "resourceid", ps.GetResourceId()), + Opaque: o, Status: status.NewOK(ctx), }, nil } @@ -603,6 +606,7 @@ func (s *service) UpdatePublicShare(ctx context.Context, req *link.UpdatePublicS res := &link.UpdatePublicShareResponse{ Status: status.NewOK(ctx), Share: updateR, + Opaque: utils.AppendPlainToOpaque(nil, "resourcename", sRes.GetInfo().GetName()), } return res, nil } diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/usershareprovider/usershareprovider.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/usershareprovider/usershareprovider.go index 4bec8dd75d9..aa88eab3b71 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/usershareprovider/usershareprovider.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/usershareprovider/usershareprovider.go @@ -248,6 +248,7 @@ func (s *service) CreateShare(ctx context.Context, req *collaboration.CreateShar return &collaboration.CreateShareResponse{ Status: status.NewOK(ctx), Share: createdShare, + Opaque: utils.AppendPlainToOpaque(nil, "resourcename", sRes.GetInfo().GetName()), }, nil } @@ -296,6 +297,7 @@ func (s *service) RemoveShare(ctx context.Context, req *collaboration.RemoveShar } o := utils.AppendJSONToOpaque(nil, "resourceid", share.GetResourceId()) + o = utils.AppendPlainToOpaque(o, "resourcename", sRes.GetInfo().GetName()) if user := share.GetGrantee().GetUserId(); user != nil { o = utils.AppendJSONToOpaque(o, "granteeuserid", user) } else { @@ -447,6 +449,7 @@ func (s *service) UpdateShare(ctx context.Context, req *collaboration.UpdateShar res := &collaboration.UpdateShareResponse{ Status: status.NewOK(ctx), Share: share, + Opaque: utils.AppendPlainToOpaque(nil, "resourcename", sRes.GetInfo().GetName()), } return res, nil } diff --git a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/trashbin.go b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/trashbin.go index 07fa6c3743d..064878cc433 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/trashbin.go +++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/trashbin.go @@ -29,6 +29,8 @@ import ( "strings" "time" + "go.opentelemetry.io/otel/codes" + "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net" @@ -36,15 +38,15 @@ import ( "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/propfind" "github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup" "github.com/cs3org/reva/v2/pkg/storagespace" - "go.opentelemetry.io/otel/codes" rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" + "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" rstatus "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/cs3org/reva/v2/pkg/utils" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" ) // TrashbinHandler handles trashbin requests @@ -373,8 +375,8 @@ func (h *TrashbinHandler) formatTrashPropfind(ctx context.Context, s *svc, space func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, spaceID, refBase string, pf *propfind.XML, item *provider.RecycleItem) (*propfind.ResponseXML, error) { baseURI := ctx.Value(net.CtxKeyBaseURI).(string) - ref := path.Join(baseURI, refBase, item.Key) - if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { + ref := path.Join(baseURI, refBase, item.GetKey()) + if item.GetType() == provider.ResourceType_RESOURCE_TYPE_CONTAINER { ref += "/" } @@ -385,9 +387,9 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, spaceI // TODO(jfd): if the path we list here is taken from the ListRecycle request we rely on the gateway to prefix it with the mount point - t := utils.TSToTime(item.DeletionTime).UTC() + t := utils.TSToTime(item.GetDeletionTime()).UTC() dTime := t.Format(time.RFC1123Z) - size := strconv.FormatUint(item.Size, 10) + size := strconv.FormatUint(item.GetSize(), 10) // when allprops has been requested if pf.Allprop != nil { @@ -397,11 +399,11 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, spaceI Prop: []prop.PropertyXML{}, } // yes this is redundant, can be derived from oc:trashbin-original-location which contains the full path, clients should not fetch it - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-filename", path.Base(item.Ref.Path))) - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-location", strings.TrimPrefix(item.Ref.Path, "/"))) - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-delete-timestamp", strconv.FormatUint(item.DeletionTime.Seconds, 10))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-filename", path.Base(item.GetRef().GetPath()))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-location", strings.TrimPrefix(item.GetRef().GetPath(), "/"))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-delete-timestamp", strconv.FormatUint(item.GetDeletionTime().GetSeconds(), 10))) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-delete-datetime", dTime)) - if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { + if item.GetType() == provider.ResourceType_RESOURCE_TYPE_CONTAINER { propstatOK.Prop = append(propstatOK.Prop, prop.Raw("d:resourcetype", "")) propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:size", size)) } else { @@ -427,21 +429,21 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, spaceI case net.NsOwncloud: switch pf.Prop[i].Local { case "oc:size": - if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { + if item.GetType() == provider.ResourceType_RESOURCE_TYPE_CONTAINER { propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:size", size)) } else { propstatNotFound.Prop = append(propstatNotFound.Prop, prop.NotFound("oc:size")) } case "trashbin-original-filename": // yes this is redundant, can be derived from oc:trashbin-original-location which contains the full path, clients should not fetch it - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-filename", path.Base(item.Ref.Path))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-filename", path.Base(item.GetRef().GetPath()))) case "trashbin-original-location": // TODO (jfd) double check and clarify the cs3 spec what the Key is about and if Path is only the folder that contains the file or if it includes the filename - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-location", strings.TrimPrefix(item.Ref.Path, "/"))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-original-location", strings.TrimPrefix(item.GetRef().GetPath(), "/"))) case "trashbin-delete-datetime": propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-delete-datetime", dTime)) case "trashbin-delete-timestamp": - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-delete-timestamp", strconv.FormatUint(item.DeletionTime.Seconds, 10))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:trashbin-delete-timestamp", strconv.FormatUint(item.GetDeletionTime().GetSeconds(), 10))) case "spaceid": propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:spaceid", spaceID)) default: @@ -450,20 +452,20 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, spaceI case net.NsDav: switch pf.Prop[i].Local { case "getcontentlength": - if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { + if item.GetType() == provider.ResourceType_RESOURCE_TYPE_CONTAINER { propstatNotFound.Prop = append(propstatNotFound.Prop, prop.NotFound("d:getcontentlength")) } else { propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getcontentlength", size)) } case "resourcetype": - if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { + if item.GetType() == provider.ResourceType_RESOURCE_TYPE_CONTAINER { propstatOK.Prop = append(propstatOK.Prop, prop.Raw("d:resourcetype", "")) } else { propstatOK.Prop = append(propstatOK.Prop, prop.Raw("d:resourcetype", "")) // redirectref is another option } case "getcontenttype": - if item.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { + if item.GetType() == provider.ResourceType_RESOURCE_TYPE_CONTAINER { propstatOK.Prop = append(propstatOK.Prop, prop.Raw("d:getcontenttype", "httpd/unix-directory")) } else { propstatNotFound.Prop = append(propstatNotFound.Prop, prop.NotFound("d:getcontenttype")) diff --git a/vendor/github.com/cs3org/reva/v2/pkg/events/sharing.go b/vendor/github.com/cs3org/reva/v2/pkg/events/sharing.go index daa13ad11b6..f6bc215ea09 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/events/sharing.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/events/sharing.go @@ -41,6 +41,7 @@ type ShareCreated struct { GranteeGroupID *group.GroupId Sharee *provider.Grantee ItemID *provider.ResourceId + ResourceName string Permissions *collaboration.SharePermissions CTime *types.Timestamp } @@ -62,8 +63,9 @@ type ShareRemoved struct { GranteeUserID *user.UserId GranteeGroupID *group.GroupId - ItemID *provider.ResourceId - Timestamp time.Time + ItemID *provider.ResourceId + ResourceName string + Timestamp time.Time } // Unmarshal to fulfill umarshaller interface @@ -78,6 +80,7 @@ type ShareUpdated struct { Executant *user.UserId ShareID *collaboration.ShareId ItemID *provider.ResourceId + ResourceName string Permissions *collaboration.SharePermissions GranteeUserID *user.UserId GranteeGroupID *group.GroupId @@ -101,6 +104,7 @@ type ShareExpired struct { ShareID *collaboration.ShareId ShareOwner *user.UserId ItemID *provider.ResourceId + Path string ExpiredAt time.Time // split the protobuf Grantee oneof so we can use stdlib encoding/json GranteeUserID *user.UserId @@ -119,6 +123,7 @@ type ReceivedShareUpdated struct { Executant *user.UserId ShareID *collaboration.ShareId ItemID *provider.ResourceId + Path string Permissions *collaboration.SharePermissions GranteeUserID *user.UserId GranteeGroupID *group.GroupId @@ -141,6 +146,7 @@ type LinkCreated struct { ShareID *link.PublicShareId Sharer *user.UserId ItemID *provider.ResourceId + ResourceName string Permissions *link.PublicSharePermissions DisplayName string Expiration *types.Timestamp @@ -162,6 +168,7 @@ type LinkUpdated struct { ShareID *link.PublicShareId Sharer *user.UserId ItemID *provider.ResourceId + ResourceName string Permissions *link.PublicSharePermissions DisplayName string Expiration *types.Timestamp @@ -185,6 +192,7 @@ type LinkAccessed struct { ShareID *link.PublicShareId Sharer *user.UserId ItemID *provider.ResourceId + Path string Permissions *link.PublicSharePermissions DisplayName string Expiration *types.Timestamp @@ -221,10 +229,11 @@ func (LinkAccessFailed) Unmarshal(v []byte) (interface{}, error) { type LinkRemoved struct { Executant *user.UserId // split protobuf Ref - ShareID *link.PublicShareId - ShareToken string - Timestamp *types.Timestamp - ItemID *provider.ResourceId + ShareID *link.PublicShareId + ShareToken string + Timestamp *types.Timestamp + ItemID *provider.ResourceId + ResourceName string } // Unmarshal to fulfill umarshaller interface diff --git a/vendor/modules.txt b/vendor/modules.txt index 7886aefb9b3..5f53dbce72b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -367,7 +367,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.25.1-0.20241004072335-2a6fdbed139d +# github.com/cs3org/reva/v2 v2.25.1-0.20241004072335-2a6fdbed139d => github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d ## explicit; go 1.21 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime @@ -2445,3 +2445,4 @@ stash.kopano.io/kgol/rndm # github.com/egirna/icap-client => github.com/fschade/icap-client v0.0.0-20240802074440-aade4a234387 # github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c # github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20240807130109-f62bb67e8c90 +# github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d