perf: 命令组加命令过滤搜索 (#11898)

Co-authored-by: feng <1304903146@qq.com>
pull/11899/head
fit2bot 2023-10-18 18:46:49 +08:00 committed by GitHub
parent bdd885069f
commit 00450121bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -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

View File

@ -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'),
),
]

View File

@ -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