bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.46k stars 424 forks source link

How to set schema based on request.user? #586

Closed rajesh188 closed 5 years ago

rajesh188 commented 5 years ago

I have 'user','tenant' apps in SHAREDAPPS and I want to set schema to currently logged in user so that current tenant cannot see other tenant data .

What I'm trying to do is have one website where I can register new users and login existing users and upon user registration/login create/set schema to request.user how do I achieve this ?

I tried this setup Shared apps ( tenant_schemas,tenants,users,allauth.account,# other django stuff), Tenant apps(#all tenant specific apps)

But this does not achieve tenant isolation as they can login to other tenants and view their data.

How do I make tenants to only login to see their data