stages/invitation: fix invitation not inheriting ExpiringModel

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-01 14:25:08 +02:00
parent 88f0dfc8cc
commit 17cb76c334
3 changed files with 27 additions and 6 deletions

View File

@ -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),
),
]

View File

@ -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,

View File

@ -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: {}