What sort of hook would you be imagining? The DB connection stuff is deep inside Django itself, rather than in Channels, so I'm not sure what sensible top-level thing we could provide that would make sense.
Andrew On Tue, Nov 13, 2018 at 2:16 PM <lorin...@gmail.com> wrote: > Django-tenants is a package to provide multi-tenancy in Django through > Postgres schemas (https://github.com/tomturner/django-tenants/) > > Django-tenants relies on setting the schema on the connection in order to > make queries to the right Postgres schema. When you want to secure your > consumers with user permissions, django-tenants needs to be properly routed > in order to retrieve the right users from database, otherwise the user in > scope is not properly populated for permission checking. > > In order to overcome this, I have redefined (in a not DRY way, aka > copy/paste) `get_user`, `TenantAuthMiddleware` and > `TenantAuthMiddlewareStack`, just because I basically need to wrap > `get_user` inside `with scope["tenant"]` (provided I put the tenant in the > scope before, in a custom router.) > > Is there any way to provide a hook so this can be achieved in a DRY way? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/c547563c-a8a6-416c-bf59-54907f512c77%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/c547563c-a8a6-416c-bf59-54907f512c77%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1uraywimYgY4BmsqxMf8n921WJ0-ZZLLLNJYcd%3D%3Dpaz%3DOA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.