diff --git a/allianceauth/authentication/migrations/0025_v5squash.py b/allianceauth/authentication/migrations/0025_v5squash.py index cebea055..9d23d874 100644 --- a/allianceauth/authentication/migrations/0025_v5squash.py +++ b/allianceauth/authentication/migrations/0025_v5squash.py @@ -8,27 +8,6 @@ from django.db import migrations, models import allianceauth.authentication.models -def create_permissions(apps, schema_editor): - User = apps.get_model('auth', 'User') - ContentType = apps.get_model('contenttypes', 'ContentType') - Permission = apps.get_model('auth', 'Permission') - ct = ContentType.objects.get_for_model(User) - # Permission.objects.get_or_create(codename="member", content_type=ct, name="member") - # Permission.objects.get_or_create(codename="jabber_broadcast", content_type=ct, name="jabber_broadcast") - # Permission.objects.get_or_create(codename="jabber_broadcast_all", content_type=ct, name="jabber_broadcast_all") - # Permission.objects.get_or_create(codename="fleetactivitytracking", content_type=ct, name="fleetactivitytracking") - # Permission.objects.get_or_create(codename="fleetactivitytracking_statistics", content_type=ct, name="fleetactivitytracking_statistics") - # Permission.objects.get_or_create(codename="signature_management", content_type=ct, name="signature_management") - # Permission.objects.get_or_create(codename="signature_view", content_type=ct, name="signature_view") - # Permission.objects.get_or_create(codename="optimer_management", content_type=ct, name="optimer_management") - # Permission.objects.get_or_create(codename="optimer_view", content_type=ct, name="optimer_view") - Permission.objects.get_or_create(codename="logging_notifications", content_type=ct, name="logging_notifications") - - -def create_permissions_reverse(apps, schema_editor) -> None: - pass - - def create_states(apps, schema_editor) -> None: State = apps.get_model('authentication', 'State') @@ -140,7 +119,6 @@ class Migration(migrations.Migration): 'ordering': ['-created'], }, ), - migrations.RunPython(create_permissions, create_permissions_reverse), migrations.RunPython(create_states, create_states_reverse), ] diff --git a/allianceauth/fleetactivitytracking/migrations/0008_v5squash.py b/allianceauth/fleetactivitytracking/migrations/0008_v5squash.py index 74250a45..52e36d0b 100644 --- a/allianceauth/fleetactivitytracking/migrations/0008_v5squash.py +++ b/allianceauth/fleetactivitytracking/migrations/0008_v5squash.py @@ -8,6 +8,20 @@ from django.db import migrations, models import allianceauth.framework.api.user +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 + User = apps.get_model('auth', 'User') + ContentType = apps.get_model('contenttypes', 'ContentType') + Permission = apps.get_model('auth', 'Permission') + ct = ContentType.objects.get_for_model(User) + Permission.objects.get_or_create(codename="fleetactivitytracking", content_type=ct, name="fleetactivitytracking") + Permission.objects.get_or_create(codename="fleetactivitytracking_statistics", content_type=ct, name="fleetactivitytracking_statistics") + + +def reverse(apps, schema_editor) -> None: + pass + + class Migration(migrations.Migration): replaces = [('fleetactivitytracking', '0001_initial'), ('fleetactivitytracking', '0002_auto_20160905_2220'), ('fleetactivitytracking', '0003_auto_20160906_2354'), ('fleetactivitytracking', '0004_make_strings_more_stringy'), ('fleetactivitytracking', '0005_remove_fat_name'), ('fleetactivitytracking', '0006_auto_20180803_0430'), ('fleetactivitytracking', '0007_sentinel_user')] @@ -46,4 +60,5 @@ class Migration(migrations.Migration): 'unique_together': {('character', 'fatlink')}, }, ), + migrations.RunPython(create_permissions, reverse) ] diff --git a/allianceauth/groupmanagement/migrations/0020_v5squash.py b/allianceauth/groupmanagement/migrations/0020_v5squash.py index 26436f8d..f813c055 100644 --- a/allianceauth/groupmanagement/migrations/0020_v5squash.py +++ b/allianceauth/groupmanagement/migrations/0020_v5squash.py @@ -7,7 +7,8 @@ from django.conf import settings from django.db import migrations, models -def create_permissions(apps, schema_editor): +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 User = apps.get_model('auth', 'User') ContentType = apps.get_model('contenttypes', 'ContentType') Permission = apps.get_model('auth', 'Permission') @@ -15,7 +16,7 @@ def create_permissions(apps, schema_editor): Permission.objects.get_or_create(codename="group_management", content_type=ct, name="group_management") -def reverse(apps, schema_editor): +def reverse(apps, schema_editor) -> None: pass diff --git a/allianceauth/hrapplications/migrations/0008_v5squash.py b/allianceauth/hrapplications/migrations/0008_v5squash.py index 9afeb7c9..3a34f407 100644 --- a/allianceauth/hrapplications/migrations/0008_v5squash.py +++ b/allianceauth/hrapplications/migrations/0008_v5squash.py @@ -7,7 +7,8 @@ from django.conf import settings from django.db import migrations, models -def create_permissions(apps, schema_editor): +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 User = apps.get_model('auth', 'User') ContentType = apps.get_model('contenttypes', 'ContentType') Permission = apps.get_model('auth', 'Permission') @@ -15,7 +16,7 @@ def create_permissions(apps, schema_editor): Permission.objects.get_or_create(codename="human_resources", content_type=ct, name="human_resources") -def reverse(apps, schema_editor): +def reverse(apps, schema_editor) -> None: pass diff --git a/allianceauth/notifications/migrations/0006_v5squash.py b/allianceauth/notifications/migrations/0006_v5squash.py index b3b7b8d3..c8af881f 100644 --- a/allianceauth/notifications/migrations/0006_v5squash.py +++ b/allianceauth/notifications/migrations/0006_v5squash.py @@ -5,6 +5,19 @@ from django.conf import settings from django.db import migrations, models +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 + User = apps.get_model('auth', 'User') + ContentType = apps.get_model('contenttypes', 'ContentType') + Permission = apps.get_model('auth', 'Permission') + ct = ContentType.objects.get_for_model(User) + Permission.objects.get_or_create(codename="logging_notifications", content_type=ct, name="logging_notifications") + + +def reverse(apps, schema_editor) -> None: + pass + + class Migration(migrations.Migration): replaces = [('notifications', '0001_initial'), ('notifications', '0002_auto_20160910_1649'), ('notifications', '0003_make_strings_more_stringy'), ('notifications', '0004_performance_tuning'), ('notifications', '0005_fix_level_choices')] @@ -28,4 +41,5 @@ class Migration(migrations.Migration): ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), + migrations.RunPython(create_permissions, reverse) ] diff --git a/allianceauth/optimer/migrations/0005_v5squash.py b/allianceauth/optimer/migrations/0005_v5squash.py index 9ebb3ac9..d2312294 100644 --- a/allianceauth/optimer/migrations/0005_v5squash.py +++ b/allianceauth/optimer/migrations/0005_v5squash.py @@ -7,6 +7,20 @@ import django.utils.timezone from django.db import migrations, models +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 + User = apps.get_model('auth', 'User') + ContentType = apps.get_model('contenttypes', 'ContentType') + Permission = apps.get_model('auth', 'Permission') + ct = ContentType.objects.get_for_model(User) + Permission.objects.get_or_create(codename="optimer_management", content_type=ct, name="optimer_management") + Permission.objects.get_or_create(codename="optimer_view", content_type=ct, name="optimer_view") + + +def reverse(apps, schema_editor) -> None: + pass + + class Migration(migrations.Migration): replaces = [('optimer', '0001_initial'), ('optimer', '0002_auto_20170413_0442'), ('optimer', '0003_make_strings_more_stringy'), ('optimer', '0004_on_delete'), ('optimer', '0005_add_type_and_description')] @@ -49,4 +63,5 @@ class Migration(migrations.Migration): 'default_permissions': (), }, ), + migrations.RunPython(create_permissions, reverse) ] diff --git a/allianceauth/services/modules/openfire/migrations/0003_v5squash.py b/allianceauth/services/modules/openfire/migrations/0003_v5squash.py index fdc737d8..abc3bcaa 100644 --- a/allianceauth/services/modules/openfire/migrations/0003_v5squash.py +++ b/allianceauth/services/modules/openfire/migrations/0003_v5squash.py @@ -5,10 +5,20 @@ import django.db.models.deletion from django.conf import settings from django.db import migrations, models -# Functions from the following migrations need manual copying. -# Move them and any dependencies into this file, then update the -# RunPython operations to refer to the local versions: -# allianceauth.services.modules.openfire.migrations.0002_service_permissions + +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 + User = apps.get_model('auth', 'User') + ContentType = apps.get_model('contenttypes', 'ContentType') + Permission = apps.get_model('auth', 'Permission') + ct = ContentType.objects.get_for_model(User) + Permission.objects.get_or_create(codename="jabber_broadcast", content_type=ct, name="jabber_broadcast") + Permission.objects.get_or_create(codename="jabber_broadcast_all", content_type=ct, name="jabber_broadcast_all") + + +def reverse(apps, schema_editor) -> None: + pass + class Migration(migrations.Migration): @@ -31,4 +41,5 @@ class Migration(migrations.Migration): 'permissions': (('access_openfire', 'Can access the Openfire service'),), }, ), + migrations.RunPython(create_permissions, reverse) ] diff --git a/allianceauth/srp/migrations/0006_v5squash.py b/allianceauth/srp/migrations/0006_v5squash.py index 2a83b3cd..039d65b3 100644 --- a/allianceauth/srp/migrations/0006_v5squash.py +++ b/allianceauth/srp/migrations/0006_v5squash.py @@ -5,7 +5,8 @@ import django.utils.timezone from django.db import migrations, models -def create_permissions(apps, schema_editor): +def create_permissions(apps, schema_editor) -> None: + # Remnant of AAv0 User = apps.get_model('auth', 'User') ContentType = apps.get_model('contenttypes', 'ContentType') Permission = apps.get_model('auth', 'Permission') @@ -13,7 +14,7 @@ def create_permissions(apps, schema_editor): Permission.objects.get_or_create(codename="srp_management", content_type=ct, name="srp_management") -def reverse(apps, schema_editor): +def reverse(apps, schema_editor) -> None: pass