stages/invitation: ensure created_by is set when creating from API

This commit is contained in:
Jens Langhammer 2020-12-24 16:47:21 +01:00
parent 49eb568d3c
commit 5f90f54195
3 changed files with 26 additions and 1 deletions

View file

@ -43,3 +43,7 @@ class InvitationViewSet(ModelViewSet):
queryset = Invitation.objects.all() queryset = Invitation.objects.all()
serializer_class = InvitationSerializer serializer_class = InvitationSerializer
def perform_create(self, serializer: InvitationSerializer):
serializer.instance.created_by = self.request.user
return super().perform_create(serializer)

View file

@ -0,0 +1,22 @@
# Generated by Django 3.1.4 on 2020-12-27 12:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("authentik_stages_invitation", "0002_auto_20201225_2143"),
]
operations = [
migrations.AlterField(
model_name="invitation",
name="fixed_data",
field=models.JSONField(
blank=True,
default=dict,
help_text="Optional fixed data to enforce on user enrollment.",
),
),
]

View file

@ -7003,7 +7003,6 @@ definitions:
- suspicious_request - suspicious_request
- password_set - password_set
- token_view - token_view
- invitation_created
- invitation_used - invitation_used
- authorize_application - authorize_application
- source_linked - source_linked