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):
|
||||
"""Token Serializer"""
|
||||
|
||||
user = UserSerializer(required=False)
|
||||
user_obj = UserSerializer(required=False)
|
||||
|
||||
def validate(self, attrs: dict[Any, str]) -> dict[Any, str]:
|
||||
"""Ensure only API or App password tokens are created."""
|
||||
|
@ -41,11 +41,11 @@ class TokenSerializer(ManagedSerializer, ModelSerializer):
|
|||
"identifier",
|
||||
"intent",
|
||||
"user",
|
||||
"user_obj",
|
||||
"description",
|
||||
"expires",
|
||||
"expiring",
|
||||
]
|
||||
depth = 2
|
||||
|
||||
|
||||
class TokenViewSerializer(PassiveSerializer):
|
||||
|
|
|
@ -27876,6 +27876,8 @@ components:
|
|||
intent:
|
||||
$ref: '#/components/schemas/IntentEnum'
|
||||
user:
|
||||
type: integer
|
||||
user_obj:
|
||||
$ref: '#/components/schemas/UserRequest'
|
||||
description:
|
||||
type: string
|
||||
|
@ -30055,6 +30057,8 @@ components:
|
|||
intent:
|
||||
$ref: '#/components/schemas/IntentEnum'
|
||||
user:
|
||||
type: integer
|
||||
user_obj:
|
||||
$ref: '#/components/schemas/User'
|
||||
description:
|
||||
type: string
|
||||
|
@ -30066,6 +30070,7 @@ components:
|
|||
required:
|
||||
- identifier
|
||||
- pk
|
||||
- user
|
||||
TokenRequest:
|
||||
type: object
|
||||
description: Token Serializer
|
||||
|
@ -30085,6 +30090,8 @@ components:
|
|||
intent:
|
||||
$ref: '#/components/schemas/IntentEnum'
|
||||
user:
|
||||
type: integer
|
||||
user_obj:
|
||||
$ref: '#/components/schemas/UserRequest'
|
||||
description:
|
||||
type: string
|
||||
|
@ -30095,6 +30102,7 @@ components:
|
|||
type: boolean
|
||||
required:
|
||||
- identifier
|
||||
- user
|
||||
TokenView:
|
||||
type: object
|
||||
description: Show token's current key
|
||||
|
|
Reference in New Issue