This commit is contained in:
laodaming 2023-11-16 10:53:59 +08:00
parent 41e446e3a5
commit d362c1d496
2 changed files with 7 additions and 0 deletions

View File

@ -16,5 +16,6 @@ type Config struct {
BindDN string
Password string
BaseDN string
RootDN string
}
}

View File

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