Section 4 of 8 · Permission Matrix
Section 04

Role-Based Permission Matrix

All permissions are enforced server-side via the user_roles table and the has_role() security-definer function. RLS policies on every table check role membership before granting read or write access.

FFull (CRUD + admin)AApprove / verifyWRead + create/edit ownRRead only—No access
ModuleAdminGov OfficerVetFarmerBuyerRider
Users & RolesFR————
Farm VerificationFA—RR—
Own Farm — Animals / CropsRRRF——
Marketplace ListingsFR—WR—
Buyer Requests / OrdersFR—WFR
DeliveriesFR—RRW
Health Cases / VetRRFW——
Outbreak ReportsFFWR——
Finance — OwnR——FFF
Finance — AllR—————
Premium AI (gated)FF————
National AnalyticsFFR———
Demo Mode / ResetF—————
Security note: Roles are stored in public.user_roles (separate from profiles) to prevent privilege escalation. The has_role() function is SECURITY DEFINER with a fixed search_path, and all RLS policies use it instead of querying roles directly — eliminating recursive RLS bugs.