A clinic can read only its own records.
Clinic isolation is enforced in the database. Staff permissions then control which parts of those records each role can open or change.
clinic_context = Anna NagarThe boundary is checked more than once.
Each request passes through the database policy, application role, transaction context and response field rules.
- Database1
Forced row-level security
A query without the clinic context returns no tenant records.
- Application2
No bypass role
The application role has no BYPASSRLS or schema-changing privileges.
- Request3
Clinic context per transaction
The clinic identifier is set inside the request transaction and cannot carry into the next request.
- Response4
Fields are allowlisted
Responses include only the fields allowed for that route and role.
Permissions follow the work people do.
Reception can manage appointments without opening clinical notes. A dentist can update treatment without changing branch settings.
Reads and changes leave an audit trail.
The audit view records who opened or changed a patient record and when the event occurred.