diff --git a/authentik/events/api/notification.py b/authentik/events/api/notification.py index 9021b2aaa..9e7aef716 100644 --- a/authentik/events/api/notification.py +++ b/authentik/events/api/notification.py @@ -39,6 +39,13 @@ class NotificationViewSet( queryset = Notification.objects.all() serializer_class = NotificationSerializer + filterset_fields = [ + "severity", + "body", + "created", + "event", + "seen", + ] def get_queryset(self): if not self.request: diff --git a/authentik/events/middleware.py b/authentik/events/middleware.py index 4e7cd78b8..c4e3bb9c7 100644 --- a/authentik/events/middleware.py +++ b/authentik/events/middleware.py @@ -8,7 +8,7 @@ from django.db.models.signals import post_save, pre_delete from django.http import HttpRequest, HttpResponse from authentik.core.middleware import LOCAL -from authentik.events.models import Event, EventAction +from authentik.events.models import Event, EventAction, Notification from authentik.events.signals import EventNewThread from authentik.events.utils import model_to_dict @@ -63,7 +63,7 @@ class AuditMiddleware: user: User, request: HttpRequest, sender, instance: Model, created: bool, **_ ): """Signal handler for all object's post_save""" - if isinstance(instance, Event): + if isinstance(instance, (Event, Notification)): return action = EventAction.MODEL_CREATED if created else EventAction.MODEL_UPDATED @@ -75,7 +75,7 @@ class AuditMiddleware: user: User, request: HttpRequest, sender, instance: Model, **_ ): """Signal handler for all object's pre_delete""" - if isinstance(instance, Event): + if isinstance(instance, (Event, Notification)): return EventNewThread( diff --git a/swagger.yaml b/swagger.yaml index 6cb69babd..8e0539760 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -984,6 +984,31 @@ paths: operationId: events_notifications_list description: Notification Viewset parameters: + - name: severity + in: query + description: '' + required: false + type: string + - name: body + in: query + description: '' + required: false + type: string + - name: created + in: query + description: '' + required: false + type: string + - name: event + in: query + description: '' + required: false + type: string + - name: seen + in: query + description: '' + required: false + type: string - name: ordering in: query description: Which field to use when ordering the results.