Update targets to new listing method (#2045)

This uses the prefetch method to fetch resource IDs and validate them
for authz by the user before then fetching the full list of targets.
This commit is contained in:
Jeff Mitchell authored and Timothy Messier committed 2022-04-29 16:33:44 -04:00
1 parent 21b0d584ad
commit 4cf2a87e8d
8 files changed
+150 -23

No files matched your search

+1 -1
View File
@@ -220,7 +220,7 @@ func (r *Repository) FetchAuthzProtectedEntitiesByScope(ctx context.Context, sco
return nil, errors.New(ctx, errors.InvalidParameter, op, "no scopes given")
case 1:
inClauseCnt += 1
where, args = fmt.Sprintf("where scope_id = @%d", inClauseCnt), append(args, sql.Named("1", scopeIds[0]))
where, args = fmt.Sprintf("where scope_id = @%d", inClauseCnt), append(args, sql.Named(fmt.Sprintf("%d", inClauseCnt), scopeIds[0]))
default:
idsInClause := make([]string, 0, len(scopeIds))
for _, id := range scopeIds {