events: don't log permission creation

This commit is contained in:
Jens Langhammer 2021-01-16 22:03:06 +01:00
parent 81efc9a673
commit cb73210447
1 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ from django.contrib.auth.models import User
from django.db.models import Model from django.db.models import Model
from django.db.models.signals import post_save, pre_delete from django.db.models.signals import post_save, pre_delete
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from guardian.models import UserObjectPermission
from authentik.core.middleware import LOCAL from authentik.core.middleware import LOCAL
from authentik.events.models import Event, EventAction, Notification from authentik.events.models import Event, EventAction, Notification
@ -63,7 +64,7 @@ class AuditMiddleware:
user: User, request: HttpRequest, sender, instance: Model, created: bool, **_ user: User, request: HttpRequest, sender, instance: Model, created: bool, **_
): ):
"""Signal handler for all object's post_save""" """Signal handler for all object's post_save"""
if isinstance(instance, (Event, Notification)): if isinstance(instance, (Event, Notification, UserObjectPermission)):
return return
action = EventAction.MODEL_CREATED if created else EventAction.MODEL_UPDATED action = EventAction.MODEL_CREATED if created else EventAction.MODEL_UPDATED
@ -75,7 +76,7 @@ class AuditMiddleware:
user: User, request: HttpRequest, sender, instance: Model, **_ user: User, request: HttpRequest, sender, instance: Model, **_
): ):
"""Signal handler for all object's pre_delete""" """Signal handler for all object's pre_delete"""
if isinstance(instance, (Event, Notification)): if isinstance(instance, (Event, Notification, UserObjectPermission)):
return return
EventNewThread( EventNewThread(