From 9171bd6d6f28aa840d8e53a21cc6b9897f01c82f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 12 May 2021 13:36:19 +0200 Subject: [PATCH] stages/invitation: fix wrong serializer used for user model Signed-off-by: Jens Langhammer --- authentik/stages/invitation/api.py | 3 +- swagger.yaml | 221 +---------------------------- 2 files changed, 3 insertions(+), 221 deletions(-) diff --git a/authentik/stages/invitation/api.py b/authentik/stages/invitation/api.py index b1ce74cd5..6702a18b4 100644 --- a/authentik/stages/invitation/api.py +++ b/authentik/stages/invitation/api.py @@ -3,6 +3,7 @@ from rest_framework.fields import JSONField from rest_framework.serializers import ModelSerializer from rest_framework.viewsets import ModelViewSet +from authentik.core.api.users import UserSerializer from authentik.core.api.utils import is_dict from authentik.flows.api.stages import StageSerializer from authentik.stages.invitation.models import Invitation, InvitationStage @@ -29,6 +30,7 @@ class InvitationStageViewSet(ModelViewSet): class InvitationSerializer(ModelSerializer): """Invitation Serializer""" + created_by = UserSerializer(read_only=True) fixed_data = JSONField(validators=[is_dict], required=False) class Meta: @@ -40,7 +42,6 @@ class InvitationSerializer(ModelSerializer): "fixed_data", "created_by", ] - depth = 2 class InvitationViewSet(ModelViewSet): diff --git a/swagger.yaml b/swagger.yaml index a505326de..cdd4149c8 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -18017,226 +18017,7 @@ definitions: title: Fixed data type: object created_by: - required: - - password - - username - - name - type: object - properties: - id: - title: ID - type: integer - readOnly: true - password: - title: Password - type: string - maxLength: 128 - minLength: 1 - last_login: - title: Last login - type: string - format: date-time - x-nullable: true - username: - title: Username - description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_ - only. - type: string - pattern: ^[\w.@+-]+$ - maxLength: 150 - minLength: 1 - first_name: - title: First name - type: string - maxLength: 150 - last_name: - title: Last name - type: string - maxLength: 150 - email: - title: Email address - type: string - format: email - maxLength: 254 - is_active: - title: Active - description: Designates whether this user should be treated as active. - Unselect this instead of deleting accounts. - type: boolean - date_joined: - title: Date joined - type: string - format: date-time - uuid: - title: Uuid - type: string - format: uuid - readOnly: true - name: - title: Name - description: User's display name. - type: string - minLength: 1 - password_change_date: - title: Password change date - type: string - format: date-time - readOnly: true - attributes: - title: Attributes - type: object - groups: - type: array - items: - required: - - name - type: object - properties: - id: - title: ID - type: integer - readOnly: true - name: - title: Name - type: string - maxLength: 150 - minLength: 1 - permissions: - type: array - items: - type: integer - uniqueItems: true - readOnly: true - user_permissions: - type: array - items: - required: - - name - - codename - - content_type - type: object - properties: - id: - title: ID - type: integer - readOnly: true - name: - title: Name - type: string - maxLength: 255 - minLength: 1 - codename: - title: Codename - type: string - maxLength: 100 - minLength: 1 - content_type: - title: Content type - type: integer - readOnly: true - sources: - type: array - items: - required: - - name - - slug - type: object - properties: - pbm_uuid: - title: Pbm uuid - type: string - format: uuid - readOnly: true - policy_engine_mode: - title: Policy engine mode - type: string - enum: - - all - - any - managed: - title: Managed by authentik - description: Objects which are managed by authentik. These objects - are created and updated automatically. This is flag only indicates - that an object can be overwritten by migrations. You can still - modify the objects via the API, but expect changes to be overwritten - in a later update. - type: string - minLength: 1 - x-nullable: true - name: - title: Name - description: Source's display Name. - type: string - minLength: 1 - slug: - title: Slug - description: Internal source name, used in URLs. - type: string - format: slug - pattern: ^[-a-zA-Z0-9_]+$ - maxLength: 50 - minLength: 1 - enabled: - title: Enabled - type: boolean - authentication_flow: - title: Authentication flow - description: Flow to use when authenticating existing users. - type: string - format: uuid - x-nullable: true - enrollment_flow: - title: Enrollment flow - description: Flow to use when enrolling new users. - type: string - format: uuid - x-nullable: true - policies: - type: array - items: - type: string - format: uuid - readOnly: true - uniqueItems: true - property_mappings: - type: array - items: - type: string - format: uuid - uniqueItems: true - readOnly: true - ak_groups: - type: array - items: - required: - - name - - parent - type: object - properties: - group_uuid: - title: Group uuid - type: string - format: uuid - readOnly: true - name: - title: Name - type: string - maxLength: 80 - minLength: 1 - is_superuser: - title: Is superuser - description: Users added to this group will be superusers. - type: boolean - attributes: - title: Attributes - type: object - parent: - title: Parent - type: string - format: uuid - x-nullable: true - readOnly: true - readOnly: true + $ref: '#/definitions/User' InvitationStage: required: - name