bug: fix list target permissions resource ID overriding all resource grants (#5877)

* fix list target not handling all resources permissions

* add test

* fix same bug for session package

* split target tests to two separate tests
This commit is contained in:
Sorawis Nilparuk (Bo) authored and GitHub committed 2025-06-23 14:03:33 -07:00
1 parent 1e15db51cb
commit ee26fefc5e
4 files changed
+91 -10

No files matched your search

+1 -1
View File
@@ -100,7 +100,7 @@ func (r *Repository) listPermissionWhereClauses() ([]string, []any) {
clauses = append(clauses, fmt.Sprintf("project_id = @project_id_%d", inClauseCnt))
args = append(args, sql.Named(fmt.Sprintf("project_id_%d", inClauseCnt), p.GrantScopeId))
if len(p.ResourceIds) > 0 {
if len(p.ResourceIds) > 0 && !p.All {
clauses = append(clauses, fmt.Sprintf("public_id = any(@public_id_%d)", inClauseCnt))
args = append(args, sql.Named(fmt.Sprintf("public_id_%d", inClauseCnt), "{"+strings.Join(p.ResourceIds, ",")+"}"))
}