Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allowing users to only view data related to them in Apache Superset

I have some information related to different vendors in my database and I want to allow each registered vendor (representative person) to view slices/dashboards which contains only data related to them. One possible solution could be to create separate views for each vendor as well as separate roles for each vendor. But it feels like a bad idea if you have 100+ vendors (as is my case); and it's not a flexible or scalable solution. Is there some way to automatically filter a given view for each user? For example, we have a "general profit by product" bar chart, and user X can see only products of vendor X

like image 960
Alexandr Avatar asked Nov 28 '17 21:11

Alexandr


1 Answers

What you're looking for is multi-tenancy support, and this is not currently supported out-of-the-box in Superset.

There is however an open PR for one possible solution: https://github.com/apache/incubator-superset/pull/3729

One option could be to re-use and/or adapt that code for your use-case.

Another option might be to look into JINJA_CONTEXT_ADDONS [https://github.com/apache/incubator-superset/blob/master/docs/installation.rst#sql-lab] and see whether you might be able to pass additional context to your query (e.g. your vendor_id) and restrict the scope of your query using that parameter.

like image 65
David Tobiano Avatar answered Sep 27 '22 18:09

David Tobiano