fix stuff I broke

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-12-07 10:10:09 +01:00
parent 75d4cdb40b
commit 526cadcd09
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
5 changed files with 40 additions and 18 deletions

View File

@ -56,7 +56,6 @@ SHARED_APPS = [
"django_tenants", "django_tenants",
"authentik.tenants", "authentik.tenants",
"daphne", "daphne",
"django.contrib.contenttypes",
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
"django.contrib.humanize", "django.contrib.humanize",
@ -68,6 +67,7 @@ SHARED_APPS = [
] ]
TENANT_APPS = [ TENANT_APPS = [
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions", "django.contrib.sessions",
"authentik.admin", "authentik.admin",
"authentik.api", "authentik.api",

View File

@ -39,6 +39,7 @@ class TenantSerializer(ModelSerializer):
"tenant_uuid", "tenant_uuid",
"schema_name", "schema_name",
"name", "name",
"ready",
] ]
@ -111,7 +112,7 @@ class SettingsSerializer(ModelSerializer):
class SettingsView(RetrieveUpdateAPIView): class SettingsView(RetrieveUpdateAPIView):
"""Settings view""" """Settings view"""
queryset = Tenant.objects.all() queryset = Tenant.objects.filter(ready=True)
serializer_class = SettingsSerializer serializer_class = SettingsSerializer
permission_classes = [IsAdminUser] permission_classes = [IsAdminUser]
filter_backends = [] filter_backends = []

View File

@ -4,19 +4,10 @@ from rest_framework.test import APITransactionTestCase
class TenantAPITestCase(APITransactionTestCase): class TenantAPITestCase(APITransactionTestCase):
# Overridden to force TRUNCATE CASCADE # Overridden to also remove additional schemas we may have created
def _fixture_teardown(self): def _fixture_teardown(self):
super()._fixture_teardown()
for db_name in self._databases_names(include_mirrors=False): 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: with connections[db_name].cursor() as cursor:
cursor.execute( cursor.execute(
"SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname !~ 'pg_*' AND nspname != 'information_schema' AND nspname != 'public' AND nspname != 'template'" "SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname !~ 'pg_*' AND nspname != 'information_schema' AND nspname != 'public' AND nspname != 'template'"

View File

@ -2908,6 +2908,10 @@
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"title": "Name" "title": "Name"
},
"ready": {
"type": "boolean",
"title": "Ready"
} }
}, },
"required": [] "required": []

View File

@ -6374,6 +6374,11 @@ paths:
name: action name: action
schema: schema:
type: string type: string
- in: query
name: brand_name
schema:
type: string
description: Brand name
- in: query - in: query
name: client_ip name: client_ip
schema: schema:
@ -6410,11 +6415,6 @@ paths:
description: A search term. description: A search term.
schema: schema:
type: string type: string
- in: query
name: tenant_name
schema:
type: string
description: Tenant name
- in: query - in: query
name: username name: username
schema: schema:
@ -33502,6 +33502,10 @@ components:
type: string type: string
icon: icon:
type: string 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 readOnly: true
server_uri: server_uri:
type: string type: string
@ -34691,6 +34695,10 @@ components:
type: string type: string
icon: icon:
type: string 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 readOnly: true
provider_type: provider_type:
$ref: '#/components/schemas/ProviderTypeEnum' $ref: '#/components/schemas/ProviderTypeEnum'
@ -38773,6 +38781,8 @@ components:
name: name:
type: string type: string
minLength: 1 minLength: 1
ready:
type: boolean
PatchedTokenRequest: PatchedTokenRequest:
type: object type: object
description: Token Serializer description: Token Serializer
@ -39099,6 +39109,10 @@ components:
type: string type: string
icon: icon:
type: string 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 readOnly: true
client_id: client_id:
type: string type: string
@ -41045,6 +41059,10 @@ components:
type: string type: string
icon: icon:
type: string 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 readOnly: true
pre_authentication_flow: pre_authentication_flow:
type: string type: string
@ -41778,6 +41796,10 @@ components:
type: string type: string
icon: icon:
type: string 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 readOnly: true
required: required:
- component - component
@ -42180,6 +42202,8 @@ components:
maxLength: 63 maxLength: 63
name: name:
type: string type: string
ready:
type: boolean
required: required:
- name - name
- schema_name - schema_name
@ -42195,6 +42219,8 @@ components:
name: name:
type: string type: string
minLength: 1 minLength: 1
ready:
type: boolean
required: required:
- name - name
- schema_name - schema_name