Menu

Post image 1
Post image 2
1 / 2
0

Hardcoding roles is a silent killer for SaaS scalability.

DEV Community·Supto Khan·about 1 month ago
#k8o6xEqs
#laravel#saas#web3#react#hotel#multi
Reading 0:00
15s threshold

When building JoRooms—a multi-tenant hotel booking ecosystem—we faced a challenge: How do we manage access for Super Admins, Hotel Managers, and Agents without creating a "spaghetti" of if/else statements? The answer: Dynamic Role-Based Access Control (RBAC) using Spatie Laravel Permission. 🛠 The Architecture We didn’t just want "Fixed Roles." We built a Flexible Role Engine where permissions are granular, and roles are simply "containers" for those permissions. The Tech Stack: Backend: Laravel & Spatie (The Source of Truth) Logic: Laravel Policies (For multi-tenant hotel_id scoping) Frontend: React (Conditional Rendering based on the User's Permission Snapshot) 🔑 Key Implementation Highlights The Permissions Matrix Instead of checking if($user->isManager()), we check if($user->can('manage-rooms')). This decouples the identity from the action. Multi-Tenant Scoping (The "Hotel Boundary") A manager at Hotel A should never edit rooms at Hotel B.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More