managed: add API serializer, add managed field
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
75d67e0e05
commit
742f570c4c
|
@ -22,6 +22,7 @@ from authentik.core.expression import PropertyMappingEvaluator
|
||||||
from authentik.core.models import PropertyMapping
|
from authentik.core.models import PropertyMapping
|
||||||
from authentik.lib.templatetags.authentik_utils import verbose_name
|
from authentik.lib.templatetags.authentik_utils import verbose_name
|
||||||
from authentik.lib.utils.reflection import all_subclasses
|
from authentik.lib.utils.reflection import all_subclasses
|
||||||
|
from authentik.managed.api import ManagedSerializer
|
||||||
from authentik.policies.api.exec import PolicyTestSerializer
|
from authentik.policies.api.exec import PolicyTestSerializer
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ class PropertyMappingTestResultSerializer(PassiveSerializer):
|
||||||
successful = BooleanField(read_only=True)
|
successful = BooleanField(read_only=True)
|
||||||
|
|
||||||
|
|
||||||
class PropertyMappingSerializer(ModelSerializer, MetaNameSerializer):
|
class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSerializer):
|
||||||
"""PropertyMapping Serializer"""
|
"""PropertyMapping Serializer"""
|
||||||
|
|
||||||
object_type = SerializerMethodField()
|
object_type = SerializerMethodField()
|
||||||
|
@ -52,6 +53,7 @@ class PropertyMappingSerializer(ModelSerializer, MetaNameSerializer):
|
||||||
model = PropertyMapping
|
model = PropertyMapping
|
||||||
fields = [
|
fields = [
|
||||||
"pk",
|
"pk",
|
||||||
|
"managed",
|
||||||
"name",
|
"name",
|
||||||
"expression",
|
"expression",
|
||||||
"object_type",
|
"object_type",
|
||||||
|
|
|
@ -13,9 +13,10 @@ from authentik.core.api.users import UserSerializer
|
||||||
from authentik.core.api.utils import PassiveSerializer
|
from authentik.core.api.utils import PassiveSerializer
|
||||||
from authentik.core.models import Token
|
from authentik.core.models import Token
|
||||||
from authentik.events.models import Event, EventAction
|
from authentik.events.models import Event, EventAction
|
||||||
|
from authentik.managed.api import ManagedSerializer
|
||||||
|
|
||||||
|
|
||||||
class TokenSerializer(ModelSerializer):
|
class TokenSerializer(ManagedSerializer, ModelSerializer):
|
||||||
"""Token Serializer"""
|
"""Token Serializer"""
|
||||||
|
|
||||||
user = UserSerializer(required=False)
|
user = UserSerializer(required=False)
|
||||||
|
@ -25,6 +26,7 @@ class TokenSerializer(ModelSerializer):
|
||||||
model = Token
|
model = Token
|
||||||
fields = [
|
fields = [
|
||||||
"pk",
|
"pk",
|
||||||
|
"managed",
|
||||||
"identifier",
|
"identifier",
|
||||||
"intent",
|
"intent",
|
||||||
"user",
|
"user",
|
||||||
|
|
|
@ -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)
|
30
swagger.yaml
30
swagger.yaml
|
@ -14876,6 +14876,12 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
managed:
|
||||||
|
title: Managed
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
|
minLength: 1
|
||||||
|
x-nullable: true
|
||||||
identifier:
|
identifier:
|
||||||
title: Identifier
|
title: Identifier
|
||||||
type: string
|
type: string
|
||||||
|
@ -16534,6 +16540,12 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
managed:
|
||||||
|
title: Managed
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
|
minLength: 1
|
||||||
|
x-nullable: true
|
||||||
name:
|
name:
|
||||||
title: Name
|
title: Name
|
||||||
type: string
|
type: string
|
||||||
|
@ -16578,6 +16590,12 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
managed:
|
||||||
|
title: Managed
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
|
minLength: 1
|
||||||
|
x-nullable: true
|
||||||
name:
|
name:
|
||||||
title: Name
|
title: Name
|
||||||
type: string
|
type: string
|
||||||
|
@ -16614,6 +16632,12 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
managed:
|
||||||
|
title: Managed
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
|
minLength: 1
|
||||||
|
x-nullable: true
|
||||||
name:
|
name:
|
||||||
title: Name
|
title: Name
|
||||||
type: string
|
type: string
|
||||||
|
@ -16654,6 +16678,12 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
managed:
|
||||||
|
title: Managed
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
|
minLength: 1
|
||||||
|
x-nullable: true
|
||||||
name:
|
name:
|
||||||
title: Name
|
title: Name
|
||||||
type: string
|
type: string
|
||||||
|
|
Reference in New Issue