diff --git a/apps/acls/migrations/0004_auto_20220831_1658.py b/apps/acls/migrations/0004_auto_20220831_1658.py index e4392992b..6fd1ef86b 100644 --- a/apps/acls/migrations/0004_auto_20220831_1658.py +++ b/apps/acls/migrations/0004_auto_20220831_1658.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='loginassetacl', name='accounts', - field=models.JSONField(default=dict, verbose_name='Account'), + field=models.JSONField(verbose_name='Account'), ), migrations.RunPython(migrate_system_users_to_accounts), migrations.RemoveField( diff --git a/apps/acls/models/login_asset_acl.py b/apps/acls/models/login_asset_acl.py index b01e4aed1..1c7455fb2 100644 --- a/apps/acls/models/login_asset_acl.py +++ b/apps/acls/models/login_asset_acl.py @@ -18,7 +18,7 @@ class LoginAssetACL(BaseACL, OrgModelMixin): # 条件 users = models.JSONField(verbose_name=_('User')) - accounts = models.JSONField(verbose_name=_('Account'), default=dict) + accounts = models.JSONField(verbose_name=_('Account')) assets = models.JSONField(verbose_name=_('Asset')) # 动作 action = models.CharField( diff --git a/apps/acls/serializers/login_asset_acl.py b/apps/acls/serializers/login_asset_acl.py index 84bab6cc3..2a04b6c97 100644 --- a/apps/acls/serializers/login_asset_acl.py +++ b/apps/acls/serializers/login_asset_acl.py @@ -28,30 +28,25 @@ class LoginAssetACLAssestsSerializer(serializers.Serializer): ip_group_help_text = _( "Format for comma-delimited string, with * indicating a match all. " "Such as: " - "192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 " - "(Domain name support)" + "192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64" + " (Domain name support)" ) ip_group = serializers.ListField( default=["*"], child=serializers.CharField(max_length=1024), - label=_("IP"), + label=_("IP/Host"), help_text=ip_group_help_text, ) hostname_group = serializers.ListField( default=["*"], child=serializers.CharField(max_length=128), - label=_("Hostname"), + label=_("Name"), help_text=common_help_text, ) class LoginAssetACLAccountsSerializer(serializers.Serializer): - protocol_group_help_text = _( - "Format for comma-delimited string, with * indicating a match all. " - "Protocol options: {}" - ) - name_group = serializers.ListField( default=["*"], child=serializers.CharField(max_length=128), @@ -70,9 +65,7 @@ class LoginAssetACLSerializer(BulkOrgResourceModelSerializer): users = LoginAssetACLUsersSerializer() assets = LoginAssetACLAssestsSerializer() accounts = LoginAssetACLAccountsSerializer() - reviewers_amount = serializers.IntegerField( - read_only=True, source="reviewers.count" - ) + reviewers_amount = serializers.IntegerField(read_only=True, source="reviewers.count") action = LabeledChoiceField( choices=models.LoginAssetACL.ActionChoices.choices, label=_("Action") )