mirror of https://github.com/jumpserver/jumpserver
fix: 修复同名账号用户名代填问题
parent
e90e61e8dd
commit
8e08e291a0
|
@ -306,9 +306,6 @@ class ConnectionTokenViewSet(ExtraActionApiMixin, RootOrgViewMixin, JMSModelView
|
|||
|
||||
if account.username != AliasAccount.INPUT:
|
||||
data['input_username'] = ''
|
||||
elif account.username == AliasAccount.USER:
|
||||
data['input_username'] = user.username
|
||||
|
||||
ticket = self._validate_acl(user, asset, account)
|
||||
if ticket:
|
||||
data['from_ticket'] = ticket
|
||||
|
|
|
@ -225,9 +225,20 @@ class ConnectionToken(JMSOrgBaseModel):
|
|||
account.asset = self.asset
|
||||
account.org_id = self.asset.org_id
|
||||
|
||||
if self.account in [AliasAccount.INPUT, AliasAccount.USER]:
|
||||
# 手动账号
|
||||
if self.account == AliasAccount.INPUT:
|
||||
account.username = self.input_username
|
||||
account.secret = self.input_secret
|
||||
|
||||
# 同名账号
|
||||
elif self.account == AliasAccount.USER:
|
||||
account.username = self.user.username
|
||||
account.secret = self.input_secret
|
||||
|
||||
# 匿名账号
|
||||
elif self.account == AliasAccount.ANON:
|
||||
account.username = ''
|
||||
account.secret = ''
|
||||
else:
|
||||
account = self.asset.accounts.filter(name=self.account).first()
|
||||
if not account.secret and self.input_secret:
|
||||
|
|
Loading…
Reference in New Issue