core: Add unique constraint to user UUID (#5004)

This commit is contained in:
sdimovv 2023-03-20 01:33:08 +02:00 committed by GitHub
parent a566856b65
commit 16a03160d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 4.1.7 on 2023-03-19 21:57
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("authentik_core", "0026_alter_propertymapping_name_alter_provider_name"),
]
operations = [
migrations.AlterField(
model_name="user",
name="uuid",
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
),
]

View File

@ -146,7 +146,7 @@ class UserManager(DjangoUserManager):
class User(SerializerModel, GuardianUserMixin, AbstractUser):
"""Custom User model to allow easier adding of user-based settings"""
uuid = models.UUIDField(default=uuid4, editable=False)
uuid = models.UUIDField(default=uuid4, editable=False, unique=True)
name = models.TextField(help_text=_("User's display name."))
path = models.TextField(default="users")