From cea24f0ccf71380dbd2b2886b0d044b8e32b707c Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Fri, 20 Oct 2023 15:25:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E6=94=B9=E5=AF=86=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/migrations/0003_automation.py | 4 ++-- apps/accounts/models/automations/base.py | 2 +- ...move_add_changesecretexection_permission.py | 18 ++++++++++++++++++ apps/rbac/tree.py | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 apps/rbac/migrations/0012_remove_add_changesecretexection_permission.py diff --git a/apps/accounts/migrations/0003_automation.py b/apps/accounts/migrations/0003_automation.py index 12747a4ab..98f5f01f2 100644 --- a/apps/accounts/migrations/0003_automation.py +++ b/apps/accounts/migrations/0003_automation.py @@ -38,7 +38,7 @@ class Migration(migrations.Migration): 'verbose_name': 'Automation execution', 'verbose_name_plural': 'Automation executions', 'permissions': [('view_changesecretexecution', 'Can view change secret execution'), - ('add_changesecretexection', 'Can add change secret execution'), + ('add_changesecretexecution', 'Can add change secret execution'), ('view_gatheraccountsexecution', 'Can view gather accounts execution'), ('add_gatheraccountsexecution', 'Can add gather accounts execution')], 'proxy': True, @@ -184,7 +184,7 @@ class Migration(migrations.Migration): migrations.AlterModelOptions( name='automationexecution', options={'permissions': [('view_changesecretexecution', 'Can view change secret execution'), - ('add_changesecretexection', 'Can add change secret execution'), + ('add_changesecretexecution', 'Can add change secret execution'), ('view_gatheraccountsexecution', 'Can view gather accounts execution'), ('add_gatheraccountsexecution', 'Can add gather accounts execution'), ('view_pushaccountexecution', 'Can view push account execution'), diff --git a/apps/accounts/models/automations/base.py b/apps/accounts/models/automations/base.py index 79f17614f..1adc84bfe 100644 --- a/apps/accounts/models/automations/base.py +++ b/apps/accounts/models/automations/base.py @@ -33,7 +33,7 @@ class AutomationExecution(AssetAutomationExecution): verbose_name_plural = _("Automation executions") permissions = [ ('view_changesecretexecution', _('Can view change secret execution')), - ('add_changesecretexection', _('Can add change secret execution')), + ('add_changesecretexecution', _('Can add change secret execution')), ('view_gatheraccountsexecution', _('Can view gather accounts execution')), ('add_gatheraccountsexecution', _('Can add gather accounts execution')), diff --git a/apps/rbac/migrations/0012_remove_add_changesecretexection_permission.py b/apps/rbac/migrations/0012_remove_add_changesecretexection_permission.py new file mode 100644 index 000000000..a402360dc --- /dev/null +++ b/apps/rbac/migrations/0012_remove_add_changesecretexection_permission.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.10 on 2023-10-20 07:01 + +from django.db import migrations + + +def migrate_remove_add_changesecretexection_permission(apps, *args): + perm_model = apps.get_model('auth', 'Permission') + perm_model.objects.filter(codename='add_changesecretexection').delete() + + +class Migration(migrations.Migration): + dependencies = [ + ('rbac', '0011_remove_redundant_permission'), + ] + + operations = [ + migrations.RunPython(migrate_remove_add_changesecretexection_permission) + ] diff --git a/apps/rbac/tree.py b/apps/rbac/tree.py index ef1571a1f..377fbbe59 100644 --- a/apps/rbac/tree.py +++ b/apps/rbac/tree.py @@ -88,7 +88,7 @@ special_pid_mapper = { "accounts.add_gatheraccountsexecution": "gather_account_node", "accounts.changesecretautomation": "asset_change_plan_node", "accounts.view_changesecretexecution": "asset_change_plan_node", - "accounts.add_changesecretexection": "asset_change_plan_node", + "accounts.add_changesecretexecution": "asset_change_plan_node", "accounts.view_changesecretrecord": "asset_change_plan_node", 'orgs.organization': 'view_setting', 'settings.setting': 'view_setting',