stages/invitation: remove invitation_created signal as model_created functions the same

This commit is contained in:
Jens Langhammer 2020-12-24 16:44:17 +01:00
parent d47d9103c7
commit 49eb568d3c
5 changed files with 2 additions and 17 deletions

View File

@ -19,7 +19,6 @@ from authentik.admin.views.utils import (
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
from authentik.stages.invitation.forms import InvitationForm from authentik.stages.invitation.forms import InvitationForm
from authentik.stages.invitation.models import Invitation from authentik.stages.invitation.models import Invitation
from authentik.stages.invitation.signals import invitation_created
class InvitationListView( class InvitationListView(
@ -59,7 +58,6 @@ class InvitationCreateView(
obj = form.save(commit=False) obj = form.save(commit=False)
obj.created_by = self.request.user obj.created_by = self.request.user
obj.save() obj.save()
invitation_created.send(sender=self, request=self.request, invitation=obj)
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)

View File

@ -35,7 +35,6 @@ class EventAction(models.TextChoices):
TOKEN_VIEW = "token_view" # nosec TOKEN_VIEW = "token_view" # nosec
INVITE_CREATED = "invitation_created"
INVITE_USED = "invitation_used" INVITE_USED = "invitation_used"
AUTHORIZE_APPLICATION = "authorize_application" AUTHORIZE_APPLICATION = "authorize_application"

View File

@ -14,7 +14,7 @@ from authentik.core.models import User
from authentik.core.signals import password_changed from authentik.core.signals import password_changed
from authentik.events.models import Event, EventAction from authentik.events.models import Event, EventAction
from authentik.stages.invitation.models import Invitation from authentik.stages.invitation.models import Invitation
from authentik.stages.invitation.signals import invitation_created, invitation_used from authentik.stages.invitation.signals import invitation_used
from authentik.stages.user_write.signals import user_write from authentik.stages.user_write.signals import user_write
@ -79,16 +79,6 @@ def on_user_login_failed(
thread.run() thread.run()
@receiver(invitation_created)
# pylint: disable=unused-argument
def on_invitation_created(sender, request: HttpRequest, invitation: Invitation, **_):
"""Log Invitation creation"""
thread = EventNewThread(
EventAction.INVITE_CREATED, request, invitation_uuid=invitation.invite_uuid.hex
)
thread.run()
@receiver(invitation_used) @receiver(invitation_used)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def on_invitation_used(sender, request: HttpRequest, invitation: Invitation, **_): def on_invitation_used(sender, request: HttpRequest, invitation: Invitation, **_):

View File

@ -28,7 +28,7 @@ def cleanse_dict(source: Dict[Any, Any]) -> Dict[Any, Any]:
final_dict[key] = SafeExceptionReporterFilter.cleansed_substitute final_dict[key] = SafeExceptionReporterFilter.cleansed_substitute
else: else:
final_dict[key] = value final_dict[key] = value
except TypeError: except TypeError: # pragma: no cover
final_dict[key] = value final_dict[key] = value
if isinstance(value, dict): if isinstance(value, dict):
final_dict[key] = cleanse_dict(value) final_dict[key] = cleanse_dict(value)

View File

@ -1,7 +1,5 @@
"""authentik invitation signals""" """authentik invitation signals"""
from django.core.signals import Signal from django.core.signals import Signal
# Arguments: request: HttpRequest, invitation: Invitation
invitation_created = Signal()
# Arguments: request: HttpRequest, invitation: Invitation # Arguments: request: HttpRequest, invitation: Invitation
invitation_used = Signal() invitation_used = Signal()