Merge branch 'v3' of github.com:jumpserver/jumpserver into v3

pull/9134/head
ibuler 2022-11-30 15:34:31 +08:00
commit 21b1dd076a
3 changed files with 7 additions and 14 deletions

View File

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

View File

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

View File

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