Skip to content

Commit

Permalink
fix(region): shareable virtual resource query (#21596)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Nov 14, 2024
1 parent 7b6bdcb commit af51bfc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/cloudcommon/db/sharablebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,17 @@ func SharableManagerFilterByOwner(ctx context.Context, manager IStandaloneModelM
))
}
if !result.ProjectTags.IsEmpty() && resScope == rbacscope.ScopeProject {
subq := manager.Query("id")
policyTagFilters := tagutils.STagFilters{}
policyTagFilters.AddFilters(result.ProjectTags)
q = ObjectIdQueryWithTagFilters(ctx, q, "tenant_id", "project", policyTagFilters)
subq = ObjectIdQueryWithTagFilters(ctx, subq, "tenant_id", "project", policyTagFilters)
q = q.Filter(sqlchemy.OR(
sqlchemy.In(q.Field("id"), subq.SubQuery()),
sqlchemy.AND(
sqlchemy.IsTrue(q.Field("is_public")),
sqlchemy.Equals(q.Field("public_scope"), rbacscope.ScopeSystem),
),
))
}
if !result.ObjectTags.IsEmpty() {
policyTagFilters := tagutils.STagFilters{}
Expand Down

0 comments on commit af51bfc

Please sign in to comment.