Skip to content

Commit

Permalink
List shares (Phoenix) (#347)
Browse files Browse the repository at this point in the history
* added conversions package

* use gateway as service client

* implement gateway CreatePublicShare

* user shares working again

* list collaborators and outgoing shares

* grpc wiring for public links

* http wiring for public links

* add comments on exported members

* add files_namespace as a configuration dependency...

* list shared with me user shares (wip)

* list of shares shared with me

* cleanup cs3 - ocs conversions helpers

* shares list feature complete

* hey hey hey

* code review changes
  • Loading branch information
refs authored and labkode committed Nov 11, 2019
1 parent 4bb8e33 commit 08634bf
Show file tree
Hide file tree
Showing 6 changed files with 840 additions and 388 deletions.
21 changes: 14 additions & 7 deletions internal/grpc/services/gateway/publicshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ func (s *svc) CreatePublicShare(ctx context.Context, req *publicshareproviderv0a
log := appctx.GetLogger(ctx)
log.Info().Msg("create public share")

res := &publicshareproviderv0alphapb.CreatePublicShareResponse{
Status: status.NewOK(ctx),
// Share: share,
c, err := pool.GetPublicShareProviderClient(s.c.PublicShareProviderEndpoint)
if err != nil {
return nil, err
}

res, err := c.CreatePublicShare(ctx, req)
if err != nil {
return nil, err
}

// TODO(refs) commit to storage if configured
return res, nil
}

Expand Down Expand Up @@ -70,11 +77,11 @@ func (s *svc) GetPublicShare(ctx context.Context, req *publicshareproviderv0alph

func (s *svc) ListPublicShares(ctx context.Context, req *publicshareproviderv0alphapb.ListPublicSharesRequest) (*publicshareproviderv0alphapb.ListPublicSharesResponse, error) {
log := appctx.GetLogger(ctx)
log.Info().Msg("list public share")
log.Info().Msg("listing public shares")

pClient, err := pool.GetPublicShareProviderClient(s.c.UserShareProviderEndpoint)
pClient, err := pool.GetPublicShareProviderClient(s.c.PublicShareProviderEndpoint)
if err != nil {
log.Err(err).Msg("gateway: error getting usershareprovider client")
log.Err(err).Msg("error connecting to a public share provider")
return &publicshareproviderv0alphapb.ListPublicSharesResponse{
Status: &rpcpb.Status{
Code: rpcpb.Code_CODE_INTERNAL,
Expand All @@ -84,7 +91,7 @@ func (s *svc) ListPublicShares(ctx context.Context, req *publicshareproviderv0al

res, err := pClient.ListPublicShares(ctx, req)
if err != nil {
return nil, errors.Wrap(err, "gateway: error calling ListShares")
return nil, errors.Wrap(err, "error calling ListShares")
}

// res := &publicshareproviderv0alphapb.ListPublicSharesResponse{
Expand Down
1 change: 1 addition & 0 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ func (s *svc) UnsetArbitraryMetadata(ctx context.Context, req *storageproviderv0
}

func (s *svc) Stat(ctx context.Context, req *storageproviderv0alphapb.StatRequest) (*storageproviderv0alphapb.StatResponse, error) {
// TODO(refs) do we need to append home to every stat request?
c, err := s.find(ctx, req.Ref)
if err != nil {
if _, ok := err.(errtypes.IsNotFound); ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,19 @@ func (s *service) CreatePublicShare(ctx context.Context, req *publicshareprovide
log := appctx.GetLogger(ctx)
log.Info().Msg("create public share")

u, ok := user.ContextGetUser(ctx)
if !ok {
log.Error().Msg("error getting user from context")
}

share, err := s.sm.CreatePublicShare(ctx, u, req.ResourceInfo, req.Grant)
if err != nil {
log.Debug().Err(err).Str("createShare", "shares").Msg("error connecting to storage provider")
}

res := &publicshareproviderv0alphapb.CreatePublicShareResponse{
Status: status.NewOK(ctx),
// Share: share,
Share: share,
}
return res, nil
}
Expand Down

0 comments on commit 08634bf

Please sign in to comment.