perf: 修改命令过滤ACL序列类和部分翻译

pull/9154/head
Bai 2 years ago
parent 4d9344eb23
commit 70fb00c4ee

@ -1,4 +1,4 @@
from .command_filter import *
from .login_acl import *
from .login_asset_acl import *
from .login_asset_check import *
from .command_acl import *

@ -79,6 +79,11 @@ class BaseUserAssetAccountACLSerializerMixin(serializers.Serializer):
}
def validate_reviewers(self, reviewers):
action = self.initial_data.get('action')
if not action and self.instance:
action = self.instance.action
if action != ActionChoices.review:
return reviewers
org_id = self.fields["org_id"].default()
org = Organization.get_instance(org_id)
if not org:

@ -1,4 +1,5 @@
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from acls.models import CommandGroup, CommandFilterACL
from common.drf.fields import ObjectRelatedField
@ -9,6 +10,11 @@ __all__ = ["CommandFilterACLSerializer", "CommandGroupSerializer"]
class CommandGroupSerializer(BulkOrgResourceModelSerializer):
type = serializers.ChoiceField(
choices=CommandGroup.TypeChoices.choices, default=CommandGroup.TypeChoices.command,
label=_('Type')
)
class Meta:
model = CommandGroup
fields = ['id', 'name', 'type', 'content', 'ignore_case', 'comment']
@ -16,7 +22,7 @@ class CommandGroupSerializer(BulkOrgResourceModelSerializer):
class CommandFilterACLSerializer(BaseSerializer, BulkOrgResourceModelSerializer):
command_groups = ObjectRelatedField(
queryset=CommandGroup.objects, many=True, required=False, label=_('Commands')
queryset=CommandGroup.objects, many=True, required=False, label=_('Command group')
)
class Meta(BaseSerializer.Meta):

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:822927ab8fef4d3d70848fe1ecb109e1505a1346cc56f5ed79f5355e5c2d7e90
size 116337
oid sha256:0818af791dad7cd50e19c41de0bc8967f9d08f949f48d5c2020786153a743349
size 116392

File diff suppressed because it is too large Load Diff

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3bd4186e087ac63f435e771d9238bcc249cf01332a7e169475ff80f7ecb7fdf9
size 103601
oid sha256:1c09abdddb5699aeaf832e1162b58ea9b520c10df3f80390c0ec680da3e18f4d
size 103641

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save