pref: conneect token 支持 su from

pull/9134/head
ibuler 2 years ago
parent 307cf97ccb
commit ed77d05bd8

@ -128,16 +128,18 @@ class ConnectionToken(OrgModelMixin, JMSBaseModel):
if self.account_name == '@INPUT' or not account:
return {
'name': self.account_name,
'username': self.username,
'username': self.input_username,
'secret_type': 'password',
'secret': self.secret
'secret': self.input_secret,
'su_from': None
}
else:
return {
'name': account.name,
'username': account.username,
'secret_type': account.secret_type,
'secret': account.secret or self.secret
'secret': account.secret or self.input_secret,
'su_from': account.su_from,
}
@lazyproperty

@ -93,13 +93,22 @@ class ConnectionTokenAssetSerializer(serializers.ModelSerializer):
'org_id', 'specific']
class SimpleAccountSerializer(serializers.ModelSerializer):
""" Account """
class Meta:
model = Account
fields = ['name', 'username', 'secret_type', 'secret']
class ConnectionTokenAccountSerializer(serializers.ModelSerializer):
""" Account """
su_from = SimpleAccountSerializer(required=False, label=_('Su from'))
class Meta:
model = Account
fields = [
'name', 'username', 'secret_type', 'secret',
'name', 'username', 'secret_type', 'secret', 'su_from',
]

Loading…
Cancel
Save