blueprints: don't suggest models not inheriting serializermodel in schema
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
b624bf1cb7
commit
810c04bacf
|
@ -7,6 +7,7 @@ from django.core.management.base import BaseCommand, no_translations
|
||||||
from structlog.stdlib import get_logger
|
from structlog.stdlib import get_logger
|
||||||
|
|
||||||
from authentik.blueprints.v1.importer import is_model_allowed
|
from authentik.blueprints.v1.importer import is_model_allowed
|
||||||
|
from authentik.lib.models import SerializerModel
|
||||||
|
|
||||||
LOGGER = get_logger()
|
LOGGER = get_logger()
|
||||||
|
|
||||||
|
@ -31,5 +32,7 @@ class Command(BaseCommand):
|
||||||
for model in apps.get_models():
|
for model in apps.get_models():
|
||||||
if not is_model_allowed(model):
|
if not is_model_allowed(model):
|
||||||
continue
|
continue
|
||||||
|
if SerializerModel not in model.__mro__:
|
||||||
|
continue
|
||||||
model_names.append(f"{model._meta.app_label}.{model._meta.model_name}")
|
model_names.append(f"{model._meta.app_label}.{model._meta.model_name}")
|
||||||
self.schema["properties"]["entries"]["items"]["properties"]["model"]["enum"] = model_names
|
self.schema["properties"]["entries"]["items"]["properties"]["model"]["enum"] = model_names
|
||||||
|
|
|
@ -48,9 +48,6 @@
|
||||||
"model": {
|
"model": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"auth.permission",
|
|
||||||
"contenttypes.contenttype",
|
|
||||||
"sessions.session",
|
|
||||||
"authentik_crypto.certificatekeypair",
|
"authentik_crypto.certificatekeypair",
|
||||||
"authentik_events.event",
|
"authentik_events.event",
|
||||||
"authentik_events.notificationtransport",
|
"authentik_events.notificationtransport",
|
||||||
|
@ -114,15 +111,6 @@
|
||||||
"authentik_stages_user_write.userwritestage",
|
"authentik_stages_user_write.userwritestage",
|
||||||
"authentik_tenants.tenant",
|
"authentik_tenants.tenant",
|
||||||
"authentik_blueprints.blueprintinstance",
|
"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.group",
|
||||||
"authentik_core.user",
|
"authentik_core.user",
|
||||||
"authentik_core.application",
|
"authentik_core.application",
|
||||||
|
|
Reference in a new issue