mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-16 09:34:03 +01:00
Added missing permission view_domainalias to DomainAdmins group
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# 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),
|
||||
]
|
||||
Reference in New Issue
Block a user