You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-08-08 22:36:41 +02:00
issue#7 fix applyClaimsSelect when empty conditions
When audience and subject are both empty, don't apply a subquery
This commit is contained in:
@ -87,10 +87,12 @@ func applyClaimsSelect(ctx context.Context, claims auth.Claims, query *sqlbuilde
|
||||
if claims.Subject != "" {
|
||||
or = append(or, subQuery.Equal("user_id", claims.Subject))
|
||||
}
|
||||
subQuery.Where(subQuery.Or(or...))
|
||||
|
||||
// Append sub query
|
||||
query.Where(query.In("id", subQuery))
|
||||
if len(or) > 0 {
|
||||
subQuery.Where(subQuery.Or(or...))
|
||||
query.Where(query.In("id", subQuery))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user