#Postgres RLS in Laravel

3 messages · Page 1 of 1 (latest)

copper sundial
#

Is there a convention about how to use row-level security polices (postgresql feature) to isolate a multi-tenancy app in Laravel?

I've seen a solution setting the tenant_id in a middleware, but it doesn't solve for scheduled jobs.

mystic hazel
#

Perhaps use a job middleware? Thing is, a job/scheduler doesn't know anything about a tenant, so you'd need to isolate things then

copper sundial
#

Just realized that as I'm using spatie/laravel-multitenancy, I might need just create a "task" to set the db parameter right after make the current tenant. Since the package already handle the queue tenant awareness, it should work. Need to test.