From f5dc81907aaaba494390e314de2848d85fe947ef Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 30 Oct 2021 15:02:41 +0200 Subject: [PATCH] core: add created field to source connection Signed-off-by: Jens Langhammer --- authentik/core/api/sources.py | 5 +++ .../sources/oauth/api/source_connection.py | 3 ++ .../sources/plex/api/source_connection.py | 3 ++ schema.yml | 43 ++++--------------- 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index db5a5974e..aa1c383e3 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -129,7 +129,12 @@ class UserSourceConnectionSerializer(SourceSerializer): "pk", "user", "source", + "created", ] + extra_kwargs = { + "user": {"read_only": True}, + "created": {"read_only": True}, + } class UserSourceConnectionViewSet( diff --git a/authentik/sources/oauth/api/source_connection.py b/authentik/sources/oauth/api/source_connection.py index a810a250d..61275db35 100644 --- a/authentik/sources/oauth/api/source_connection.py +++ b/authentik/sources/oauth/api/source_connection.py @@ -21,6 +21,9 @@ class UserOAuthSourceConnectionSerializer(SourceSerializer): "source", "identifier", ] + extra_kwargs = { + "user": {"read_only": True}, + } class UserOAuthSourceConnectionViewSet( diff --git a/authentik/sources/plex/api/source_connection.py b/authentik/sources/plex/api/source_connection.py index 0e793c66d..71baf54fb 100644 --- a/authentik/sources/plex/api/source_connection.py +++ b/authentik/sources/plex/api/source_connection.py @@ -22,6 +22,9 @@ class PlexSourceConnectionSerializer(SourceSerializer): "identifier", "plex_token", ] + extra_kwargs = { + "user": {"read_only": True}, + } class PlexSourceConnectionViewSet( diff --git a/schema.yml b/schema.yml index b9c9a2b70..6979123b6 100644 --- a/schema.yml +++ b/schema.yml @@ -13428,12 +13428,6 @@ paths: required: true tags: - sources - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UserSourceConnectionRequest' - required: true security: - authentik: [] responses: @@ -13459,11 +13453,6 @@ paths: required: true tags: - sources - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PatchedUserSourceConnectionRequest' security: - authentik: [] responses: @@ -27202,8 +27191,6 @@ components: type: object description: Plex Source connection Serializer properties: - user: - type: integer source: type: string format: uuid @@ -27727,8 +27714,6 @@ components: type: object description: OAuth Source Serializer properties: - user: - type: integer source: type: string format: uuid @@ -27770,12 +27755,6 @@ components: attributes: type: object additionalProperties: {} - PatchedUserSourceConnectionRequest: - type: object - description: OAuth Source Serializer - properties: - user: - type: integer PatchedUserWriteStageRequest: type: object description: UserWriteStage Serializer @@ -27922,6 +27901,7 @@ components: title: ID user: type: integer + readOnly: true source: type: string format: uuid @@ -27939,8 +27919,6 @@ components: type: object description: Plex Source connection Serializer properties: - user: - type: integer source: type: string format: uuid @@ -27952,7 +27930,6 @@ components: - identifier - plex_token - source - - user PlexSourceRequest: type: object description: Plex Source Serializer @@ -30312,6 +30289,7 @@ components: title: ID user: type: integer + readOnly: true source: type: string format: uuid @@ -30327,8 +30305,6 @@ components: type: object description: OAuth Source Serializer properties: - user: - type: integer source: type: string format: uuid @@ -30338,7 +30314,6 @@ components: required: - identifier - source - - user UserReputation: type: object description: UserReputation Serializer @@ -30540,22 +30515,20 @@ components: title: ID user: type: integer + readOnly: true source: allOf: - $ref: '#/components/schemas/Source' readOnly: true + created: + type: string + format: date-time + readOnly: true required: + - created - pk - source - user - UserSourceConnectionRequest: - type: object - description: OAuth Source Serializer - properties: - user: - type: integer - required: - - user UserWriteStage: type: object description: UserWriteStage Serializer