Ajout de groupes pour gérer certaines permissions
This commit is contained in:
parent
85db7ede89
commit
4f4d2e6a01
26
src/agenda_culturel/migrations/0036_auto_20240331_1421.py
Normal file
26
src/agenda_culturel/migrations/0036_auto_20240331_1421.py
Normal 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),
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user