diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py index 01f895c44..980408a4e 100644 --- a/authentik/core/api/propertymappings.py +++ b/authentik/core/api/propertymappings.py @@ -22,6 +22,7 @@ from authentik.core.expression import PropertyMappingEvaluator from authentik.core.models import PropertyMapping from authentik.lib.templatetags.authentik_utils import verbose_name from authentik.lib.utils.reflection import all_subclasses +from authentik.managed.api import ManagedSerializer from authentik.policies.api.exec import PolicyTestSerializer @@ -32,7 +33,7 @@ class PropertyMappingTestResultSerializer(PassiveSerializer): successful = BooleanField(read_only=True) -class PropertyMappingSerializer(ModelSerializer, MetaNameSerializer): +class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSerializer): """PropertyMapping Serializer""" object_type = SerializerMethodField() @@ -52,6 +53,7 @@ class PropertyMappingSerializer(ModelSerializer, MetaNameSerializer): model = PropertyMapping fields = [ "pk", + "managed", "name", "expression", "object_type", diff --git a/authentik/core/api/tokens.py b/authentik/core/api/tokens.py index f4ee86451..2681a39b6 100644 --- a/authentik/core/api/tokens.py +++ b/authentik/core/api/tokens.py @@ -13,9 +13,10 @@ from authentik.core.api.users import UserSerializer from authentik.core.api.utils import PassiveSerializer from authentik.core.models import Token from authentik.events.models import Event, EventAction +from authentik.managed.api import ManagedSerializer -class TokenSerializer(ModelSerializer): +class TokenSerializer(ManagedSerializer, ModelSerializer): """Token Serializer""" user = UserSerializer(required=False) @@ -25,6 +26,7 @@ class TokenSerializer(ModelSerializer): model = Token fields = [ "pk", + "managed", "identifier", "intent", "user", diff --git a/authentik/managed/api.py b/authentik/managed/api.py new file mode 100644 index 000000000..d519c38e5 --- /dev/null +++ b/authentik/managed/api.py @@ -0,0 +1,10 @@ +"""Serializer mixin for managed models""" +from rest_framework.fields import CharField + +from authentik.core.api.utils import PassiveSerializer + + +class ManagedSerializer(PassiveSerializer): + """Managed Serializer""" + + managed = CharField(read_only=True, allow_null=True) diff --git a/swagger.yaml b/swagger.yaml index fd51c3569..c7c74ffa7 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -14876,6 +14876,12 @@ definitions: type: string format: uuid readOnly: true + managed: + title: Managed + type: string + readOnly: true + minLength: 1 + x-nullable: true identifier: title: Identifier type: string @@ -16534,6 +16540,12 @@ definitions: type: string format: uuid readOnly: true + managed: + title: Managed + type: string + readOnly: true + minLength: 1 + x-nullable: true name: title: Name type: string @@ -16578,6 +16590,12 @@ definitions: type: string format: uuid readOnly: true + managed: + title: Managed + type: string + readOnly: true + minLength: 1 + x-nullable: true name: title: Name type: string @@ -16614,6 +16632,12 @@ definitions: type: string format: uuid readOnly: true + managed: + title: Managed + type: string + readOnly: true + minLength: 1 + x-nullable: true name: title: Name type: string @@ -16654,6 +16678,12 @@ definitions: type: string format: uuid readOnly: true + managed: + title: Managed + type: string + readOnly: true + minLength: 1 + x-nullable: true name: title: Name type: string