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

Accessing tenants data from public. #671

Open
PathakHarsh opened this issue Aug 24, 2021 · 1 comment
Open

Accessing tenants data from public. #671

PathakHarsh opened this issue Aug 24, 2021 · 1 comment

Comments

@PathakHarsh
Copy link

Suppose I have two tenants.
First is on domain 'user1.localhost'
and the second is on domain 'user2.localhost'

When I am using public schema (localhost:8000),In my views,I want to get the data from the tenant schemas.How can I achieve this ?

@tarsilcol
Copy link

So what I did was this:

  1. Created a table that maps a user of the system with a Tenant (Client)
  2. When a Client is created, I associate with a user
  3. Query that table to know which tenants are associated with the given logged in user
  4. Use that information to pass in the HEADER when querying

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