From d362c1d49683e8d16250998abe89ce69b203300e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 16 Nov 2023 10:53:59 +0800 Subject: [PATCH] fix --- server/ldap-admin/internal/config/config.go | 1 + server/ldap-admin/internal/logic/getdepartmentslogic.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/server/ldap-admin/internal/config/config.go b/server/ldap-admin/internal/config/config.go index 4c76a6a2..f9f82767 100644 --- a/server/ldap-admin/internal/config/config.go +++ b/server/ldap-admin/internal/config/config.go @@ -16,5 +16,6 @@ type Config struct { BindDN string Password string BaseDN string + RootDN string } } diff --git a/server/ldap-admin/internal/logic/getdepartmentslogic.go b/server/ldap-admin/internal/logic/getdepartmentslogic.go index f6cf2190..226e6a94 100644 --- a/server/ldap-admin/internal/logic/getdepartmentslogic.go +++ b/server/ldap-admin/internal/logic/getdepartmentslogic.go @@ -58,6 +58,10 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth. sortNum := 0 //每个DN存入map for _, v := range searchResult.Entries { + //如果是root用户则跳过 + if v.DN == l.svcCtx.Config.Ldap.RootDN { + continue + } sortNum++ attribute := make(map[string]interface{}) for _, attr := range v.Attributes { @@ -68,6 +72,8 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth. mapObjectClass[objectClassItem] = struct{}{} } attribute[attr.Name] = mapObjectClass + case "member": //成员不用变 + attribute[attr.Name] = attr.Values default: //普通属性 attribute[attr.Name] = strings.Join(attr.Values, ",") }