【问题标题】:php search multiple OUsphp搜索多个OU
【发布时间】: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,但这也没有带来任何回报。

请有人指出我正确的方向吗?非常感谢

【问题讨论】:

标签: php ldap


【解决方案1】:

由于 ldap_search 默认会进行子树搜索,您应该可以使用

$dn = "dc=company,dc=co,dc=uk";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多