Skip to content

Commit

Permalink
Skip fetching metadata where not required
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Oct 26, 2021
1 parent 62fc1f1 commit 3f152fb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/grpc/interceptors/auth/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func checkIfNestedResource(ctx context.Context, ref *provider.Reference, parent
// We mint a token as the owner of the public share and try to stat the reference
// TODO(ishank011): We need to find a better alternative to this

userResp, err := client.GetUser(ctx, &userpb.GetUserRequest{UserId: statResponse.Info.Owner})
userResp, err := client.GetUser(ctx, &userpb.GetUserRequest{UserId: statResponse.Info.Owner, SkipFetchingUserGroups: true})
if err != nil || userResp.Status.Code != rpc.Code_CODE_OK {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/ocmd/shares.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (h *sharesHandler) createShare(w http.ResponseWriter, r *http.Request) {
}

userRes, err := gatewayClient.GetUser(ctx, &userpb.GetUserRequest{
UserId: &userpb.UserId{OpaqueId: shareWith},
UserId: &userpb.UserId{OpaqueId: shareWith}, SkipFetchingUserGroups: true,
})
if err != nil {
WriteError(w, r, APIErrorServerError, "error searching recipient", err)
Expand Down
8 changes: 5 additions & 3 deletions pkg/share/manager/sql/conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ func (c *GatewayUserConverter) UserIDToUserName(ctx context.Context, userid *use
return "", err
}
getUserResponse, err := gwConn.GetUser(ctx, &userprovider.GetUserRequest{
UserId: userid,
UserId: userid,
SkipFetchingUserGroups: true,
})
if err != nil {
return "", err
Expand All @@ -97,8 +98,9 @@ func (c *GatewayUserConverter) UserNameToUserID(ctx context.Context, username st
return nil, err
}
getUserResponse, err := gwConn.GetUserByClaim(ctx, &userpb.GetUserByClaimRequest{
Claim: "username",
Value: username,
Claim: "username",
Value: username,
SkipFetchingUserGroups: true,
})
if err != nil {
return nil, err
Expand Down
8 changes: 5 additions & 3 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,8 @@ func (fs *eosfs) getUIDGateway(ctx context.Context, u *userpb.UserId) (eosclient
return eosclient.Authorization{}, errors.Wrap(err, "eosfs: error getting gateway grpc client")
}
getUserResp, err := client.GetUser(ctx, &userpb.GetUserRequest{
UserId: u,
UserId: u,
SkipFetchingUserGroups: true,
})
if err != nil {
return eosclient.Authorization{}, errors.Wrap(err, "eosfs: error getting user")
Expand Down Expand Up @@ -1820,8 +1821,9 @@ func (fs *eosfs) getUserIDGateway(ctx context.Context, uid string) (*userpb.User
return nil, errors.Wrap(err, "eosfs: error getting gateway grpc client")
}
getUserResp, err := client.GetUserByClaim(ctx, &userpb.GetUserByClaimRequest{
Claim: "uid",
Value: uid,
Claim: "uid",
Value: uid,
SkipFetchingUserGroups: true,
})
if err != nil {
return nil, errors.Wrap(err, "eosfs: error getting user")
Expand Down

0 comments on commit 3f152fb

Please sign in to comment.