diff --git a/authentik/events/api/notification_transport.py b/authentik/events/api/notification_transport.py index 7893d705e..fc72d0cd4 100644 --- a/authentik/events/api/notification_transport.py +++ b/authentik/events/api/notification_transport.py @@ -1,5 +1,4 @@ """NotificationTransport API Views""" -from django.http.response import Http404 from drf_yasg.utils import no_body, swagger_auto_schema from rest_framework.decorators import action from rest_framework.fields import CharField, ListField, SerializerMethodField @@ -68,10 +67,7 @@ class NotificationTransportViewSet(ModelViewSet): def test(self, request: Request, pk=None) -> Response: """Send example notification using selected transport. Requires Modify permissions.""" - transports = self.get_object() - if not transports.exists(): - raise Http404 - transport: NotificationTransport = transports.first() + transport: NotificationTransport = self.get_object() notification = Notification( severity=NotificationSeverity.NOTICE, body=f"Test Notification from transport {transport.name}", diff --git a/authentik/policies/api/policies.py b/authentik/policies/api/policies.py index 7cde0b361..7c289e8a4 100644 --- a/authentik/policies/api/policies.py +++ b/authentik/policies/api/policies.py @@ -109,14 +109,14 @@ class PolicyViewSet( ) return Response(TypeCreateSerializer(data, many=True).data) - @permission_required("authentik_policies.view_policy_cache") + @permission_required(None, ["authentik_policies.view_policy_cache"]) @swagger_auto_schema(responses={200: CacheSerializer(many=False)}) @action(detail=False, pagination_class=None, filter_backends=[]) def cache_info(self, request: Request) -> Response: """Info about cached policies""" return Response(data={"count": len(cache.keys("policy_*"))}) - @permission_required("authentik_policies.clear_policy_cache") + @permission_required(None, ["authentik_policies.clear_policy_cache"]) @swagger_auto_schema( request_body=no_body, responses={204: "Successfully cleared cache", 400: "Bad request"},