core: fix user object for token not be setable
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
20d65035d5
commit
d79975c409
|
@ -23,7 +23,7 @@ from authentik.managed.api import ManagedSerializer
|
||||||
class TokenSerializer(ManagedSerializer, ModelSerializer):
|
class TokenSerializer(ManagedSerializer, ModelSerializer):
|
||||||
"""Token Serializer"""
|
"""Token Serializer"""
|
||||||
|
|
||||||
user = UserSerializer(required=False)
|
user_obj = UserSerializer(required=False)
|
||||||
|
|
||||||
def validate(self, attrs: dict[Any, str]) -> dict[Any, str]:
|
def validate(self, attrs: dict[Any, str]) -> dict[Any, str]:
|
||||||
"""Ensure only API or App password tokens are created."""
|
"""Ensure only API or App password tokens are created."""
|
||||||
|
@ -41,11 +41,11 @@ class TokenSerializer(ManagedSerializer, ModelSerializer):
|
||||||
"identifier",
|
"identifier",
|
||||||
"intent",
|
"intent",
|
||||||
"user",
|
"user",
|
||||||
|
"user_obj",
|
||||||
"description",
|
"description",
|
||||||
"expires",
|
"expires",
|
||||||
"expiring",
|
"expiring",
|
||||||
]
|
]
|
||||||
depth = 2
|
|
||||||
|
|
||||||
|
|
||||||
class TokenViewSerializer(PassiveSerializer):
|
class TokenViewSerializer(PassiveSerializer):
|
||||||
|
|
|
@ -27876,6 +27876,8 @@ components:
|
||||||
intent:
|
intent:
|
||||||
$ref: '#/components/schemas/IntentEnum'
|
$ref: '#/components/schemas/IntentEnum'
|
||||||
user:
|
user:
|
||||||
|
type: integer
|
||||||
|
user_obj:
|
||||||
$ref: '#/components/schemas/UserRequest'
|
$ref: '#/components/schemas/UserRequest'
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
@ -30055,6 +30057,8 @@ components:
|
||||||
intent:
|
intent:
|
||||||
$ref: '#/components/schemas/IntentEnum'
|
$ref: '#/components/schemas/IntentEnum'
|
||||||
user:
|
user:
|
||||||
|
type: integer
|
||||||
|
user_obj:
|
||||||
$ref: '#/components/schemas/User'
|
$ref: '#/components/schemas/User'
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
@ -30066,6 +30070,7 @@ components:
|
||||||
required:
|
required:
|
||||||
- identifier
|
- identifier
|
||||||
- pk
|
- pk
|
||||||
|
- user
|
||||||
TokenRequest:
|
TokenRequest:
|
||||||
type: object
|
type: object
|
||||||
description: Token Serializer
|
description: Token Serializer
|
||||||
|
@ -30085,6 +30090,8 @@ components:
|
||||||
intent:
|
intent:
|
||||||
$ref: '#/components/schemas/IntentEnum'
|
$ref: '#/components/schemas/IntentEnum'
|
||||||
user:
|
user:
|
||||||
|
type: integer
|
||||||
|
user_obj:
|
||||||
$ref: '#/components/schemas/UserRequest'
|
$ref: '#/components/schemas/UserRequest'
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
@ -30095,6 +30102,7 @@ components:
|
||||||
type: boolean
|
type: boolean
|
||||||
required:
|
required:
|
||||||
- identifier
|
- identifier
|
||||||
|
- user
|
||||||
TokenView:
|
TokenView:
|
||||||
type: object
|
type: object
|
||||||
description: Show token's current key
|
description: Show token's current key
|
||||||
|
|
Reference in New Issue