Skip to content

Scope court report download and generation to the user's visible cases - #7405

Open
compwron wants to merge 1 commit into
mainfrom
fix/court-report-case-scope
Open

compwron wants to merge 1 commit into
mainfrom
fix/court-report-case-scope

Conversation

@compwron

Copy link
Copy Markdown
Collaborator

What

CaseCourtReportsController#show and #generate now resolve the case through policy_scope(CasaCase): admins and supervisors get their org's cases, volunteers get only cases they are actively assigned to. A case that is not yours answers exactly like one that does not exist (same redirect / same 404 JSON), and a volunteer who was unassigned can no longer regenerate that case's latest report.

Tests

New request specs for unassigned and deactivated volunteers, same-org supervisor (still allowed), other-org supervisor, and identical responses for not-yours vs. unknown. 4 of them fail without the fix. spec/requests/case_court_reports_spec.rb: 37 examples, 0 failures.

🤖 Generated with Claude Code

@github-actions github-actions Bot added 🧪 Tests Tests ruby Touches Ruby code labels Nov 16, 2026
show and generate looked the case up by number within the org, so any
volunteer could download the stored report of a case they were not assigned
to, and a formerly assigned volunteer could regenerate it. Resolve the case
through policy_scope(CasaCase) so volunteers only reach actively assigned
cases, and 'not yours' answers exactly like 'not found'.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@compwron
compwron force-pushed the fix/court-report-case-scope branch from 31de5d7 to cd55bcd Compare November 16, 2026 09:01

This branch has not been deployed

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

Labels

ruby Touches Ruby code 🧪 Tests Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant