Skip to content

Commit

Permalink
Create default tenant for newly created social users
Browse files Browse the repository at this point in the history
  • Loading branch information
wojcikmat committed May 22, 2024
1 parent 774650c commit 9d50efd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/backend/apps/multitenancy/pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .models import Tenant


def create_default_tenant(user=None, is_new=False, *args, **kwargs):
if user and is_new:
Tenant.objects.get_or_create_user_default_tenant(user)
1 change: 1 addition & 0 deletions packages/backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'apps.multitenancy.pipeline.create_default_tenant',
'social_core.pipeline.user.user_details',
)
SOCIAL_AUTH_ALLOWED_REDIRECT_HOSTS = env.list('SOCIAL_AUTH_ALLOWED_REDIRECT_HOSTS', default=[])
Expand Down

0 comments on commit 9d50efd

Please sign in to comment.