Multi-tenant access controls
Manage access across all of your users, tables, and columns.
If your database is a multi-tenant architecture, you can specify row-level policies over your tables in the ‘Access controls’ page located in your data source settings. You can define granular access controls across all of your users by using these row-level policies.
How do row-level policies work?
You are able to define row level policies for each of your tables using the same SQL dialect as your data source (i.e. BigQuery, Postgres, MySQL, etc.).
When Buster generates a query, we parse that query and deterministically apply your row-level filters as Common Table Expressions (CTEs). These filtered queries are built after the query has been validated and just before the query is sent to your database or warehouse. This ensures that User A only has access to User A’s data, User B to User B’s data, etc.
You are able to define dynamic variables that will be injected into your policy. These variables are the access variables
you assign during user creation.
Access variables
Access variables are dynamic variables assigned during user creation that are used to filter the data that is returned to the user.
Here is an example of access variables for a user from a CRM database:
These variables are injected into your row-level policies and are used to filter the data that is returned to the user.
How to write a row-level policy
Here are the steps to write a perfect row level policy:
-
All policies must start with
SELECT * FROM table_name_here
.We do not actually use aSELECT *
. This serves as a placeholder for Buster. -
Do not use aliases for columns or tables in the policy.
-
You are free to write any policy that is syntactically correct for the data source you are onboarding.
-
Wrap your access variables with the
{ }
curly braces in the query.
Example of a row-level policy
If I had a table called customers
and each user should only see the rows where their unique identifier matches the id
column, then I would go about creating a user and writing the policy as follows:
-
Define the row level policy for the
customers
table: -
Create your user:
-
Your user can now ask questions and the row level policies will automatically be applied.
Was this page helpful?