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

Implement cs3.sharing.collaboration.v1beta1.Share.ShareType #1563

Merged
merged 2 commits into from
Mar 17, 2021
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: 5 additions & 0 deletions changelog/unreleased/implement-share_sharetype.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion internal/grpc/services/ocmcore/ocmcore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 2 additions & 1 deletion pkg/ocm/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down