# Generated by Django 4.2.11 on 2024-03-20 10:37

from django.db import migrations


def set_missing_permission(apps, schema_editor):
    Permission = apps.get_model("auth", "Permission")
    Group = apps.get_model("auth", "Group")
    group = Group.objects.filter(name="DomainAdmins").first()
    if not group:
        # Fresh install, nothing to do
        return
    perm = Permission.objects.get(codename="view_domainalias")
    group.permissions.add(perm)


class Migration(migrations.Migration):

    dependencies = [
        ("admin", "0022_alter_alarm_domain"),
    ]

    operations = [
        migrations.RunPython(set_missing_permission, migrations.RunPython.noop),
    ]
