stages/invitation: fix wrong serializer used for user model
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
4e5eeacf0a
commit
9171bd6d6f
|
@ -3,6 +3,7 @@ from rest_framework.fields import JSONField
|
||||||
from rest_framework.serializers import ModelSerializer
|
from rest_framework.serializers import ModelSerializer
|
||||||
from rest_framework.viewsets import ModelViewSet
|
from rest_framework.viewsets import ModelViewSet
|
||||||
|
|
||||||
|
from authentik.core.api.users import UserSerializer
|
||||||
from authentik.core.api.utils import is_dict
|
from authentik.core.api.utils import is_dict
|
||||||
from authentik.flows.api.stages import StageSerializer
|
from authentik.flows.api.stages import StageSerializer
|
||||||
from authentik.stages.invitation.models import Invitation, InvitationStage
|
from authentik.stages.invitation.models import Invitation, InvitationStage
|
||||||
|
@ -29,6 +30,7 @@ class InvitationStageViewSet(ModelViewSet):
|
||||||
class InvitationSerializer(ModelSerializer):
|
class InvitationSerializer(ModelSerializer):
|
||||||
"""Invitation Serializer"""
|
"""Invitation Serializer"""
|
||||||
|
|
||||||
|
created_by = UserSerializer(read_only=True)
|
||||||
fixed_data = JSONField(validators=[is_dict], required=False)
|
fixed_data = JSONField(validators=[is_dict], required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -40,7 +42,6 @@ class InvitationSerializer(ModelSerializer):
|
||||||
"fixed_data",
|
"fixed_data",
|
||||||
"created_by",
|
"created_by",
|
||||||
]
|
]
|
||||||
depth = 2
|
|
||||||
|
|
||||||
|
|
||||||
class InvitationViewSet(ModelViewSet):
|
class InvitationViewSet(ModelViewSet):
|
||||||
|
|
221
swagger.yaml
221
swagger.yaml
|
@ -18017,226 +18017,7 @@ definitions:
|
||||||
title: Fixed data
|
title: Fixed data
|
||||||
type: object
|
type: object
|
||||||
created_by:
|
created_by:
|
||||||
required:
|
$ref: '#/definitions/User'
|
||||||
- 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
|
|
||||||
InvitationStage:
|
InvitationStage:
|
||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
|
|
Reference in a new issue