3 ms·
Nope. Quoting the article itself: "In the traditional use case of direct db access, RLS works by defining policies on tables that filter rows based on the cur
by rst 4y ago
Nope. Quoting the article itself:
"In the traditional use case of direct db access, RLS works by defining policies on tables that filter rows based on the current db user. For a SaaS application, however, defining a new db user for each app user is clunky. For an application use case you can dynamically set and retrieve users using Postgres’ current_settings() function ( i.e:
SET app.current_app_user = ‘usr_123’
and
SELECT current_settings(‘app.current_app_user)
)."
The policies that they define reference these settings, so they can do a "set" at the start of processing every web request, on a pre-existing db connection.