Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Disallow moves" #4293

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions changelog/unreleased/disallow-moves-between-shares.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,9 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
Status: rpcStatus,
}, nil
}

if dstReceivedShare.Share.Id.OpaqueId != srcReceivedShare.Share.Id.OpaqueId {
if srcReceivedShare.Share.ResourceId.SpaceId != dstReceivedShare.Share.ResourceId.SpaceId {
return &provider.MoveResponse{
Status: status.NewUnimplemented(ctx, nil, "sharesstorageprovider: can not move between shares"),
Status: status.NewInvalid(ctx, "sharesstorageprovider: can not move between shares on different storages"),
}, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ var _ = Describe("Sharesstorageprovider", func() {
OpaqueId: "shareid",
},
ResourceId: &sprovider.ResourceId{
StorageId: "storageid",
SpaceId: "storageid",
StorageId: "share1-storageid",
SpaceId: "share1-storageid",
OpaqueId: "shareddir",
},
Permissions: &collaboration.SharePermissions{
Expand All @@ -102,20 +102,20 @@ var _ = Describe("Sharesstorageprovider", func() {
},
},
MountPoint: &sprovider.Reference{
Path: "share1-shareddir",
Path: "oldname",
},
}

BaseShareTwo = &collaboration.ReceivedShare{
State: collaboration.ShareState_SHARE_STATE_ACCEPTED,
Share: &collaboration.Share{
Id: &collaboration.ShareId{
OpaqueId: "shareid2",
OpaqueId: "shareidtwo",
},
ResourceId: &sprovider.ResourceId{
StorageId: "storageid",
SpaceId: "storageid",
OpaqueId: "shareddir2",
StorageId: "share1-storageid",
SpaceId: "share1-storageid",
OpaqueId: "shareddir",
},
Permissions: &collaboration.SharePermissions{
Permissions: &sprovider.ResourcePermissions{
Expand All @@ -126,7 +126,7 @@ var _ = Describe("Sharesstorageprovider", func() {
},
},
MountPoint: &sprovider.Reference{
Path: "share2-shareddir2",
Path: "share1-shareddir",
},
}

Expand Down Expand Up @@ -298,12 +298,6 @@ var _ = Describe("Sharesstorageprovider", func() {
})
}
return resp
case utils.ResourceIDEqual(req.Ref.ResourceId, BaseShareTwo.Share.ResourceId):
resp := &sprovider.ListContainerResponse{
Status: status.NewOK(context.Background()),
Infos: []*sprovider.ResourceInfo{},
}
return resp
case utils.ResourceIDEqual(req.Ref.ResourceId, BaseShareTwo.Share.ResourceId):
return &sprovider.ListContainerResponse{
Status: status.NewOK(context.Background()),
Expand Down Expand Up @@ -778,11 +772,11 @@ var _ = Describe("Sharesstorageprovider", func() {
req := &sprovider.MoveRequest{
Source: &sprovider.Reference{
ResourceId: ShareJail,
Path: "./share1-shareddir",
Path: "./oldname",
},
Destination: &sprovider.Reference{
ResourceId: ShareJail,
Path: "./share1-shareddir-renamed",
Path: "./newname",
},
}
res, err := s.Move(ctx, req)
Expand All @@ -796,37 +790,17 @@ var _ = Describe("Sharesstorageprovider", func() {
It("refuses to move a file between shares", func() {
req := &sprovider.MoveRequest{
Source: &sprovider.Reference{
ResourceId: ShareJail,
Path: "./share1-shareddir/share1-shareddir-file",
Path: "/shares/share1-shareddir/share1-shareddir-file",
},
Destination: &sprovider.Reference{
ResourceId: ShareJail,
Path: "./share2-shareddir2/share1-shareddir-file",
Path: "/shares/share2-shareddir/share2-shareddir-file",
},
}
res, err := s.Move(ctx, req)
gatewayClient.AssertNotCalled(GinkgoT(), "Move", mock.Anything, mock.Anything)
Expect(err).ToNot(HaveOccurred())
Expect(res).ToNot(BeNil())
Expect(res.Status.Code).To(Equal(rpc.Code_CODE_UNIMPLEMENTED))
})

It("refuses to move a file between shares resolving to the same space", func() {
req := &sprovider.MoveRequest{
Source: &sprovider.Reference{
ResourceId: ShareJail,
Path: "./share1-shareddir/share1-shareddir-file",
},
Destination: &sprovider.Reference{
ResourceId: ShareJail,
Path: "./share2-shareddir2/share1-shareddir-file",
},
}
res, err := s.Move(ctx, req)
gatewayClient.AssertNotCalled(GinkgoT(), "Move", mock.Anything, mock.Anything)
Expect(err).ToNot(HaveOccurred())
Expect(res).ToNot(BeNil())
Expect(res.Status.Code).To(Equal(rpc.Code_CODE_UNIMPLEMENTED))
Expect(res.Status.Code).To(Equal(rpc.Code_CODE_INVALID_ARGUMENT))
})

It("moves a file", func() {
Expand Down
Loading