fix: correct where statement for AppByOIDCClientID (#4815)

Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
Stefan Benz 2022-12-02 13:15:09 +00:00 committed by GitHub
parent e7137dba60
commit add232d1dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -429,18 +429,17 @@ func (q *Queries) AppByClientID(ctx context.Context, clientID string, withOwnerR
defer func() { span.EndWithError(err) }()
stmt, scan := prepareAppQuery()
var eq []sq.Sqlizer
eq = append(eq, sq.And{
sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()},
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
if !withOwnerRemoved {
eq[AppColumnOwnerRemoved.identifier()] = false
}
query, args, err := stmt.Where(sq.And{
eq,
sq.Or{
sq.Eq{AppOIDCConfigColumnClientID.identifier(): clientID},
sq.Eq{AppAPIConfigColumnClientID.identifier(): clientID},
},
})
if !withOwnerRemoved {
eq = append(eq, sq.Eq{AppColumnOwnerRemoved.identifier(): false})
}
query, args, err := stmt.Where(eq).ToSql()
}).ToSql()
if err != nil {
return nil, errors.ThrowInternal(err, "QUERY-Dfge2", "Errors.Query.SQLStatement")
}