diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py index 2a58331c0..ef3754b96 100644 --- a/authentik/core/api/propertymappings.py +++ b/authentik/core/api/propertymappings.py @@ -1,11 +1,12 @@ """PropertyMapping API Views""" from django.urls import reverse from drf_yasg2.utils import swagger_auto_schema +from rest_framework import mixins from rest_framework.decorators import action from rest_framework.request import Request from rest_framework.response import Response from rest_framework.serializers import ModelSerializer, SerializerMethodField -from rest_framework.viewsets import ReadOnlyModelViewSet +from rest_framework.viewsets import GenericViewSet from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer from authentik.core.models import PropertyMapping @@ -41,7 +42,12 @@ class PropertyMappingSerializer(ModelSerializer, MetaNameSerializer): ] -class PropertyMappingViewSet(ReadOnlyModelViewSet): +class PropertyMappingViewSet( + mixins.RetrieveModelMixin, + mixins.DestroyModelMixin, + mixins.ListModelMixin, + GenericViewSet, +): """PropertyMapping Viewset""" queryset = PropertyMapping.objects.none() diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index 509f86504..4cf6e352b 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -3,11 +3,12 @@ from typing import Iterable from django.urls import reverse from drf_yasg2.utils import swagger_auto_schema +from rest_framework import mixins from rest_framework.decorators import action from rest_framework.request import Request from rest_framework.response import Response from rest_framework.serializers import ModelSerializer, SerializerMethodField -from rest_framework.viewsets import ReadOnlyModelViewSet +from rest_framework.viewsets import GenericViewSet from structlog.stdlib import get_logger from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer @@ -45,7 +46,12 @@ class SourceSerializer(ModelSerializer, MetaNameSerializer): ] -class SourceViewSet(ReadOnlyModelViewSet): +class SourceViewSet( + mixins.RetrieveModelMixin, + mixins.DestroyModelMixin, + mixins.ListModelMixin, + GenericViewSet, +): """Source Viewset""" queryset = Source.objects.none() diff --git a/authentik/flows/api/stages.py b/authentik/flows/api/stages.py index 3fb2241fc..43029a19c 100644 --- a/authentik/flows/api/stages.py +++ b/authentik/flows/api/stages.py @@ -3,11 +3,12 @@ from typing import Iterable from django.urls import reverse from drf_yasg2.utils import swagger_auto_schema +from rest_framework import mixins from rest_framework.decorators import action from rest_framework.request import Request from rest_framework.response import Response from rest_framework.serializers import ModelSerializer, SerializerMethodField -from rest_framework.viewsets import ReadOnlyModelViewSet +from rest_framework.viewsets import GenericViewSet from structlog.stdlib import get_logger from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer @@ -43,7 +44,12 @@ class StageSerializer(ModelSerializer, MetaNameSerializer): ] -class StageViewSet(ReadOnlyModelViewSet): +class StageViewSet( + mixins.RetrieveModelMixin, + mixins.DestroyModelMixin, + mixins.ListModelMixin, + GenericViewSet, +): """Stage Viewset""" queryset = Stage.objects.all().select_related("flow_set") diff --git a/authentik/policies/api.py b/authentik/policies/api.py index 75a8fa6ab..6b96cffca 100644 --- a/authentik/policies/api.py +++ b/authentik/policies/api.py @@ -3,6 +3,7 @@ from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.urls import reverse from drf_yasg2.utils import swagger_auto_schema +from rest_framework import mixins from rest_framework.decorators import action from rest_framework.request import Request from rest_framework.response import Response @@ -11,7 +12,7 @@ from rest_framework.serializers import ( PrimaryKeyRelatedField, SerializerMethodField, ) -from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet +from rest_framework.viewsets import GenericViewSet, ModelViewSet from authentik.core.api.utils import ( CacheSerializer, @@ -98,7 +99,12 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer): depth = 3 -class PolicyViewSet(ReadOnlyModelViewSet): +class PolicyViewSet( + mixins.RetrieveModelMixin, + mixins.DestroyModelMixin, + mixins.ListModelMixin, + GenericViewSet, +): """Policy Viewset""" queryset = Policy.objects.all() diff --git a/swagger.yaml b/swagger.yaml index f0c18a547..c6fedb5b5 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -3778,6 +3778,15 @@ paths: $ref: '#/definitions/Policy' tags: - policies + delete: + operationId: policies_all_delete + description: Policy Viewset + parameters: [] + responses: + '204': + description: '' + tags: + - policies parameters: - name: policy_uuid in: path @@ -5494,6 +5503,15 @@ paths: $ref: '#/definitions/PropertyMapping' tags: - propertymappings + delete: + operationId: propertymappings_all_delete + description: PropertyMapping Viewset + parameters: [] + responses: + '204': + description: '' + tags: + - propertymappings parameters: - name: pm_uuid in: path @@ -6737,6 +6755,15 @@ paths: $ref: '#/definitions/Source' tags: - sources + delete: + operationId: sources_all_delete + description: Source Viewset + parameters: [] + responses: + '204': + description: '' + tags: + - sources parameters: - name: slug in: path @@ -7380,6 +7407,15 @@ paths: $ref: '#/definitions/Stage' tags: - stages + delete: + operationId: stages_all_delete + description: Stage Viewset + parameters: [] + responses: + '204': + description: '' + tags: + - stages parameters: - name: stage_uuid in: path