Set row level security rules

Learn how to set RLS rules. When rule-based row level security (RLS) is set, it prevents users from seeing data they shouldn’t in tables and the objects derived from them.

You must have administrative rights on ThoughtSpot to set RLS rules.

Before you create a rule, make sure you have read How rule-based RLS works.

Administrators can bypass the RLS rules set on a table at the worksheet level.

Create a rule on a table

You can set RLS rules only on tables. To set up rule-based row level security, do the following:

  1. Click Data, and double-click a table.

  2. Click Row security.

  3. Click + Add row security.

    Click + add row security

    The system displays the Rule Builder.

    Rule builder

    You define row level security by creating an expression that gets evaluated for every row and group combination. This powerful feature can be used with up to thousands of groups.

  4. Open the Rule Builder.

  5. Give your rule a name.

  6. Enter an expression for your rule.

    The rule gets evaluated against an authenticated user for every row and group combination. If the rule evaluates to FALSE, the user cannot see that row’s data. Instead, they see the message No data to display. Use the variable ts_groups to refer to the group name.

    rls enter expression

    You can see a list of available operators by clicking on Rule Assistant.

    Rule assistant

    As you type, ThoughtSpot suggests formula syntax, variables, and column names. If you can’t remember the exact column name or variable you want to use, the suggestions can help.

    When your expression is valid, a green indicator appears at the bottom of the Rule Builder.

    RLS rules do not support use of aggregate functions.
  7. Click Save.

  8. If your rule involves another table, and there are multiple joins between that other table and the table the rule is on, ThoughtSpot asks you to choose one of the join paths after you save the rule.

    Define RLS join mapping
  9. Select Save.

  10. The rule you created appears in the list of Row Security rules. To edit the rule, select it in the list, and make any changes.

  11. If your rule involves another table, and there are multiple joins between that other table and the table the rule is on, you can edit the join path you chose at any time. Select the icon in the upper left corner of the modal. If you hover over it, the icon says "Change how the join rule affects Row Level Security."

    Change how the join rule affects Row Level Security
  12. To add more rules, select + Add.

Test your rule with restricted and unrestricted users

To test your rule, log in as users in different groups. Search within the table for data that your test user can and can’t access. Make sure your test users can see the appropriate rows.


Related information


Was this page helpful?