mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
fix: handle possible nil pointer of query (#1407)
This commit is contained in:
@@ -2,6 +2,7 @@ package admin
|
||||
|
||||
import (
|
||||
member_grpc "github.com/caos/zitadel/internal/api/grpc/member"
|
||||
"github.com/caos/zitadel/internal/api/grpc/object"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/iam/model"
|
||||
admin_pb "github.com/caos/zitadel/pkg/grpc/admin"
|
||||
@@ -22,10 +23,11 @@ func UpdateIAMMemberToDomain(req *admin_pb.UpdateIAMMemberRequest) *domain.Membe
|
||||
}
|
||||
|
||||
func ListIAMMemberRequestToModel(req *admin_pb.ListIAMMembersRequest) *model.IAMMemberSearchRequest {
|
||||
offset, limit, asc := object.ListQueryToModel(req.Query)
|
||||
return &model.IAMMemberSearchRequest{
|
||||
Offset: req.Query.Offset,
|
||||
Limit: uint64(req.Query.Limit),
|
||||
Asc: req.Query.Asc,
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
Asc: asc,
|
||||
// SortingColumn: model.IAMMemberSearchKey, //TOOD: not implemented in proto
|
||||
Queries: member_grpc.MemberQueriesToIAMMember(req.Queries),
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package admin
|
||||
|
||||
import (
|
||||
idp_grpc "github.com/caos/zitadel/internal/api/grpc/idp"
|
||||
"github.com/caos/zitadel/internal/api/grpc/object"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
@@ -50,10 +51,11 @@ func updateOIDCConfigToDomain(req *admin_pb.UpdateIDPOIDCConfigRequest) *domain.
|
||||
}
|
||||
|
||||
func listIDPsToModel(req *admin_pb.ListIDPsRequest) *iam_model.IDPConfigSearchRequest {
|
||||
offset, limit, asc := object.ListQueryToModel(req.Query)
|
||||
return &iam_model.IDPConfigSearchRequest{
|
||||
Offset: req.Query.Offset,
|
||||
Limit: uint64(req.Query.Limit),
|
||||
Asc: req.Query.Asc,
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
Asc: asc,
|
||||
SortingColumn: idp_grpc.FieldNameToModel(req.SortingColumn),
|
||||
Queries: idpQueriesToModel(req.Queries),
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/api/grpc/object"
|
||||
policy_grpc "github.com/caos/zitadel/internal/api/grpc/policy"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/iam/model"
|
||||
@@ -18,10 +19,11 @@ func updateLoginPolicyToDomain(p *admin_pb.UpdateLoginPolicyRequest) *domain.Log
|
||||
}
|
||||
|
||||
func ListLoginPolicyIDPsRequestToModel(req *admin_pb.ListLoginPolicyIDPsRequest) *model.IDPProviderSearchRequest {
|
||||
offset, limit, asc := object.ListQueryToModel(req.Query)
|
||||
return &model.IDPProviderSearchRequest{
|
||||
Offset: req.Query.Offset,
|
||||
Limit: uint64(req.Query.Limit),
|
||||
Asc: req.Query.Asc,
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
Asc: asc,
|
||||
// SortingColumn: model.IDPProviderSearchKey, //TODO: not in proto
|
||||
// Queries: []*model.IDPProviderSearchQuery, //TODO: not in proto
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/api/grpc/object"
|
||||
org_grpc "github.com/caos/zitadel/internal/api/grpc/org"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/org/model"
|
||||
@@ -8,14 +9,15 @@ import (
|
||||
)
|
||||
|
||||
func listOrgRequestToModel(req *admin.ListOrgsRequest) (*model.OrgSearchRequest, error) {
|
||||
offset, limit, asc := object.ListQueryToModel(req.Query)
|
||||
queries, err := org_grpc.OrgQueriesToModel(req.Queries)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &model.OrgSearchRequest{
|
||||
Offset: req.Query.Offset,
|
||||
Limit: uint64(req.Query.Limit),
|
||||
Asc: req.Query.Asc,
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
Asc: asc,
|
||||
Queries: queries,
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user