From 4a4df586c6881a5ead2f4238de9f959c9e9cf14e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 15 Nov 2023 17:07:04 +0800 Subject: [PATCH 1/4] fix --- server/ldap-admin/internal/logic/getdepartmentslogic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ldap-admin/internal/logic/getdepartmentslogic.go b/server/ldap-admin/internal/logic/getdepartmentslogic.go index 64ad1294..d8a8f70a 100644 --- a/server/ldap-admin/internal/logic/getdepartmentslogic.go +++ b/server/ldap-admin/internal/logic/getdepartmentslogic.go @@ -47,7 +47,7 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth. l.svcCtx.Config.Ldap.BaseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, "(objectClass=*)", //所有object - []string{ /*"cn", "sn", "givenName", "mail", "telephoneNumber", "department", "title"*/ }, + nil, nil, ) // 执行搜索请求 From b9399f887b58e7b39d449e12aeb2fca72623ef07 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 15 Nov 2023 17:08:40 +0800 Subject: [PATCH 2/4] fix --- server/ldap-admin/internal/logic/getdepartmentslogic.go | 1 - 1 file changed, 1 deletion(-) diff --git a/server/ldap-admin/internal/logic/getdepartmentslogic.go b/server/ldap-admin/internal/logic/getdepartmentslogic.go index d8a8f70a..cf5b78dc 100644 --- a/server/ldap-admin/internal/logic/getdepartmentslogic.go +++ b/server/ldap-admin/internal/logic/getdepartmentslogic.go @@ -42,7 +42,6 @@ type DNItem struct { func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { //从ldap获取组织架构数据 - // 创建搜索请求 searchRequest := ldap.NewSearchRequest( l.svcCtx.Config.Ldap.BaseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, From 33c5cc6b0bd6a0d95e3f83a42dd7de0c26aaae86 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 15 Nov 2023 17:11:19 +0800 Subject: [PATCH 3/4] fix --- server/ldap-admin/internal/logic/getdepartmentslogic.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/ldap-admin/internal/logic/getdepartmentslogic.go b/server/ldap-admin/internal/logic/getdepartmentslogic.go index cf5b78dc..b86101b6 100644 --- a/server/ldap-admin/internal/logic/getdepartmentslogic.go +++ b/server/ldap-admin/internal/logic/getdepartmentslogic.go @@ -60,13 +60,14 @@ func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth. sortNum++ attribute := make(map[string]interface{}) for _, attr := range v.Attributes { + //objectcalss属性特别处理 if attr.Name == "objectClass" { mapObjectClass := make(map[string]struct{}) for _, objectClassItem := range attr.Values { mapObjectClass[objectClassItem] = struct{}{} } attribute[attr.Name] = mapObjectClass - } else { + } else { //普通属性 attribute[attr.Name] = strings.Join(attr.Values, ",") } } From 4e53d11cbd24ef32a07918666cf2def99c389bca Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 15 Nov 2023 17:37:40 +0800 Subject: [PATCH 4/4] fix --- server/ldap-admin/internal/logic/getdepartmentslogic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ldap-admin/internal/logic/getdepartmentslogic.go b/server/ldap-admin/internal/logic/getdepartmentslogic.go index b86101b6..da8fabdf 100644 --- a/server/ldap-admin/internal/logic/getdepartmentslogic.go +++ b/server/ldap-admin/internal/logic/getdepartmentslogic.go @@ -43,7 +43,7 @@ type DNItem struct { func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { //从ldap获取组织架构数据 searchRequest := ldap.NewSearchRequest( - l.svcCtx.Config.Ldap.BaseDN, + l.svcCtx.Config.Ldap.BaseDN, //这里后续需要修改,不同的人只能查询他的下属列表 ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, "(objectClass=*)", //所有object nil,