How to add role based access control to your app?
Role-Based Access Control (RBAC) is giving people keys to only the rooms they need in a building. Instead of every employee getting access everywhere, they get access based on their job role—so a receptionist can open the front desk, but not the server room. This keeps things secure and organized while making sure everyone has what they need to do their work.
Add role-based access to my app.
Requirements:
– Supabase schema: `profiles (id, email, role [admin|user|guest])`.
– Protect `/admin` route: visible only to `role=admin`.
– Frontend: conditional rendering for nav items based on role.
– Include UI to assign roles from admin dashboard.
– Show "Access Denied" message for unauthorized users.
– Output: complete RBAC system with routes + UI protection.
