Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to implement permissions for a multi tenant application? #686

Open
KIC opened this issue Oct 15, 2024 · 1 comment
Open

Question: How to implement permissions for a multi tenant application? #686

KIC opened this issue Oct 15, 2024 · 1 comment

Comments

@KIC
Copy link

KIC commented Oct 15, 2024

This is a great tool and takes away the burden of creating tons of reports for individual clients but just letting them make their own reports. However, there is also my point. How am I supposed to manage the fact that one client should only see his data? Is there some hook where I could change the query?

Another way would be to provide the queries and disallow the edit, but then there one would need a way to inject the current user as immutable variable. If there is currently no way to inject the user as fixed variable and since it is open source, where would you add (allow) such a feature to be added?

@chrisclark
Copy link
Collaborator

The app isn't really designed for multi-tenancy and there isn't a simple way to do this. For example, you would have to filter querylogs, connections, etc.

If you were only trying to display the results to particular users, that is (in theory) supported via the EXPLORER_GET_USER_QUERY_VIEWS settings, which you can set to a dictionary like:

{
userid1: [queryid1, queryid2],
userid2: [queryid2, queryid3]
}

It's a bit clunky in that you would likely have to modify the code each time you needed a permission change. You can see more how it is implemented here:

https://github.com/explorerhq/sql-explorer/blob/master/explorer/utils.py#L165

Let me know if that helps...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants