Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-11-21 18:31:39 +01:00
parent d0a8919fc0
commit 742dc12656
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
3 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@ class TestUsersAvatars(APITestCase):
self.user = User.objects.create(username="test-user") self.user = User.objects.create(username="test-user")
def set_avatar_mode(self, mode: str): def set_avatar_mode(self, mode: str):
"""Set the avatar mode on the current tenant."""
tenant = get_current_tenant() tenant = get_current_tenant()
tenant.avatars = mode tenant.avatars = mode
tenant.save() tenant.save()

View File

@ -11,7 +11,6 @@ from rest_framework.serializers import BaseSerializer
from structlog import get_logger from structlog import get_logger
from authentik.core.models import ExpiringModel from authentik.core.models import ExpiringModel
from authentik.lib.config import CONFIG
from authentik.lib.models import SerializerModel from authentik.lib.models import SerializerModel
from authentik.lib.utils.http import get_client_ip from authentik.lib.utils.http import get_client_ip
from authentik.policies.models import Policy from authentik.policies.models import Policy

View File

@ -5,7 +5,7 @@ from django.db.models.signals import post_migrate
from authentik.blueprints.apps import ManagedAppConfig from authentik.blueprints.apps import ManagedAppConfig
def reconcile_default_tenant(using=DEFAULT_DB_ALIAS, *args, **kwargs): def reconcile_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
"""Make sure default tenant exists""" """Make sure default tenant exists"""
from authentik.tenants.models import Tenant from authentik.tenants.models import Tenant
@ -24,5 +24,6 @@ class AuthentikTenantsConfig(ManagedAppConfig):
default = True default = True
def reconcile_default_tenant(self): def reconcile_default_tenant(self):
"""Make sure default tenant exists, especially after a migration"""
reconcile_default_tenant() reconcile_default_tenant()
post_migrate.connect(reconcile_default_tenant) post_migrate.connect(reconcile_default_tenant)