How to restrict data access per customer in an embedded dashboard?
To restrict data access per customer in an embedded dashboard, use Draxlr's row-level security (RLS). You set the rules up once, and they apply to every dashboard you embed.
Here's how it works:
- Create a permission that chooses which tables the embed can use and adds a row rule, such as
account_idequals theaccountIdattribute. - Attach the permission to an RLS group, for example
Customers. - When a signed-in customer opens the page, your backend requests the embed token and sends the group name and that customer's values, such as
"rlsGroup": "Customers"and"attributes": { "accountId": 42 }.
Draxlr applies the rule to every query behind the embed, including filters, drill-downs, and exports. Tables the permission doesn't allow aren't available at all. Because the values come from your server in a signed token, a customer can't change them in the browser to see another customer's data.
Row-level security for embeds is included on the Power plan and above. The RLS guide covers setting up permissions and groups.
For how this row-level security pattern compares with schema-per-tenant and tenant-object approaches in other tools, see our comparison of row, schema and database isolation models.
For the underlying patterns, see how PostgreSQL row-level security works for multi-tenant analytics and how to sign embed tokens without leaking tenant data.