Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Handle the case of root uid
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Jun 9, 2021
1 parent 0b62292 commit 0cca87c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1514,11 +1514,17 @@ func (fs *eosfs) getUIDGateway(ctx context.Context, u *userpb.UserId) (string, s

func (fs *eosfs) getUserIDGateway(ctx context.Context, uid string) (*userpb.UserId, error) {
log := appctx.GetLogger(ctx)
// Handle the case of root
if uid == "0" {
return nil, errtypes.BadRequest("eosfs: cannot return root user")
}

if userIDInterface, err := fs.userIDCache.Get(uid); err == nil {
log.Debug().Msg("eosfs: found cached uid " + uid)
return userIDInterface.(*userpb.UserId), nil
}
log.Debug().Msg("eosfs: retrieving user if from gateway for uid " + uid)

log.Debug().Msg("eosfs: retrieving user from gateway for uid " + uid)
client, err := pool.GetGatewayServiceClient(fs.conf.GatewaySvc)
if err != nil {
return nil, errors.Wrap(err, "eos: error getting gateway grpc client")
Expand Down

0 comments on commit 0cca87c

Please sign in to comment.