This commit is contained in:
laodaming
2023-11-16 18:29:45 +08:00
parent b21a2beff8
commit 1a6386f7df
5 changed files with 92 additions and 11 deletions

View File

@@ -46,7 +46,7 @@ func (l *Ldap) Delete(DN string) error {
}
// 查询资源(分组/用户)
func (l *Ldap) Search(DN, filter string, attr []string, controls []ldap.Control) (resp *ldap.SearchResult, err error) {
func (l *Ldap) Search(DN string, scope int, filter string, attr []string, controls []ldap.Control) (resp *ldap.SearchResult, err error) {
if filter == "" {
rootCn := strings.Split(l.rootDN, ",")
if len(rootCn) == 0 {
@@ -56,7 +56,7 @@ func (l *Ldap) Search(DN, filter string, attr []string, controls []ldap.Control)
}
searchRequest := ldap.NewSearchRequest(
DN,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
scope, ldap.NeverDerefAliases, 0, 0, false,
filter,
attr,
controls,