fix: list IDPs on Org (#3141)

* fix: idp query

* fix: remove failed events
This commit is contained in:
Livio Amstutz 2022-02-01 08:32:59 +01:00 committed by GitHub
parent 694af4bebc
commit bf6cb59b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 8 deletions

View File

@ -91,15 +91,11 @@ func listIDPsToModel(ctx context.Context, req *mgmt_pb.ListOrgIDPsRequest) (quer
if err != nil {
return nil, err
}
iamQuery, err := query.NewIDPIDSearchQuery(domain.IAMID)
resourceOwnerQuery, err := query.NewIDPResourceOwnerListSearchQuery(domain.IAMID, authz.GetCtxData(ctx).OrgID)
if err != nil {
return nil, err
}
resourceOwnerQuery, err := query.NewIDPResourceOwnerSearchQuery(authz.GetCtxData(ctx).OrgID)
if err != nil {
return nil, err
}
q = append(q, resourceOwnerQuery, iamQuery)
q = append(q, resourceOwnerQuery)
return &query.IDPSearchQueries{
SearchRequest: query.SearchRequest{
Offset: offset,

View File

@ -76,7 +76,9 @@ func (q *Queries) RemoveFailedEvent(ctx context.Context, projectionName string,
Where(sq.Eq{
failedEventsColumnProjectionName: projectionName,
failedEventsColumnFailedSequence: sequence,
}).ToSql()
}).
PlaceholderFormat(sq.Dollar).
ToSql()
if err != nil {
return errors.ThrowInternal(err, "QUERY-DGgh3", "Errors.RemoveFailed")
}

View File

@ -7,11 +7,12 @@ import (
"time"
sq "github.com/Masterminds/squirrel"
"github.com/lib/pq"
"github.com/caos/zitadel/internal/crypto"
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/query/projection"
"github.com/lib/pq"
)
type IDP struct {
@ -239,6 +240,14 @@ func NewIDPResourceOwnerSearchQuery(value string) (SearchQuery, error) {
return NewTextQuery(IDPResourceOwnerCol, value, TextEquals)
}
func NewIDPResourceOwnerListSearchQuery(ids ...string) (SearchQuery, error) {
list := make([]interface{}, len(ids))
for i, value := range ids {
list[i] = value
}
return NewListQuery(IDPResourceOwnerCol, list, ListIn)
}
func (q *IDPSearchQueries) toQuery(query sq.SelectBuilder) sq.SelectBuilder {
query = q.SearchRequest.toQuery(query)
for _, q := range q.Queries {