Permissions model
Goal
Understand how BlueMatrix authorizes staff actions with permission keys, roles, modules, and token abilities.
Who it is for
Tenant admins configuring access; managers diagnosing “I cannot see / do X”.
Preconditions
member.viewto browse members;member.adminto edit Advanced catalogs;role.manageto open Members setup, read catalogs, and create roles (wizard or matrix).
How it works
- Permission keys live in
Permissions::catalogue()(e.g.sales.view,sales.manage,sales.post). - Roles (Owner, Admin, Manager, Member, CRM Member, plus custom) grant keys. Owner effectively has
*. - Modules gate entire areas: frontend
meta.module/auth.hasModule; API disabled module → 422. - SPA checks:
auth.can(key)hides nav and actions; failingmeta.permissionredirects to dashboard (not a 403 page). - API checks: controllers call
$this->authorize(…)→ 403 when denied. - Tenancy: Sanctum ability
tenant:{uuid}; never trust body/querytenant_id. Cross-tenant rows → 404 (RLS).
Steps (admin)
- Open Members → Members setup.
- Use Create role for a guided job + capabilities role (
role.managecan load the catalogs), or Advanced to curate templates and packs. - Adjust the Permission matrix for custom roles.
- Assign roles on memberships; ask the user to refresh / re-login if keys changed.
Result
Users only see and call what their membership allows; optional modules stay dark when entitlement is off.
Hard stops
Missing member.admin blocks matrix edits; confusing 403 (no permission) with 404 (hidden/other tenant) and 422 (module/business rule).