-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Adds multitenancy support #180
base: master
Are you sure you want to change the base?
Conversation
Why: * When building an admin dashboard is not always true that: 1. There is only one repo 2. The repo is not dynamic This change addresses the need by: * Adding a resource level repo config that can be set when creating the resources list, to allow for multiple repos. It defaults to the ecto repo config in the env. * Adding a new configurable function called `set_dynamic_repo`, which takes the connection as based on that it will set the dynamic repo. Since the dynamic repo is set per process, this is done on every controller action, so that we can ensure it is set properly. An example of this could be by setting a cookie with the tenant, which a plug can assign to the connection and have the `set_dynamic_repo` use that to decide what to do. * Adding a new form of extension called navigation extras, which allows adding html to the top navigation. This can be used by, for example, having a select with the multiple tenants
Hey @zamith |
Great to hear that you're interested. I have this working on a project already and can try to provide some examples of how the integration looks like if you need it, even though the project is private. |
hi @zamith I know it has been a while since you opened this PR. I am wondering would you be able to share examples of integration for the multi tenant application? Some background: I opened a new question here #251 that might be related to this PR. The use case I have is a B2B startup where each team will have access to data within that organization and I also need to let team members create different environments such as Dev, Test etc. |
Hi, Would you be so kind as to do this again to the master branch? Thanks, |
Why:
When building an admin dashboard is not always true that:
This change addresses the need by:
resources list, to allow for multiple repos. It defaults to the ecto
repo config in the env.
set_dynamic_repo
, whichtakes the connection as based on that it will set the dynamic repo.
Since the dynamic repo is set per process, this is done on every
controller action, so that we can ensure it is set properly. An
example of this could be by setting a cookie with the tenant, which a
plug can assign to the connection and have the
set_dynamic_repo
usethat to decide what to do.
adding html to the top navigation. This can be used by, for example,
having a select with the multiple tenants
This changes quite a few things and I don't expect you to agree with all
the decisions, but it should allow us to get the conversation going at least.
I'm not super familiar with kaffy's codebase, but I tried to leverage as much
of the existing API as possible and ensure that no existing configuration
need to change.
Tries to solve #179.