mirror of https://github.com/jumpserver/jumpserver
fix: 修复获取系统用户认证信息API
parent
4f889cfe36
commit
4cbf6dd5e6
|
@ -138,7 +138,8 @@ class SystemUserAppAuthInfoApi(generics.RetrieveAPIView):
|
|||
instance = super().get_object()
|
||||
app_id = self.kwargs.get('app_id')
|
||||
user_id = self.request.query_params.get("user_id")
|
||||
instance.load_app_more_auth(app_id, user_id)
|
||||
username = self.request.query_params.get("username")
|
||||
instance.load_app_more_auth(app_id, username, user_id)
|
||||
return instance
|
||||
|
||||
|
||||
|
|
|
@ -129,12 +129,21 @@ class AuthMixin:
|
|||
if password:
|
||||
self.password = password
|
||||
|
||||
def load_app_more_auth(self, app_id=None, user_id=None):
|
||||
def load_app_more_auth(self, app_id=None, username=None, user_id=None):
|
||||
self._clean_auth_info_if_manual_login_mode()
|
||||
# 加载临时认证信息
|
||||
if self.login_mode == self.LOGIN_MANUAL:
|
||||
self._load_tmp_auth_if_has(app_id, user_id)
|
||||
return
|
||||
# 更新用户名
|
||||
from users.models import User
|
||||
user = get_object_or_none(User, pk=user_id) if user_id else None
|
||||
if self.username_same_with_user:
|
||||
if user and not username:
|
||||
_username = user.username
|
||||
else:
|
||||
_username = username
|
||||
self.username = _username
|
||||
|
||||
def load_asset_special_auth(self, asset, username=''):
|
||||
"""
|
||||
|
|
|
@ -294,7 +294,7 @@ class SecretDetailMixin:
|
|||
data.update(asset_detail)
|
||||
else:
|
||||
app_detail = self._get_application_secret_detail(app)
|
||||
system_user.load_app_more_auth(app.id, user.id)
|
||||
system_user.load_app_more_auth(app.id, user.username, user.id)
|
||||
data['type'] = 'application'
|
||||
data.update(app_detail)
|
||||
|
||||
|
|
Loading…
Reference in New Issue