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, ",") }