misc: fix dependencies to keep old migrations (#40685)
gitea/authentic/pipeline/head This commit looks good
Details
gitea/authentic/pipeline/head This commit looks good
Details
This commit is contained in:
parent
936426a378
commit
6f6714a4bb
|
@ -6,12 +6,7 @@ import authentic2.utils.misc
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0004_service'),
|
||||
('django_rbac', '__first__'),
|
||||
('custom_user', '__first__'),
|
||||
('contenttypes', '0001_initial'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
@ -118,7 +113,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'members',
|
||||
models.ManyToManyField(related_name='roles', to='custom_user.User', blank=True),
|
||||
models.ManyToManyField(related_name='roles', to='auth.User', blank=True),
|
||||
),
|
||||
(
|
||||
'ou',
|
||||
|
|
|
@ -2,36 +2,10 @@
|
|||
|
||||
from django.db import migrations
|
||||
|
||||
from authentic2.a2_rbac.models import CHANGE_OP, MANAGE_MEMBERS_OP
|
||||
|
||||
|
||||
def update_self_administration_perm(apps, schema_editor):
|
||||
Role = apps.get_model('a2_rbac', 'Role')
|
||||
Permission = apps.get_model('a2_rbac', 'Permission')
|
||||
Operation = apps.get_model('django_rbac', 'Operation')
|
||||
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||
change_op, _ = Operation.objects.get_or_create(slug=str(CHANGE_OP.slug))
|
||||
manage_members_op, _ = Operation.objects.get_or_create(slug=str(MANAGE_MEMBERS_OP.slug))
|
||||
ct = ContentType.objects.get_for_model(Role)
|
||||
perms_to_delete = []
|
||||
for role in Role.objects.all():
|
||||
try:
|
||||
perm = role.permissions.get(operation=change_op, target_ct=ct, target_id=role.pk)
|
||||
except Permission.DoesNotExist:
|
||||
continue
|
||||
|
||||
new_perm, _ = Permission.objects.get_or_create(
|
||||
operation=manage_members_op, target_ct=ct, target_id=role.pk, ou__isnull=True
|
||||
)
|
||||
role.permissions.add(new_perm)
|
||||
role.permissions.remove(perm)
|
||||
perms_to_delete.append(perm.pk)
|
||||
Permission.objects.filter(pk__in=perms_to_delete, roles__isnull=True).delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('a2_rbac', '0023_role_can_manage_members'),
|
||||
]
|
||||
|
||||
operations = [migrations.RunPython(update_self_administration_perm, migrations.RunPython.noop)]
|
||||
operations = []
|
||||
|
|
|
@ -7,8 +7,6 @@ from authentic2.migrations import DropPartialIndexes
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0039_add_unique_attribute_constraint'),
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
('a2_rbac', '0028_ou_home_url'),
|
||||
('a2_rbac', '0027_auto_20220331_1521'),
|
||||
]
|
||||
|
|
|
@ -3,40 +3,9 @@
|
|||
from django.db import migrations
|
||||
|
||||
|
||||
def copy_operations_data(apps, schema_editor):
|
||||
OldOperation = apps.get_model('django_rbac', 'Operation')
|
||||
NewOperation = apps.get_model('a2_rbac', 'Operation')
|
||||
Permission = apps.get_model('a2_rbac', 'Permission')
|
||||
|
||||
operation_map = {}
|
||||
for operation in OldOperation.objects.all():
|
||||
operation_map[operation.pk] = NewOperation.objects.create(slug=operation.slug)
|
||||
|
||||
for permission in Permission.objects.all():
|
||||
permission.operation_new = operation_map[permission.operation_id]
|
||||
permission.save()
|
||||
|
||||
|
||||
def reverse_copy_operations_data(apps, schema_editor):
|
||||
OldOperation = apps.get_model('django_rbac', 'Operation')
|
||||
NewOperation = apps.get_model('a2_rbac', 'Operation')
|
||||
Permission = apps.get_model('a2_rbac', 'Permission')
|
||||
|
||||
operation_map = {}
|
||||
for operation in NewOperation.objects.all():
|
||||
operation_map[operation.pk] = OldOperation.objects.create(slug=operation.slug)
|
||||
|
||||
for permission in Permission.objects.all():
|
||||
permission.operation = operation_map[permission.operation_new_id]
|
||||
permission.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('a2_rbac', '0031_new_operation_model'),
|
||||
('django_rbac', '0009_auto_20221004_1343'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(copy_operations_data, reverse_code=reverse_copy_operations_data),
|
||||
]
|
||||
operations = []
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations
|
|||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('a2_rbac', '0036_delete_roleattribute'),
|
||||
('authenticators', '0013_migrate_min_password_strength'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -49,7 +49,6 @@ class Migration(migrations.Migration):
|
|||
('a2_rbac', '0034_new_role_fields'),
|
||||
('a2_rbac', '0035_populate_role_fields'),
|
||||
('a2_rbac', '0036_delete_roleattribute'),
|
||||
('a2_rbac', '0037_remove_organizationalunit_min_password_strength'),
|
||||
]
|
||||
|
||||
initial = True
|
||||
|
|
|
@ -6,43 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
replaces = [
|
||||
('a2_rbac', '0001_initial'),
|
||||
('a2_rbac', '0002_role_external_id'),
|
||||
('a2_rbac', '0003_partial_unique_index_on_name_and_slug'),
|
||||
('a2_rbac', '0004_auto_20150523_0028'),
|
||||
('a2_rbac', '0005_auto_20150526_1406'),
|
||||
('a2_rbac', '0006_auto_20150619_1056'),
|
||||
('a2_rbac', '0007_auto_20150708_1337'),
|
||||
('a2_rbac', '0008_auto_20150810_1953'),
|
||||
('a2_rbac', '0009_partial_unique_index_on_permission'),
|
||||
('a2_rbac', '0010_auto_20160209_1417'),
|
||||
('a2_rbac', '0011_auto_20160209_1511'),
|
||||
('a2_rbac', '0013_auto_20170629_0007'),
|
||||
('a2_rbac', '0014_auto_20170711_1024'),
|
||||
('a2_rbac', '0015_organizationalunit_validate_emails'),
|
||||
('a2_rbac', '0016_auto_20171208_1429'),
|
||||
('a2_rbac', '0017_organizationalunit_user_can_reset_password'),
|
||||
('a2_rbac', '0018_organizationalunit_user_add_password_policy'),
|
||||
('a2_rbac', '0019_organizationalunit_show_username'),
|
||||
('a2_rbac', '0020_partial_unique_index_on_name'),
|
||||
('a2_rbac', '0021_auto_20200317_1514'),
|
||||
('a2_rbac', '0022_auto_20200402_1101'),
|
||||
('a2_rbac', '0023_role_can_manage_members'),
|
||||
('a2_rbac', '0024_fix_self_admin_perm'),
|
||||
('a2_rbac', '0025_auto_20210622_1132'),
|
||||
('a2_rbac', '0026_add_roleparenting_soft_delete'),
|
||||
('a2_rbac', '0026_organizationalunit_check_required_on_login_attributes'),
|
||||
('a2_rbac', '0027_auto_20211213_0949'),
|
||||
('a2_rbac', '0027_auto_20220331_1521'),
|
||||
('a2_rbac', '0028_ou_home_url'),
|
||||
('a2_rbac', '0029_use_unique_constraints'),
|
||||
('a2_rbac', '0030_organizationalunit_min_password_strength'),
|
||||
('a2_rbac', '0031_new_operation_model'),
|
||||
('a2_rbac', '0032_copy_operations_data'),
|
||||
('a2_rbac', '0033_remove_old_operation_fk'),
|
||||
('a2_rbac', '0034_new_role_fields'),
|
||||
('a2_rbac', '0035_populate_role_fields'),
|
||||
('a2_rbac', '0036_delete_roleattribute'),
|
||||
('a2_rbac', '0037_remove_organizationalunit_min_password_strength'),
|
||||
('a2_rbac', '0038_organizationalunit_phone_is_unique'),
|
||||
('a2_rbac', '0039_set_user_view_permissions_by_ou'),
|
||||
|
|
|
@ -12,10 +12,7 @@ import authentic2.utils.evaluate
|
|||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.RBAC_OU_MODEL),
|
||||
('a2_rbac', '0036_delete_roleattribute'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
|
|
@ -7,9 +7,7 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.RBAC_ROLE_MODEL),
|
||||
('authenticators', '0004_auto_20220726_1708'),
|
||||
('authentic2_auth_saml', '0012_move_add_role_action'),
|
||||
]
|
||||
|
||||
state_operations = [
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0048_rename_services_runtime_settings'),
|
||||
('authenticators', '0009_migrate_new_password_settings'),
|
||||
]
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ def migrate_min_password_strength(apps, schema_editor):
|
|||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authenticators', '0012_loginpasswordauthenticator_min_password_strength'),
|
||||
('a2_rbac', '0036_delete_roleattribute'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -11,11 +11,7 @@ from django.utils import timezone
|
|||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('authentic2', '0027_remove_deleteduser'),
|
||||
('sessions', '0001_initial'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
|
|
@ -36,7 +36,6 @@ class ThirdPartyAlterField(migrations.AlterField):
|
|||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '0001_initial'),
|
||||
('admin', '__first__'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -9,7 +9,6 @@ class Migration(migrations.Migration):
|
|||
dependencies = [
|
||||
('contenttypes', '__first__'),
|
||||
('custom_user', '0010_auto_20160307_1418'),
|
||||
('authentic2', '0015_auto_20160621_1711'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0035_service_home_url'),
|
||||
('custom_user', '0029_profile_profiletype'),
|
||||
]
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('auth', '__first__'),
|
||||
('custom_user', '__first__'),
|
||||
('contenttypes', '0001_initial'),
|
||||
]
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('authentic2', '0002_auto_20150320_1418'),
|
||||
]
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0015_auto_20160621_1711'),
|
||||
('custom_user', '0011_manual_attribute_values_for_name_fields'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '0016_auto_20180925_1107'),
|
||||
('authentic2', '0022_attribute_scopes'),
|
||||
]
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '0016_auto_20180925_1107'),
|
||||
('authentic2', '0023_auto_20181031_0900'),
|
||||
]
|
||||
|
||||
|
|
|
@ -16,11 +16,6 @@ def fill_deleted(apps, schema_editor):
|
|||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0026_token'),
|
||||
('custom_user', '0019_add_user_deleted'),
|
||||
]
|
||||
|
||||
run_before = [
|
||||
('custom_user', '0026_remove_user_deleted'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '0030_auto_20220304_1136'),
|
||||
('authentic2', '0035_service_home_url'),
|
||||
]
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import authentic2.a2_rbac.utils
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('a2_rbac', '0036_delete_roleattribute'),
|
||||
('authentic2', '0045_smscode'),
|
||||
]
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('authentic2', '0047_initialize_services_runtime_settings'),
|
||||
]
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import authentic2.saml.models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('contenttypes', '0001_initial'),
|
||||
]
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('saml', '0003_merge'),
|
||||
]
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0004_service'),
|
||||
('saml', '0004_auto_20150410_1438'),
|
||||
]
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
|
|
@ -7,7 +7,6 @@ import authentic2_auth_oidc.models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
migrations.swappable_dependency(settings.RBAC_OU_MODEL),
|
||||
]
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('authentic2_auth_oidc', '0007_auto_20200317_1732'),
|
||||
]
|
||||
|
||||
|
|
|
@ -12,9 +12,7 @@ from authentic2_auth_saml.models import NAME_ID_FORMAT_CHOICES
|
|||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('authenticators', '0003_auto_20220413_1504'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
|
|
@ -1,23 +1,11 @@
|
|||
# Generated by Django 2.2.26 on 2022-07-26 15:13
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.utils import translation
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
|
||||
def set_default_button_label(apps, schema_editor):
|
||||
SAMLAuthenticator = apps.get_model('authentic2_auth_saml', 'SAMLAuthenticator')
|
||||
with translation.override(settings.LANGUAGE_CODE):
|
||||
SAMLAuthenticator.objects.update(button_label=_('Login'))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2_auth_saml', '0002_auto_20220608_1559'),
|
||||
('authenticators', '0004_auto_20220726_1708'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(set_default_button_label, reverse_code=migrations.RunPython.noop),
|
||||
]
|
||||
operations = []
|
||||
|
|
|
@ -151,7 +151,6 @@ class Migration(migrations.Migration):
|
|||
'authentic2_auth_saml',
|
||||
'0005_addroleaction_renameattributeaction_samlattributelookup_setattributeaction',
|
||||
),
|
||||
('a2_rbac', '0029_use_unique_constraints'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -4,9 +4,7 @@ import authentic2_idp_cas.models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('authentic2_idp_cas', '0001_initial'),
|
||||
]
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('authentic2', '0004_service'),
|
||||
('authentic2_idp_cas', '0002_auto_20150410_1438'),
|
||||
]
|
||||
|
||||
|
|
|
@ -4,10 +4,7 @@ import authentic2_idp_oidc.models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '__first__'),
|
||||
('authentic2', '0016_attribute_disabled'),
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '0031_profile_email'),
|
||||
('authentic2_idp_oidc', '0014_auto_20201126_1812'),
|
||||
]
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('custom_user', '0031_profile_email'),
|
||||
('authentic2_idp_oidc', '0016_remove_oidcclient_perform_sub_profile_substitution'),
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue