🗣️📊 SwiftQuery AI now lets you ask questions with natural language, or easily drag + drop →

Announcing Row Level Security - Quick Start

What is Row Level Security?

Row Level Security lets you filter data based on a user’s attributes so they see only specific records.

For instance, a sales team might want to have a dashboard which shows each salesperson the closed deals and quarterly goal relevant for that person, but not that of their colleagues. Or a retailer may wish to show store-level sales details for the manager of each store – without having to create one-off dashboards for each one.

This is done by applying the authorization context of the logged in user to the table, where certain records of the table will be restricted to the user if they are not supposed to view them. RLS would make sure that a user would not see data they don’t have permission to.

Without Row Level Security, customizing questions or dashboards per user can be time consuming and cumbersome because it would require copies of the same data or separate views created for each user.

With Row Level Security on Zing Data, we enable you to create a chart or dashboard which will show different results to different users based on what they are authorized to view.

Pre-requisites

Let’s have a look at how you can set up RLS with Zing.

The below requirements need to be fulfilled before you get started with RLS.

  1. Create an account in Zing through the Sign Up page. If you already have an account, you can login here. This can be done via our mobile app too.
  2. Create a datasource using the New Datasource button.
    • The table you plan on using for RLS should have an** email** field that you could apply RLS on.
    • If you need to use other user attributes for RLS filtering, your datasource should include a table with user data which we will join with other tables to filter results for the logged in user. Talk to our team to learn more about configuring this table.

Ask a Question with Row Level Security

  1. Visit the Zing web app or the mobile app.
  2. Click on sources on the navigation panel.
  3. Click on the datasource.
  4. Click on the table you want to ask the question from.
  5. You can create a question using the visual query builder or the custom SQL editor.
    • If you are using the visual query builder, select your fields for the chart/table and add the RLS filter on the user attribute field of your table. For example, the email field. The filter should be added as “When condition is met” = {{zing.user.email}}. Note the format here, which is important for the filter. Next, click on the Run Question button.
    • The same can be done using Custom SQL too. Click on the <> button on top of the screen, which will open the Custom SQL editor. Type in your query for the chart/table with a WHERE condition for the RLS filter. Next, click on the Run button. An example is shown below.

That’s it. You can setup RLS filtering with Zing in less than 5 minutes.

Results Comparison

Let’s consider this example on the visual query builder.

The above question does not have a RLS filter by email. The chart results would be as follows.

Let’s consider the same example with a RLS filter on the email.

The chart results will be filtered based on the logged in user’s email, in this case the email I have logged into Zing with.

Conclusion

Row Level Security is a powerful feature which allows you to manipulate chart results based on the person who is viewing the chart. Zing allows you to setup RLS very easily with no extra hassle. RLS can be enhanced based on your requirement. There are any use cases for RLS including filtering by user’s region, location, department, etc. It’s considered as one of the most important parts of a company’s data security strategy.

Our team is ready to guide you through the process and answer any questions you have about RLS. Feel free to reach out via hello@getzingdata.com.

Related articles

Download Zing For Free

Available on iOS, Android, and the web

Learn how Zing can help you and your organization collaborate with data

Schedule Demo