fix: queries (#2548)

* fix(second_factors): correct query, rename method

* fix(multi_factors): correct query, correct naming

* fix(project_grant): add project_id to queries

* fix: simplify project id query constructor
This commit is contained in:
Silvan
2021-10-22 13:13:55 +02:00
committed by GitHub
parent b1caef81da
commit 22cfad8cb0
5 changed files with 59 additions and 34 deletions

View File

@@ -27,16 +27,16 @@ func (s *Server) ListProjectGrants(ctx context.Context, req *mgmt_pb.ListProject
return nil, err
}
queries.AppendMyResourceOwnerQuery(authz.GetCtxData(ctx).OrgID)
domains, err := s.query.SearchProjectGrants(ctx, queries)
grants, err := s.query.SearchProjectGrants(ctx, queries)
if err != nil {
return nil, err
}
return &mgmt_pb.ListProjectGrantsResponse{
Result: proj_grpc.GrantedProjectViewsToPb(domains.ProjectGrants),
Result: proj_grpc.GrantedProjectViewsToPb(grants.ProjectGrants),
Details: object_grpc.ToListDetails(
domains.Count,
domains.Sequence,
domains.Timestamp,
grants.Count,
grants.Sequence,
grants.Timestamp,
),
}, nil
}
@@ -57,11 +57,11 @@ func (s *Server) AddProjectGrant(ctx context.Context, req *mgmt_pb.AddProjectGra
}
func (s *Server) UpdateProjectGrant(ctx context.Context, req *mgmt_pb.UpdateProjectGrantRequest) (*mgmt_pb.UpdateProjectGrantResponse, error) {
userGrants, err := s.usergrant.UserGrantsByProjectAndGrantID(ctx, req.ProjectId, req.GrantId)
grants, err := s.usergrant.UserGrantsByProjectAndGrantID(ctx, req.ProjectId, req.GrantId)
if err != nil {
return nil, err
}
grant, err := s.command.ChangeProjectGrant(ctx, UpdateProjectGrantRequestToDomain(req), authz.GetCtxData(ctx).OrgID, userGrantsToIDs(userGrants)...)
grant, err := s.command.ChangeProjectGrant(ctx, UpdateProjectGrantRequestToDomain(req), authz.GetCtxData(ctx).OrgID, userGrantsToIDs(grants)...)
if err != nil {
return nil, err
}