【发布时间】:2015-10-29 07:08:54
【问题描述】:
我们在 Active Directory 中的用户位于不同的“根”组织单位中,我该如何搜索他们?
我目前的工作是:
$search = "CN=John Doe"
$user = "username"
$psw = "password"
$server = "ldap://servername.eng.company.co.uk";
$dn = "OU=North,DC=eng,DC=company,DC=co,DC=uk"; //this is where we have others, like OU=South,DC=eng,DC=company,DC=co,DC=uk but I need the users to search them all as they don't know what OU they are in
$ds=ldap_connect($server);
$r=ldap_bind($ds, $user , $psw);
$sr=ldap_search($ds, $dn, $search);
$data = ldap_get_entries($ds, $sr);
如果我完全删除了 OU 部分,那么它什么也不会带回来。
我尝试将其设为数组并在 foreach 循环中执行 ldap_search,但这也没有带来任何回报。
请有人指出我正确的方向吗?非常感谢
【问题讨论】:
-
组织单位(我认为)
-
这个例子in the php manual对你没用吗?
-
这不是搜索多个 OU(据我所知)