mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修复动态系统用户返回auth info的bug
parent
02a901467b
commit
c91ce2b99f
|
@ -158,11 +158,10 @@ class SystemUser(BaseUser):
|
|||
def can_perm_to_asset(self):
|
||||
return self.protocol not in [self.PROTOCOL_MYSQL]
|
||||
|
||||
def load_asset_special_auth(self, asset=None, username=None):
|
||||
instance = super().load_asset_special_auth(asset=asset, username=username)
|
||||
def _merge_auth(self, other):
|
||||
super()._merge_auth(other)
|
||||
if self.username_same_with_user:
|
||||
instance.username = username
|
||||
return instance
|
||||
self.username = other.username
|
||||
|
||||
@property
|
||||
def cmd_filter_rules(self):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db.models import Count
|
||||
|
||||
|
@ -164,6 +163,14 @@ class SystemUserListSerializer(SystemUserSerializer):
|
|||
|
||||
class SystemUserWithAuthInfoSerializer(SystemUserSerializer):
|
||||
class Meta(SystemUserSerializer.Meta):
|
||||
fields = [
|
||||
'id', 'name', 'username', 'protocol',
|
||||
'password', 'public_key', 'private_key',
|
||||
'login_mode', 'login_mode_display',
|
||||
'priority', 'username_same_with_user',
|
||||
'auto_push', 'sudo', 'shell', 'comment',
|
||||
'auto_generate_key', 'sftp_root',
|
||||
]
|
||||
extra_kwargs = {
|
||||
'nodes_amount': {'label': _('Node')},
|
||||
'assets_amount': {'label': _('Asset')},
|
||||
|
|
Loading…
Reference in New Issue