Skip to main content

D5 — RLS manager + session variable

Architecture decision record, relocated verbatim from the retired single-file docs/tenancy/ decision log. Status, thematic clusters, and how to record a new ADR: the decision log index.

  • Manager: TableRLSManager (auto FK traversal; no model trait required).
  • Session variable: stables.current_tenant (namespaced; immutable once policies are generated — baked into every policy body).
  • php artisan tenants:rls runs after every migration that touches tenant tables, and in CI/CD as migrate --force && tenants:rls (both as the central role).

← Decision log index