Tableau Row Level Security Reference
There are many options to implement row level security:
- ISMEMBEROF as data source filter or workbook filter
- USERNAME() x-db join with user entitlement table outside main data source (v10 feature) - can be either data source filter or workbook filter
- USERNAME() data source blending with user entitlement table outside main data source - can be either data source filter or workbook filter
- USERNAME() x-db filter with user entitlement table outside main data source (v10 feature)
- Query banding for TeraData DB that has both user entitlement and main data source
- Initial SQL for Vertica, Oracle, SQL Server, Sybase ASE, Redshift etc where DB has both user entitlement and main data source
Key Takeaways
1.Tableau row level security works for extracts
2.Multiple options available for Tableau row level security
3.Use published data sources to integrate row level security
Data security has been one of the top concerns for Tableau enterprise adoption. Tableau handles data security by permission and row level security. Permission controls what workbooks/views an user can see. Row level security controls what data sets this user can see. For example APAC users see APAC sales, EMEA users see EMEA sales only while both APAC and EMEA users have the same permission to the same workbook.
Does Tableau row level security works with extracts? Yes. This blog provides everything you need to know to create row level security controls for extracts and live connections, includes a new approach leveraging V10 x-db join features.
Use case : To create one workbook that server users can see subset of the data based on their Region (Central, East, South and West) and segments (Consumer, Corporate and Home Office) they are assigned to.
Solution A – Workbook filter for Row Level Security by Group
- Create following 12 Tableau server groups (Central-Consumer, Central-Corporate, Central-HomeOffice, East-Consumer, East-Corporate, East-HomeOffice,….). Central-Consumer group has all the Central region users who are assigned to Consumer segment….
- Create calculated field
- ISMEMBEROF(‘Central-Consumer’) AND [Region] = ‘Central’ AND [Segment] = ‘Consumer’ OR
- ISMEMBEROF(‘Central-Coporate’) AND [Region] = ‘Central’ AND [Segment] = ‘Coporate’ OR
- ISMEMBEROF(‘Central-HomeOffice’) AND [Region] = ‘Central’ AND [Segment] = ‘HomeOffice’ OR
- ISMEMBEROF(‘West-Consumer’) AND [Region] = ‘West’ AND [Segment] = ‘Consumer’ OR
- ISMEMBEROF(‘West-Coporate’) AND [Region] = ‘West’ AND [Segment] = ‘Coporate’ OR
- ISMEMBEROF(‘West-HomeOffice’) AND [Region] = ‘West’ AND [Segment] = ‘HomeOffice’ OR
- ISMEMBEROF(‘East-Consumer’) AND [Region] = ‘East’ AND [Segment] = ‘Consumer’ OR
- ISMEMBEROF(‘East-Coporate’) AND [Region] = ‘East’ AND [Segment] = ‘Coporate’ OR
- ISMEMBEROF(‘East-HomeOffice’) AND [Region] = ‘East’ AND [Segment] = ‘HomeOffice’ OR
- ISMEMBEROF(‘South-Consumer’) AND [Region] = ‘South’ AND [Segment] = ‘Consumer’ OR
- ISMEMBEROF(‘South-Coporate’) AND [Region] = ‘South’ AND [Segment] = ‘Coporate’ OR
- ISMEMBEROF(‘South-HomeOffice’) AND [Region] = ‘South’ AND [Segment] = ‘HomeOffice’
- Add the calculated field to filter and select ‘true’
- After publish the workbook, set interactor permission to all the above 12 groups.
- Make sure Web Editing as No, Download as No.
That is all. ISMEMBEROF returns true if server current user is member of given group. ISMEMBEROF is the key function to use here. It works for both extracts and live connection.
Notice that the control is a workbook filter. If workbook is downloaded, filter can be changed so the row level security will not work anymore, which is why workbook permission has to set download permission as No.
The better solution is to use data source filter for ISMEMBEROF calculation instead of workbook filter
Solution B – Data Source Filter for Row Level Security by Group
- You have the groups and calculated field from Solution A step 1 and step 2
- Edit data source filters to include the calculated field and select ‘true’
- Publish the data sources and set connect only permission (no edit)
- After publish the workbook, set permission to all the above 12 groups. There is no need to put the above calculated field to workbook filter anymore since filter is at data source level now.
Published data sources are reusable, single source of truth, less loads to data sources and now you have governed row level security built-in.
The Solution B works extracts. The only thing is that it is little tricky during workbook development process where you will need to make local extract local copy to simulate the user behavior from Desktop, and replace data sources from local to server published data source before publish the workbook, you will need to copy & paste all calculations.
The above approaches control user’s visibility of data sets by Tableau server groups. It assumes that you will manage the group members outside Tableau. When have too many data security groups to manage manaually, you can automate the group member creation by using Server REST API or your corp directory automation tool.
When group approach in Solution A & B can’t scale, the following USERNAME() approach will be another good option.
Solution C – Entitlement table x-db join for Row Level Security
Same use case but you want to add category as dimension for row level security in additional to Region and Segment. Now you will need 100+ groups just for row level security purpose which can be a lot to manage. We are going to use Tableau’s USERNAME() function which returns current server user name.