Lookup Tables for RLS

Row level security filters with any user attribute.

A lookup table allows you to use more user attributes for row level security filtering. For example, without a lookup table you can only use an email field for row level security. By defining a lookup table with user information, you will be able to use any attribute in the table as the RLS filter.

A lookup table can be defined for each of your datasources. The email field is a must have on your lookup table.

Let’s look at an example lookup table.

user_id name email role region
101 User1 user1@acme.com engineer east
102 User2 user2@acme.com sales west
103 User3 user3@acme.com desginer central
104 User4 user4@acme.com engineer east
105 User5 user5@acme.com engineer west

Specifying a lookup table for a datasource

  1. Visit the datasource page on the Zing console.
  2. Click on the Settings button on your datasource.
  3. Turn on the toggle for Row Level Security.
  4. Select the table you want to set as the lookup table for the datasource and the email field in that table.
  5. Now you can specify any filter on your charts/tables as mentioned here using the attributes in your lookup table. For example, if you want to apply the RLS filter on the user’s ID, the filter on the WHERE condition should be {{zing.user.user_id}}. Filtering by the region would be possible by specifying the filter as {{zing.user.region}}.