diff --git a/x/acp/keeper/query_access_decision.go b/x/acp/keeper/query_access_decision.go index e4a9e00..a7b44b3 100644 --- a/x/acp/keeper/query_access_decision.go +++ b/x/acp/keeper/query_access_decision.go @@ -10,12 +10,12 @@ import ( "github.com/sourcenetwork/sourcehub/x/acp/types" ) -func (k Keeper) AccessDecision(goCtx context.Context, req *types.QueryAccessDecisionRequest) (*types.QueryAccessDecisionResponse, error) { +func (q Querier) AccessDecision(goCtx context.Context, req *types.QueryAccessDecisionRequest) (*types.QueryAccessDecisionResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - repository := k.GetAccessDecisionRepository(ctx) + repository := q.GetAccessDecisionRepository(ctx) decision, err := repository.Get(goCtx, req.Id) if err != nil { diff --git a/x/acp/keeper/query_filter_relationships.go b/x/acp/keeper/query_filter_relationships.go index 02204dc..e0fedf2 100644 --- a/x/acp/keeper/query_filter_relationships.go +++ b/x/acp/keeper/query_filter_relationships.go @@ -11,13 +11,13 @@ import ( "github.com/sourcenetwork/sourcehub/x/acp/types" ) -func (k Keeper) FilterRelationships(goCtx context.Context, req *types.QueryFilterRelationshipsRequest) (*types.QueryFilterRelationshipsResponse, error) { +func (q Querier) FilterRelationships(goCtx context.Context, req *types.QueryFilterRelationshipsRequest) (*types.QueryFilterRelationshipsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - engine, err := k.GetACPEngine(ctx) + engine, err := q.GetACPEngine(ctx) if err != nil { return nil, err } diff --git a/x/acp/keeper/query_validate_policy.go b/x/acp/keeper/query_validate_policy.go index 7bc64a9..436c4d7 100644 --- a/x/acp/keeper/query_validate_policy.go +++ b/x/acp/keeper/query_validate_policy.go @@ -9,9 +9,9 @@ import ( "github.com/sourcenetwork/sourcehub/x/acp/types" ) -func (k Keeper) ValidatePolicy(goCtx context.Context, req *types.QueryValidatePolicyRequest) (*types.QueryValidatePolicyResponse, error) { +func (q Querier) ValidatePolicy(goCtx context.Context, req *types.QueryValidatePolicyRequest) (*types.QueryValidatePolicyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - engine, err := k.GetACPEngine(ctx) + engine, err := q.GetACPEngine(ctx) if err != nil { return nil, err } diff --git a/x/acp/keeper/query_verify_access_request.go b/x/acp/keeper/query_verify_access_request.go index 6681b98..929f136 100644 --- a/x/acp/keeper/query_verify_access_request.go +++ b/x/acp/keeper/query_verify_access_request.go @@ -13,13 +13,13 @@ import ( "github.com/sourcenetwork/sourcehub/x/acp/types" ) -func (k Keeper) VerifyAccessRequest(goCtx context.Context, req *types.QueryVerifyAccessRequestRequest) (*types.QueryVerifyAccessRequestResponse, error) { +func (q Querier) VerifyAccessRequest(goCtx context.Context, req *types.QueryVerifyAccessRequestRequest) (*types.QueryVerifyAccessRequestResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - engine, err := k.GetACPEngine(ctx) + engine, err := q.GetACPEngine(ctx) if err != nil { return nil, err } @@ -27,9 +27,8 @@ func (k Keeper) VerifyAccessRequest(goCtx context.Context, req *types.QueryVerif actorId := req.AccessRequest.Actor.Id addr, err := sdk.AccAddressFromBech32(actorId) if err == nil { - // this means the actor ID is a cosmos account - // so convert it to a did - acc := k.accountKeeper.GetAccount(ctx, addr) + // this means the actor ID is a cosmos account, so convert it to a did + acc := q.accountKeeper.GetAccount(ctx, addr) if acc == nil { return nil, errors.Wrap("verify access request: could not produce did for actor", errors.ErrorType_BAD_INPUT, errors.Pair("actorId", actorId)) } diff --git a/x/acp/keeper/query_verify_access_request_test.go b/x/acp/keeper/query_verify_access_request_test.go index 60e815f..45e7e6c 100644 --- a/x/acp/keeper/query_verify_access_request_test.go +++ b/x/acp/keeper/query_verify_access_request_test.go @@ -59,7 +59,8 @@ resources: } func TestVerifyAccessRequest_QueryingObjectsTheActorHasAccessToReturnsTrue(t *testing.T) { - ctx, keeper, pol, creator := setupTestVerifyAccessRequest(t) + ctx, k, pol, creator := setupTestVerifyAccessRequest(t) + querier := NewQuerier(k) req := &types.QueryVerifyAccessRequestRequest{ PolicyId: pol.Id, @@ -79,7 +80,7 @@ func TestVerifyAccessRequest_QueryingObjectsTheActorHasAccessToReturnsTrue(t *te }, }, } - result, err := keeper.VerifyAccessRequest(ctx, req) + result, err := querier.VerifyAccessRequest(ctx, req) want := &types.QueryVerifyAccessRequestResponse{ Valid: true, @@ -89,7 +90,8 @@ func TestVerifyAccessRequest_QueryingObjectsTheActorHasAccessToReturnsTrue(t *te } func TestVerifyAccessRequest_QueryingOperationActorIsNotAuthorizedReturnNotValid(t *testing.T) { - ctx, keeper, pol, creator := setupTestVerifyAccessRequest(t) + ctx, k, pol, creator := setupTestVerifyAccessRequest(t) + querier := NewQuerier(k) req := &types.QueryVerifyAccessRequestRequest{ PolicyId: pol.Id, @@ -105,7 +107,7 @@ func TestVerifyAccessRequest_QueryingOperationActorIsNotAuthorizedReturnNotValid }, }, } - result, err := keeper.VerifyAccessRequest(ctx, req) + result, err := querier.VerifyAccessRequest(ctx, req) want := &types.QueryVerifyAccessRequestResponse{ Valid: false, @@ -115,7 +117,8 @@ func TestVerifyAccessRequest_QueryingOperationActorIsNotAuthorizedReturnNotValid } func TestVerifyAccessRequest_QueryingObjectThatDoesNotExistReturnValidFalse(t *testing.T) { - ctx, keeper, pol, creator := setupTestVerifyAccessRequest(t) + ctx, k, pol, creator := setupTestVerifyAccessRequest(t) + querier := NewQuerier(k) req := &types.QueryVerifyAccessRequestRequest{ PolicyId: pol.Id, @@ -131,7 +134,7 @@ func TestVerifyAccessRequest_QueryingObjectThatDoesNotExistReturnValidFalse(t *t }, }, } - result, err := keeper.VerifyAccessRequest(ctx, req) + result, err := querier.VerifyAccessRequest(ctx, req) want := &types.QueryVerifyAccessRequestResponse{ Valid: false,