diff --git a/authentik/stages/invitation/migrations/0005_auto_20210901_1211.py b/authentik/stages/invitation/migrations/0005_auto_20210901_1211.py new file mode 100644 index 000000000..e8ddca3db --- /dev/null +++ b/authentik/stages/invitation/migrations/0005_auto_20210901_1211.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.6 on 2021-09-01 12:11 + +from django.db import migrations, models + +import authentik.core.models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_stages_invitation", "0004_invitation_single_use"), + ] + + operations = [ + migrations.AddField( + model_name="invitation", + name="expiring", + field=models.BooleanField(default=True), + ), + migrations.AlterField( + model_name="invitation", + name="expires", + field=models.DateTimeField(default=authentik.core.models.default_token_duration), + ), + ] diff --git a/authentik/stages/invitation/models.py b/authentik/stages/invitation/models.py index 84c08d8ff..8568fd816 100644 --- a/authentik/stages/invitation/models.py +++ b/authentik/stages/invitation/models.py @@ -7,7 +7,7 @@ from django.utils.translation import gettext_lazy as _ from django.views import View from rest_framework.serializers import BaseSerializer -from authentik.core.models import User +from authentik.core.models import ExpiringModel, User from authentik.flows.models import Stage @@ -48,7 +48,7 @@ class InvitationStage(Stage): verbose_name_plural = _("Invitation Stages") -class Invitation(models.Model): +class Invitation(ExpiringModel): """Single-use invitation link""" invite_uuid = models.UUIDField(primary_key=True, editable=False, default=uuid4) @@ -59,7 +59,6 @@ class Invitation(models.Model): ) created_by = models.ForeignKey(User, on_delete=models.CASCADE) - expires = models.DateTimeField(default=None, blank=True, null=True) fixed_data = models.JSONField( default=dict, blank=True, diff --git a/schema.yml b/schema.yml index a8af80162..d640958f0 100644 --- a/schema.yml +++ b/schema.yml @@ -22300,7 +22300,6 @@ components: expires: type: string format: date-time - nullable: true fixed_data: type: object additionalProperties: {} @@ -22321,7 +22320,6 @@ components: expires: type: string format: date-time - nullable: true fixed_data: type: object additionalProperties: {} @@ -26978,7 +26976,6 @@ components: expires: type: string format: date-time - nullable: true fixed_data: type: object additionalProperties: {}