Caseworker Access Fix
Source: `docs/security/CASEWORKER_ACCESS_FIX.md`View on GitHub
Caseworker Access Fix
Date: November 24, 2025
Issue: Caseworkers could not see clients they created through the intake form
Last verified against code: 2025-02-03
Problem Summary
Caseworkers saw no clients on /clients after creating households via intake because households were created without org_id, and RLS filters by org_id for caseworkers.
Root Causes
- Missing Organization Association — Intake submit API was not setting
org_idandcreated_byfrom the authenticated user's profile. - Missing Update Policy — No RLS UPDATE policy allowed caseworkers to update clients in their org.
Changes Made
- Intake submission route (
app/api/intake/submit/route.ts) — Capture authenticated user'sorg_idand setorg_id,created_by, andintake_methodon household insert. - Migration
DATABASE_MIGRATION_ADD_CASEWORKER_CLIENT_UPDATE.sql— ADD policy so caseworkers can UPDATE clients in their org.
Related
Use links in each imported doc to open its source.