Multi-tenant data isolation with PostgreSQL Row Level Security #4326
Replies: 2 comments
-
Hello Kevin, Can use the adonis event |
Beta Was this translation helpful? Give feedback.
-
@vitortoigo Do you have a code sample for how you implemented this? I'm trying to implement in postgres: {
client: 'pg',
connection: {
host: env.get('DB_HOST'),
port: env.get('DB_PORT'),
user: env.get('DB_USER'),
password: env.get('DB_PASSWORD'),
database: env.get('DB_DATABASE'),
},
pool: {
afterCreate(conn, done) {
const ctx = HttpContext.getOrFail()
conn.query(
`SET app.current_organization_id = '${ctx.auth?.user?.currentOrganizationId}';`
)
done()
},
},
}, |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm starting a new projet with multi-tenant data isolation with Postgres RLS.
Has anyone implemented this with Adonis yet ?
I'll share my work here if someone is interested.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions