Supabase: Administrator sees record, user not — RLS diagnosis
After logging in as an administrator, everything works, but a regular employee doesn't see the cases assigned to him.
Why is this happening?
The administrator panel may use another query or privileged context; the normal user is subject to JWT-dependent policies and record data.
Step by step solution
1. Identify the exact record that should be visible and the account that has access to it.
2 . Compare queries in both views and actual assignment field values.
3 . Check JWT claims and functions used in RLS policies. Do not base the authorization on the role label written only in localStorage.
4 . Test positive and negative access under test accounts.
5 . Add query diagnostic log without storing private customer fields.
How do I check the score?
The authorized employee sees the case after new login, and the unauthorised cannot even read it through direct API.
Do not transfer service role to frontend code. This key bypasses the standard RLS rules.