From 810c04bacf6a6144af1153cac451e365b8f28cbd Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 19 Aug 2022 11:26:15 +0100 Subject: [PATCH] blueprints: don't suggest models not inheriting serializermodel in schema Signed-off-by: Jens Langhammer --- .../management/commands/make_blueprint_schema.py | 3 +++ blueprints/schema.json | 12 ------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/authentik/blueprints/management/commands/make_blueprint_schema.py b/authentik/blueprints/management/commands/make_blueprint_schema.py index d5c65b762..30a1a64ce 100644 --- a/authentik/blueprints/management/commands/make_blueprint_schema.py +++ b/authentik/blueprints/management/commands/make_blueprint_schema.py @@ -7,6 +7,7 @@ from django.core.management.base import BaseCommand, no_translations from structlog.stdlib import get_logger from authentik.blueprints.v1.importer import is_model_allowed +from authentik.lib.models import SerializerModel LOGGER = get_logger() @@ -31,5 +32,7 @@ class Command(BaseCommand): for model in apps.get_models(): if not is_model_allowed(model): continue + if SerializerModel not in model.__mro__: + continue model_names.append(f"{model._meta.app_label}.{model._meta.model_name}") self.schema["properties"]["entries"]["items"]["properties"]["model"]["enum"] = model_names diff --git a/blueprints/schema.json b/blueprints/schema.json index 41a86f14c..f1cc431ed 100644 --- a/blueprints/schema.json +++ b/blueprints/schema.json @@ -48,9 +48,6 @@ "model": { "type": "string", "enum": [ - "auth.permission", - "contenttypes.contenttype", - "sessions.session", "authentik_crypto.certificatekeypair", "authentik_events.event", "authentik_events.notificationtransport", @@ -114,15 +111,6 @@ "authentik_stages_user_write.userwritestage", "authentik_tenants.tenant", "authentik_blueprints.blueprintinstance", - "guardian.userobjectpermission", - "guardian.groupobjectpermission", - "otp_static.staticdevice", - "otp_static.statictoken", - "otp_totp.totpdevice", - "silk.request", - "silk.response", - "silk.sqlquery", - "silk.profile", "authentik_core.group", "authentik_core.user", "authentik_core.application",