From 299bdfd9877910bfa69d633a93f9a050c10deed4 Mon Sep 17 00:00:00 2001 From: Antoon Prins Date: Wed, 17 Mar 2021 12:59:28 +0100 Subject: [PATCH 1/2] Implement Share.ShareType. --- internal/grpc/services/ocmcore/ocmcore.go | 2 +- internal/grpc/services/ocmshareprovider/ocmshareprovider.go | 2 +- pkg/ocm/share/manager/json/json.go | 3 ++- pkg/ocm/share/share.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/grpc/services/ocmcore/ocmcore.go b/internal/grpc/services/ocmcore/ocmcore.go index 9d69fcd8b4..c6b814b8f0 100644 --- a/internal/grpc/services/ocmcore/ocmcore.go +++ b/internal/grpc/services/ocmcore/ocmcore.go @@ -171,7 +171,7 @@ func (s *service) CreateOCMCoreShare(ctx context.Context, req *ocmcore.CreateOCM }, } - share, err := s.sm.Share(ctx, resource, grant, req.Name, nil, "", req.Owner, token) + share, err := s.sm.Share(ctx, resource, grant, req.Name, nil, "", req.Owner, token, ocm.Share_SHARE_TYPE_REGULAR) if err != nil { return &ocmcore.CreateOCMCoreShareResponse{ Status: status.NewInternal(ctx, err, "error creating ocm core share"), diff --git a/internal/grpc/services/ocmshareprovider/ocmshareprovider.go b/internal/grpc/services/ocmshareprovider/ocmshareprovider.go index 15fd779bb5..6512c4acd1 100644 --- a/internal/grpc/services/ocmshareprovider/ocmshareprovider.go +++ b/internal/grpc/services/ocmshareprovider/ocmshareprovider.go @@ -144,7 +144,7 @@ func (s *service) CreateOCMShare(ctx context.Context, req *ocm.CreateOCMShareReq }, nil } - share, err := s.sm.Share(ctx, req.ResourceId, req.Grant, name, req.RecipientMeshProvider, permissions, nil, "") + share, err := s.sm.Share(ctx, req.ResourceId, req.Grant, name, req.RecipientMeshProvider, permissions, nil, "", ocm.Share_SHARE_TYPE_REGULAR) if err != nil { return &ocm.CreateOCMShareResponse{ Status: status.NewInternal(ctx, err, "error creating share"), diff --git a/pkg/ocm/share/manager/json/json.go b/pkg/ocm/share/manager/json/json.go index 850dc712a7..b37e0f5450 100644 --- a/pkg/ocm/share/manager/json/json.go +++ b/pkg/ocm/share/manager/json/json.go @@ -196,7 +196,7 @@ func getOCMEndpoint(originProvider *ocmprovider.ProviderInfo) (string, error) { } func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGrant, name string, - pi *ocmprovider.ProviderInfo, pm string, owner *userpb.UserId, token string) (*ocm.Share, error) { + pi *ocmprovider.ProviderInfo, pm string, owner *userpb.UserId, token string, st ocm.Share_ShareType) (*ocm.Share, error) { id := genID() now := time.Now().UnixNano() @@ -265,6 +265,7 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr Creator: userID, Ctime: ts, Mtime: ts, + ShareType: st, } if isOwnersMeshProvider { diff --git a/pkg/ocm/share/share.go b/pkg/ocm/share/share.go index 428ab86713..9eb439a6e0 100644 --- a/pkg/ocm/share/share.go +++ b/pkg/ocm/share/share.go @@ -31,7 +31,7 @@ import ( type Manager interface { // Create a new share in fn with the given acl. Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGrant, name string, - pi *ocmprovider.ProviderInfo, pm string, owner *userpb.UserId, token string) (*ocm.Share, error) + pi *ocmprovider.ProviderInfo, pm string, owner *userpb.UserId, token string, st ocm.Share_ShareType) (*ocm.Share, error) // GetShare gets the information for a share by the given ref. GetShare(ctx context.Context, ref *ocm.ShareReference) (*ocm.Share, error) From deb1f838fb61a8165a0ea3bb0a6cd271741a6fc1 Mon Sep 17 00:00:00 2001 From: Antoon Prins Date: Wed, 17 Mar 2021 14:09:37 +0100 Subject: [PATCH 2/2] Changelog added. --- changelog/unreleased/implement-share_sharetype.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/implement-share_sharetype.md diff --git a/changelog/unreleased/implement-share_sharetype.md b/changelog/unreleased/implement-share_sharetype.md new file mode 100644 index 0000000000..e7c4ab171b --- /dev/null +++ b/changelog/unreleased/implement-share_sharetype.md @@ -0,0 +1,5 @@ +Enhancement: Implement cs3.sharing.collaboration.v1beta1.Share.ShareType + +Interface method Share() in pkg/ocm/share/share.go now has a share type parameter. + +https://github.com/cs3org/reva/pull/1563 \ No newline at end of file