core: mark provider_obj as read_only

closes #2637

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-04-04 10:17:59 +02:00
parent dea61ef35e
commit 20262f3f4b
3 changed files with 10 additions and 12 deletions

View File

@ -44,7 +44,7 @@ class ApplicationSerializer(ModelSerializer):
"""Application Serializer"""
launch_url = SerializerMethodField()
provider_obj = ProviderSerializer(source="get_provider", required=False)
provider_obj = ProviderSerializer(source="get_provider", required=False, read_only=True)
meta_icon = ReadOnlyField(source="get_meta_icon")

View File

@ -26,7 +26,7 @@ from authentik.managed.api import ManagedSerializer
class TokenSerializer(ManagedSerializer, ModelSerializer):
"""Token Serializer"""
user_obj = UserSerializer(required=False, source="user")
user_obj = UserSerializer(required=False, source="user", read_only=True)
def validate(self, attrs: dict[Any, str]) -> dict[Any, str]:
"""Ensure only API or App password tokens are created."""

View File

@ -19090,7 +19090,9 @@ components:
type: integer
nullable: true
provider_obj:
$ref: '#/components/schemas/Provider'
allOf:
- $ref: '#/components/schemas/Provider'
readOnly: true
launch_url:
type: string
nullable: true
@ -19115,6 +19117,7 @@ components:
- meta_icon
- name
- pk
- provider_obj
- slug
ApplicationRequest:
type: object
@ -19133,8 +19136,6 @@ components:
provider:
type: integer
nullable: true
provider_obj:
$ref: '#/components/schemas/ProviderRequest'
meta_launch_url:
type: string
format: uri
@ -26591,8 +26592,6 @@ components:
provider:
type: integer
nullable: true
provider_obj:
$ref: '#/components/schemas/ProviderRequest'
meta_launch_url:
type: string
format: uri
@ -28252,8 +28251,6 @@ components:
$ref: '#/components/schemas/IntentEnum'
user:
type: integer
user_obj:
$ref: '#/components/schemas/UserRequest'
description:
type: string
expires:
@ -30756,7 +30753,9 @@ components:
user:
type: integer
user_obj:
$ref: '#/components/schemas/User'
allOf:
- $ref: '#/components/schemas/User'
readOnly: true
description:
type: string
expires:
@ -30767,6 +30766,7 @@ components:
required:
- identifier
- pk
- user_obj
TokenRequest:
type: object
description: Token Serializer
@ -30789,8 +30789,6 @@ components:
$ref: '#/components/schemas/IntentEnum'
user:
type: integer
user_obj:
$ref: '#/components/schemas/UserRequest'
description:
type: string
expires: