From cc1b2a657be9aba72621553706786277c76f5798 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 17 Nov 2023 09:57:32 +0800 Subject: [PATCH] fix --- server/ldap-admin/internal/logic/getldapuserinfologic.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/ldap-admin/internal/logic/getldapuserinfologic.go b/server/ldap-admin/internal/logic/getldapuserinfologic.go index 48903dd4..6777e327 100644 --- a/server/ldap-admin/internal/logic/getldapuserinfologic.go +++ b/server/ldap-admin/internal/logic/getldapuserinfologic.go @@ -43,6 +43,9 @@ func (l *GetLdapUserInfoLogic) GetLdapUserInfo(req *types.GetLdapUserInfoReq, us logx.Error(err) return resp.SetStatusWithMessage(basic.CodeServiceErr, "获取用户信息失败:"+err.Error()) } + if len(res.Entries) > 1 { + return resp.SetStatusWithMessage(basic.CodeServiceErr, "查询到的不是用户信息") + } isUser := false apiRsp := types.GetLdapUserInfoRsp{ UserId: 0, @@ -59,7 +62,7 @@ func (l *GetLdapUserInfoLogic) GetLdapUserInfo(req *types.GetLdapUserInfoReq, us } } if !isUser { - return resp.SetStatusWithMessage(basic.CodeServiceErr, "查询到的不是用户信息") + return resp.SetStatusWithMessage(basic.CodeServiceErr, "查询到的不是用户信息!!") } case "uidNumber": //用户id if len(attr.Values) == 0 { @@ -90,6 +93,9 @@ func (l *GetLdapUserInfoLogic) GetLdapUserInfo(req *types.GetLdapUserInfoReq, us } } } + if apiRsp.UserId == 0 { + return resp.SetStatusWithMessage(basic.CodeServiceErr, "查询到的不是用户信息!!!") + } return resp.SetStatusWithMessage(basic.CodeOK, "success", apiRsp) }