0
我正在尝试使用ActiveLdap搜索具有特定属性值的用户,但它正在向服务器发送一些奇怪的查询。我有它设置如下:ActiveLdap根据属性查找用户
class Ldapuser < ActiveLdap::Base
ldap_mapping :dn_attribute => 'uid',
:prefix => 'ou=People',
:classes => ['top', 'inetOrgPerson']
end
,然后尝试找同学与特定专业:
Ldapuser.all(
:attribute => 'studentMajor', :value => 'CHEM',
:attribute => 'primaryAffiliation', :value => 'student',
:attribute => 'organizationalStatus', :value => 'active').each {|user|
# process the user...
}
当我运行它,它永远不会到达内部块哪里会处理用户,我必须杀死程序。 Tcpdump显示执行了三次搜索:
- searchRequest(1)“”baseObject - 它给出了0个结果。
- searchRequest(2)“cn = schema”baseObject - 它给出了115个结果。
- searchRequest(3)“ou = people,dc = myedu,dc = edu”wholeSubtree - 这需要太长时间才会中断它。
我的期望是,它会做一个查询并迅速得到约20个结果,这是我得到使用命令行使用ldapsearch时:
ldapsearch -x '(&(studentMajor=CHEM)(primaryAffiliation=student)
(organizationalStatus=active))'