33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
# Generated by Django 4.2.7 on 2023-11-26 00:16
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations
|
|
from django.contrib.auth.models import Permission, Group
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
('authentication', '0002_authtokeneventpermissions_extendedauthtoken_and_more'),
|
|
('tickets', '0001_initial'),
|
|
]
|
|
|
|
def create_groups(apps, schema_editor):
|
|
admins = Group.objects.create(name='Admin')
|
|
orga = Group.objects.create(name='Orga')
|
|
team = Group.objects.create(name='Team')
|
|
users = Group.objects.create(name='User')
|
|
admins.permissions.add(*Permission.objects.all())
|
|
users.permissions.add(*Permission.objects.filter(codename__in=
|
|
['view_item', 'add_item', 'change_item', 'match_item']))
|
|
team.permissions.add(*Permission.objects.filter(codename__in=
|
|
['delete_item', 'view_issuethread', 'add_issuethread',
|
|
'change_issuethread', 'delete_issuethread', 'send_mail']),
|
|
*users.permissions.all())
|
|
orga.permissions.add(*Permission.objects.filter(codename__in=['add_event']),
|
|
*team.permissions.all())
|
|
|
|
operations = [
|
|
migrations.RunPython(create_groups),
|
|
]
|