mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 18:44:06 +00:00
776 B
776 B
PostgreSQL RLS Reference
Use this when implementing single-database PostgreSQL row-level security.
Source Files
src/Bootstrappers/PostgresRLSBootstrapper.phpsrc/RLS/*src/Database/Concerns/RLSModel.phpsrc/Commands/CreateUserWithRLSPolicies.phptests/RLS/*
Config
rls.managerrls.user.usernamerls.user.passwordrls.session_variable_namePostgresRLSBootstrapperinbootstrappers
Command
php artisan tenants:rls
php artisan tenants:rls --force
Rules
- Use PostgreSQL and single-database tenancy.
- Session variable name must be namespaced, for example
my.current_tenant. - RLS user is one tenant database user for all tenants, not one user per tenant.
- Test policies on every tenant-owned table.