From 00450121bc3a640402841c125eb182bd8d0ac544 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:46:49 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=91=BD=E4=BB=A4=E7=BB=84=E5=8A=A0?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=BF=87=E6=BB=A4=E6=90=9C=E7=B4=A2=20(#1189?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/acls/api/command_acl.py | 2 +- ...18_alter_commandfilteracl_command_groups.py | 18 ++++++++++++++++++ apps/acls/models/command_acl.py | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 apps/acls/migrations/0018_alter_commandfilteracl_command_groups.py diff --git a/apps/acls/api/command_acl.py b/apps/acls/api/command_acl.py index 182b881eb..2043f274d 100644 --- a/apps/acls/api/command_acl.py +++ b/apps/acls/api/command_acl.py @@ -10,7 +10,7 @@ __all__ = ['CommandFilterACLViewSet', 'CommandGroupViewSet'] class CommandGroupViewSet(OrgBulkModelViewSet): model = models.CommandGroup - filterset_fields = ('name',) + filterset_fields = ('name', 'command_filters') search_fields = filterset_fields serializer_class = serializers.CommandGroupSerializer diff --git a/apps/acls/migrations/0018_alter_commandfilteracl_command_groups.py b/apps/acls/migrations/0018_alter_commandfilteracl_command_groups.py new file mode 100644 index 000000000..0dea952a8 --- /dev/null +++ b/apps/acls/migrations/0018_alter_commandfilteracl_command_groups.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.10 on 2023-10-18 10:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('acls', '0017_alter_connectmethodacl_options'), + ] + + operations = [ + migrations.AlterField( + model_name='commandfilteracl', + name='command_groups', + field=models.ManyToManyField(related_name='command_filters', to='acls.commandgroup', verbose_name='Command group'), + ), + ] diff --git a/apps/acls/models/command_acl.py b/apps/acls/models/command_acl.py index 4fbfd0829..2011cc60a 100644 --- a/apps/acls/models/command_acl.py +++ b/apps/acls/models/command_acl.py @@ -93,7 +93,10 @@ class CommandGroup(JMSOrgBaseModel): class CommandFilterACL(UserAssetAccountBaseACL): - command_groups = models.ManyToManyField(CommandGroup, verbose_name=_('Command group')) + command_groups = models.ManyToManyField( + CommandGroup, verbose_name=_('Command group'), + related_name='command_filters' + ) class Meta(UserAssetAccountBaseACL.Meta): abstract = False