This commit is contained in:
laodaming 2023-11-15 17:41:16 +08:00
parent 4e53d11cbd
commit 3919dae9fe

View File

@ -56,18 +56,19 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth.
}
mapDN := make(map[string]*DNItem)
sortNum := 0
//每个DN存入map
for _, v := range searchResult.Entries {
sortNum++
attribute := make(map[string]interface{})
for _, attr := range v.Attributes {
//objectcalss属性特别处理
if attr.Name == "objectClass" {
switch attr.Name {
case "objectClass": //objectcalss属性特别处理
mapObjectClass := make(map[string]struct{})
for _, objectClassItem := range attr.Values {
mapObjectClass[objectClassItem] = struct{}{}
}
attribute[attr.Name] = mapObjectClass
} else { //普通属性
default: //普通属性
attribute[attr.Name] = strings.Join(attr.Values, ",")
}
}
@ -79,7 +80,7 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth.
Child: make([]*DNItem, 0, 100),
}
}
//组织层级关系
//组织树形层级关系
minLevel := 0
for dn, v := range mapDN {
sl := strings.Split(dn, ",")