perf: 虚拟账号增加密码选项 (#11201)

* perf: 修改账号配置

* perf: 修改 account

* perf: 修改 virtual account

* perf: 虚拟账号增加密码选项

* perf: 修改获取虚拟账号

* perf: 修改 virtual account

* perf: 修改一些写法

* perf: 添加说明

---------

Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot
2023-08-08 10:16:23 +08:00
committed by GitHub
parent a261b2de3c
commit b764827003
26 changed files with 775 additions and 463 deletions

View File

@@ -0,0 +1,26 @@
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from accounts.models import VirtualAccount
__all__ = ['VirtualAccountSerializer']
class VirtualAccountSerializer(serializers.ModelSerializer):
class Meta:
model = VirtualAccount
field_mini = ['id', 'alias', 'username', 'name']
common_fields = ['date_created', 'date_updated', 'comment']
fields = field_mini + [
'secret_from_login',
] + common_fields
read_only_fields = common_fields + common_fields
extra_kwargs = {
'comment': {'label': _('Comment')},
'name': {'label': _('Name')},
'username': {'label': _('Username')},
'secret_from_login': {'help_text': _('Current only support login from AD/LDAP. Secret priority: '
'Same account in asset secret > Login secret > Manual input')
},
'alias': {'required': False},
}