Skip to content

Fixes #39394 - Handle empty taxonomy scopes in authorizer - #11172

Open
jakduch wants to merge 1 commit into
theforeman:developfrom
jakduch:fix/39394
Open

Fixes #39394 - Handle empty taxonomy scopes in authorizer#11172
jakduch wants to merge 1 commit into
theforeman:developfrom
jakduch:fix/39394

Conversation

@jakduch

@jakduch jakduch commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Non-admin users with only an organization or only a location assigned could receive a 500 response when listing taxable resources.

An empty taxonomy intersection was represented as a contradictory Scoped Search expression using set? and null?. Unlike regular has-many conditions, Scoped Search does not wrap these operators in a subquery, leaving a direct reference to the taxonomies table after the eager-loads were removed in #39209.

Represent empty taxonomy intersections as no access and let the authorizer add an explicit false SQL condition. Filters without an overlapping taxonomy are skipped individually in the non-granular path.

This preserves the duplicate-result fix from #39209 without restoring the removed taxonomy eager-loads.

Testing

  • Ruby syntax checks pass for all changed files
  • Foreman RuboCop passes for all changed files
  • Regression tests cover users without organizations and users without locations

AI usage disclosure

Per the community discussion on AI policy, the issue was investigated and the changes, tests, and PR wording were prepared with the assistance of Codex 5.6 Sol High. The resulting changes were reviewed before submitting. The commit also includes an Assisted-By trailer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant