Ajout de groupes pour gérer certaines permissions

This commit is contained in:
Jean-Marie Favreau 2024-03-31 14:49:38 +02:00
parent 85db7ede89
commit 4f4d2e6a01

View File

@ -0,0 +1,26 @@
# Create groups for several tasks
from django.db import migrations
from django.contrib.auth.management import create_permissions
from django.contrib.auth.models import Group, Permission
def groups_permissions_creation(apps, schema_editor):
user_roles = ["Automation Manager", "Q&A Manager", "Receptionist"]
for name in user_roles:
Group.objects.create(name=name)
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0035_alter_event_location'),
]
operations = [
migrations.RunPython(groups_permissions_creation),
]