chore(dependencies): bump reva
This commit is contained in:
Generated
Vendored
+37
-1
@@ -19,6 +19,7 @@
|
||||
package eventsmiddleware
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
group "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1"
|
||||
@@ -28,6 +29,7 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/events"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/rhttp/router"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storagespace"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/utils"
|
||||
)
|
||||
@@ -293,11 +295,45 @@ func ItemMoved(r *provider.MoveResponse, req *provider.MoveRequest, spaceOwner *
|
||||
}
|
||||
}
|
||||
|
||||
// TrashbinPurged converts the response to an event
|
||||
func TrashbinPurged(r *provider.PurgeRecycleResponse, req *provider.PurgeRecycleRequest, executant *user.User) events.TrashbinPurged {
|
||||
return events.TrashbinPurged{
|
||||
Executant: executant.GetId(),
|
||||
Ref: &provider.Reference{
|
||||
ResourceId: &provider.ResourceId{
|
||||
StorageId: req.Ref.GetResourceId().GetStorageId(),
|
||||
SpaceId: req.Ref.GetResourceId().GetSpaceId(),
|
||||
OpaqueId: req.Ref.GetResourceId().GetSpaceId(),
|
||||
},
|
||||
},
|
||||
Timestamp: utils.TSNow(),
|
||||
ImpersonatingUser: extractImpersonator(executant),
|
||||
}
|
||||
}
|
||||
|
||||
// ItemPurged converts the response to an event
|
||||
func ItemPurged(r *provider.PurgeRecycleResponse, req *provider.PurgeRecycleRequest, executant *user.User) events.ItemPurged {
|
||||
root, relativePath := router.ShiftPath(req.Key)
|
||||
if relativePath == "/" && !strings.HasSuffix(req.Key, "/") {
|
||||
relativePath = ""
|
||||
}
|
||||
if root == "" {
|
||||
// if there is no key this is about purging the whole trashbin
|
||||
root = req.Ref.GetResourceId().GetSpaceId()
|
||||
}
|
||||
|
||||
ref := &provider.Reference{
|
||||
ResourceId: &provider.ResourceId{
|
||||
StorageId: req.Ref.GetResourceId().GetStorageId(),
|
||||
SpaceId: req.Ref.GetResourceId().GetSpaceId(),
|
||||
OpaqueId: root,
|
||||
},
|
||||
Path: relativePath,
|
||||
}
|
||||
|
||||
return events.ItemPurged{
|
||||
Executant: executant.GetId(),
|
||||
Ref: req.Ref,
|
||||
Ref: ref,
|
||||
Timestamp: utils.TSNow(),
|
||||
ImpersonatingUser: extractImpersonator(executant),
|
||||
}
|
||||
|
||||
Generated
Vendored
+7
-1
@@ -149,7 +149,13 @@ func NewUnary(m map[string]interface{}) (grpc.UnaryServerInterceptor, int, error
|
||||
}
|
||||
case *provider.PurgeRecycleResponse:
|
||||
if isSuccess(v) {
|
||||
ev = ItemPurged(v, req.(*provider.PurgeRecycleRequest), executant)
|
||||
id := req.(*provider.PurgeRecycleRequest).GetRef().GetResourceId()
|
||||
if id != nil && id.OpaqueId == id.SpaceId && req.(*provider.PurgeRecycleRequest).Key == "" {
|
||||
// this is a purge of the whole trashbin, NOT the whole space
|
||||
ev = TrashbinPurged(v, req.(*provider.PurgeRecycleRequest), executant)
|
||||
} else {
|
||||
ev = ItemPurged(v, req.(*provider.PurgeRecycleRequest), executant)
|
||||
}
|
||||
}
|
||||
case *provider.RestoreRecycleItemResponse:
|
||||
if isSuccess(v) {
|
||||
|
||||
+16
@@ -162,6 +162,22 @@ func (ItemMoved) Unmarshal(v []byte) (interface{}, error) {
|
||||
return e, err
|
||||
}
|
||||
|
||||
// TrashbinPurged is emitted when the whole trashbin is purged
|
||||
type TrashbinPurged struct {
|
||||
Executant *user.UserId
|
||||
Ref *provider.Reference
|
||||
Owner *user.UserId
|
||||
Timestamp *types.Timestamp
|
||||
ImpersonatingUser *user.User
|
||||
}
|
||||
|
||||
// Unmarshal to fulfill umarshaller interface
|
||||
func (TrashbinPurged) Unmarshal(v []byte) (interface{}, error) {
|
||||
e := TrashbinPurged{}
|
||||
err := json.Unmarshal(v, &e)
|
||||
return e, err
|
||||
}
|
||||
|
||||
// ItemPurged is emitted when a file or folder is removed from trashbin
|
||||
type ItemPurged struct {
|
||||
Executant *user.UserId
|
||||
|
||||
Reference in New Issue
Block a user