diff --git a/authentik/root/settings.py b/authentik/root/settings.py index a1d5999d5..c7a0be3af 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -56,7 +56,6 @@ SHARED_APPS = [ "django_tenants", "authentik.tenants", "daphne", - "django.contrib.contenttypes", "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.humanize", @@ -68,6 +67,7 @@ SHARED_APPS = [ ] TENANT_APPS = [ "django.contrib.auth", + "django.contrib.contenttypes", "django.contrib.sessions", "authentik.admin", "authentik.api", diff --git a/authentik/tenants/api.py b/authentik/tenants/api.py index b1166e489..98ed9d11a 100644 --- a/authentik/tenants/api.py +++ b/authentik/tenants/api.py @@ -39,6 +39,7 @@ class TenantSerializer(ModelSerializer): "tenant_uuid", "schema_name", "name", + "ready", ] @@ -111,7 +112,7 @@ class SettingsSerializer(ModelSerializer): class SettingsView(RetrieveUpdateAPIView): """Settings view""" - queryset = Tenant.objects.all() + queryset = Tenant.objects.filter(ready=True) serializer_class = SettingsSerializer permission_classes = [IsAdminUser] filter_backends = [] diff --git a/authentik/tenants/tests/utils.py b/authentik/tenants/tests/utils.py index 3d926f512..5f11bbfa3 100644 --- a/authentik/tenants/tests/utils.py +++ b/authentik/tenants/tests/utils.py @@ -4,19 +4,10 @@ from rest_framework.test import APITransactionTestCase class TenantAPITestCase(APITransactionTestCase): - # Overridden to force TRUNCATE CASCADE + # Overridden to also remove additional schemas we may have created def _fixture_teardown(self): + super()._fixture_teardown() for db_name in self._databases_names(include_mirrors=False): - call_command( - "flush", - verbosity=0, - interactive=False, - database=db_name, - reset_sequences=False, - allow_cascade=True, - inhibit_post_migrate=False, - ) - with connections[db_name].cursor() as cursor: cursor.execute( "SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname !~ 'pg_*' AND nspname != 'information_schema' AND nspname != 'public' AND nspname != 'template'" diff --git a/blueprints/schema.json b/blueprints/schema.json index 8c422ff34..7947e0153 100644 --- a/blueprints/schema.json +++ b/blueprints/schema.json @@ -2908,6 +2908,10 @@ "type": "string", "minLength": 1, "title": "Name" + }, + "ready": { + "type": "boolean", + "title": "Ready" } }, "required": [] diff --git a/schema.yml b/schema.yml index c33d37c56..d0a3e7570 100644 --- a/schema.yml +++ b/schema.yml @@ -6374,6 +6374,11 @@ paths: name: action schema: type: string + - in: query + name: brand_name + schema: + type: string + description: Brand name - in: query name: client_ip schema: @@ -6410,11 +6415,6 @@ paths: description: A search term. schema: type: string - - in: query - name: tenant_name - schema: - type: string - description: Tenant name - in: query name: username schema: @@ -33502,6 +33502,10 @@ components: type: string icon: type: string + nullable: true + description: |- + Get the URL to the Icon. If the name is /static or + starts with http it is returned as-is readOnly: true server_uri: type: string @@ -34691,6 +34695,10 @@ components: type: string icon: type: string + nullable: true + description: |- + Get the URL to the Icon. If the name is /static or + starts with http it is returned as-is readOnly: true provider_type: $ref: '#/components/schemas/ProviderTypeEnum' @@ -38773,6 +38781,8 @@ components: name: type: string minLength: 1 + ready: + type: boolean PatchedTokenRequest: type: object description: Token Serializer @@ -39099,6 +39109,10 @@ components: type: string icon: type: string + nullable: true + description: |- + Get the URL to the Icon. If the name is /static or + starts with http it is returned as-is readOnly: true client_id: type: string @@ -41045,6 +41059,10 @@ components: type: string icon: type: string + nullable: true + description: |- + Get the URL to the Icon. If the name is /static or + starts with http it is returned as-is readOnly: true pre_authentication_flow: type: string @@ -41778,6 +41796,10 @@ components: type: string icon: type: string + nullable: true + description: |- + Get the URL to the Icon. If the name is /static or + starts with http it is returned as-is readOnly: true required: - component @@ -42180,6 +42202,8 @@ components: maxLength: 63 name: type: string + ready: + type: boolean required: - name - schema_name @@ -42195,6 +42219,8 @@ components: name: type: string minLength: 1 + ready: + type: boolean required: - name - schema_name