From 23d7ef36d231e3e402e60213f39bd1ae4ed5497b Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 30 Mar 2021 18:35:06 +0200 Subject: [PATCH] core: remove provider and outpostserviceconnection base model create operations Signed-off-by: Jens Langhammer --- authentik/core/api/providers.py | 10 +- .../api/outpost_service_connections.py | 10 +- swagger.yaml | 164 ------------------ 3 files changed, 16 insertions(+), 168 deletions(-) diff --git a/authentik/core/api/providers.py b/authentik/core/api/providers.py index 0dd676133..c22c18531 100644 --- a/authentik/core/api/providers.py +++ b/authentik/core/api/providers.py @@ -2,12 +2,13 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ from drf_yasg.utils import swagger_auto_schema +from rest_framework import mixins from rest_framework.decorators import action from rest_framework.fields import ReadOnlyField from rest_framework.request import Request from rest_framework.response import Response from rest_framework.serializers import ModelSerializer, SerializerMethodField -from rest_framework.viewsets import ModelViewSet +from rest_framework.viewsets import GenericViewSet from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer from authentik.core.models import Provider @@ -44,7 +45,12 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): ] -class ProviderViewSet(ModelViewSet): +class ProviderViewSet( + mixins.RetrieveModelMixin, + mixins.DestroyModelMixin, + mixins.ListModelMixin, + GenericViewSet, +): """Provider Viewset""" queryset = Provider.objects.none() diff --git a/authentik/outposts/api/outpost_service_connections.py b/authentik/outposts/api/outpost_service_connections.py index 757a2798e..fc545e0fa 100644 --- a/authentik/outposts/api/outpost_service_connections.py +++ b/authentik/outposts/api/outpost_service_connections.py @@ -3,12 +3,13 @@ from dataclasses import asdict from django.urls import reverse from drf_yasg.utils import swagger_auto_schema +from rest_framework import mixins from rest_framework.decorators import action from rest_framework.fields import BooleanField, CharField, SerializerMethodField from rest_framework.request import Request from rest_framework.response import Response from rest_framework.serializers import ModelSerializer -from rest_framework.viewsets import ModelViewSet +from rest_framework.viewsets import GenericViewSet, ModelViewSet from authentik.core.api.utils import ( MetaNameSerializer, @@ -53,7 +54,12 @@ class ServiceConnectionStateSerializer(PassiveSerializer): version = CharField(read_only=True) -class ServiceConnectionViewSet(ModelViewSet): +class ServiceConnectionViewSet( + mixins.RetrieveModelMixin, + mixins.DestroyModelMixin, + mixins.ListModelMixin, + GenericViewSet, +): """ServiceConnection Viewset""" queryset = OutpostServiceConnection.objects.select_subclasses() diff --git a/swagger.yaml b/swagger.yaml index c0f1a20c5..553ac6459 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -4943,30 +4943,6 @@ paths: $ref: '#/definitions/GenericError' tags: - outposts - post: - operationId: outposts_service_connections_all_create - description: ServiceConnection Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/ServiceConnection' - responses: - '201': - description: '' - schema: - $ref: '#/definitions/ServiceConnection' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - tags: - - outposts parameters: [] /outposts/service_connections/all/types/: get: @@ -5033,64 +5009,6 @@ paths: $ref: '#/definitions/APIException' tags: - outposts - put: - operationId: outposts_service_connections_all_update - description: ServiceConnection Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/ServiceConnection' - responses: - '200': - description: '' - schema: - $ref: '#/definitions/ServiceConnection' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - outposts - patch: - operationId: outposts_service_connections_all_partial_update - description: ServiceConnection Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/ServiceConnection' - responses: - '200': - description: '' - schema: - $ref: '#/definitions/ServiceConnection' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - outposts delete: operationId: outposts_service_connections_all_delete description: ServiceConnection Viewset @@ -8689,30 +8607,6 @@ paths: $ref: '#/definitions/GenericError' tags: - providers - post: - operationId: providers_all_create - description: Provider Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/Provider' - responses: - '201': - description: '' - schema: - $ref: '#/definitions/Provider' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - tags: - - providers parameters: [] /providers/all/types/: get: @@ -8779,64 +8673,6 @@ paths: $ref: '#/definitions/APIException' tags: - providers - put: - operationId: providers_all_update - description: Provider Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/Provider' - responses: - '200': - description: '' - schema: - $ref: '#/definitions/Provider' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - providers - patch: - operationId: providers_all_partial_update - description: Provider Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/Provider' - responses: - '200': - description: '' - schema: - $ref: '#/definitions/Provider' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - providers delete: operationId: providers_all_delete description: Provider Viewset