I am using the newest version of superset and it has the row-level security option in the UI. Can anyone help me and let me know or give a little walk through that how can I implement it in the UI and use it. There is hardly much documentation there.
Row level security essentially works like a WHERE clause. Let's assume that we build a dashboard using table called tbl_org
that look likes:
manager_name department agent
Jim Sales Agent 1
Jim Sales Agent 2
Jack HR Agent 3
Jack HR Agent 4
Say, we need to show Jim only the rows/records where he is a manager on the dashboard when he logs in. The same for Jack. This is when RLS is useful.
The Superset UI provides three fields that need to be filled.
tbl_org
manager_name = Jim
this will result in the query: SELECT * from tbl_org where manager_name = Jim
If you want dynamically filter the table based on the user who logs in you can use a jinja template:
manager_name = '{{current_username()}}'
For this, the usernames created in Superset need to match the manager_name
column in tbl_org