fix
This commit is contained in:
parent
3ef91f9b93
commit
99e7ce25de
|
@ -33,7 +33,7 @@ func NewGetDepartmentsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
|||
// func (l *GetDepartmentsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||
// }
|
||||
type mapDnItem struct {
|
||||
EntryAttribute []*ldap.EntryAttribute `json:"entry_attribute"`
|
||||
Attribute map[string]interface{} `json:"attribute"`
|
||||
DN string `json:"dn"`
|
||||
Sort int `json:"sort"`
|
||||
Child []*mapDnItem `json:"child"`
|
||||
|
@ -59,9 +59,21 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth.
|
|||
sortNum := 0
|
||||
for _, v := range searchResult.Entries {
|
||||
sortNum++
|
||||
attribute := make(map[string]interface{})
|
||||
for _, attr := range v.Attributes {
|
||||
if attr.Name == "objectClass" {
|
||||
mapObjectClass := make(map[string]struct{})
|
||||
for _, objectClassItem := range attr.Values {
|
||||
mapObjectClass[objectClassItem] = struct{}{}
|
||||
}
|
||||
attribute[attr.Name] = mapObjectClass
|
||||
} else {
|
||||
attribute[attr.Name] = strings.Join(attr.Values, ",")
|
||||
}
|
||||
}
|
||||
mapDN[v.DN] = &mapDnItem{
|
||||
DN: v.DN,
|
||||
EntryAttribute: v.Attributes,
|
||||
Attribute: attribute,
|
||||
Sort: sortNum,
|
||||
Child: make([]*mapDnItem, 0, 100),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user