Skip to content

Commit

Permalink
Implement cs3.sharing.collaboration.v1beta1.Share.ShareType (#1563)
Browse files Browse the repository at this point in the history
  • Loading branch information
redblom authored Mar 17, 2021
1 parent bef38ca commit 5356a21
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
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

0 comments on commit 5356a21

Please sign in to comment.