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