mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-21 01:54:23 +00:00
Allow multiple trees for baseDN (closes 1876287).
This commit is contained in:
parent
a4df7abe9f
commit
3c0cb7a264
@ -112,10 +112,11 @@ class ldapDrivers
|
|||||||
}
|
}
|
||||||
$this->valid = true;
|
$this->valid = true;
|
||||||
//root to start search
|
//root to start search
|
||||||
$this->baseDNUsers = $config['baseDNUsers'];
|
$this->baseDNUsers = is_string($config['baseDNUsers']) ? array($this->baseDNUsers) : $config['baseDNUsers'];
|
||||||
$this->filterUsers = $config['filterUsers'];
|
$this->filterUsers = $config['filterUsers'];
|
||||||
$this->baseDNGroups = $config['baseDNGroups'];
|
$this->baseDNGroups = $config['baseDNGroups'];
|
||||||
$this->filterGroups = $config['filterGroups'];
|
$this->filterGroups = $config['filterGroups'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,18 +126,21 @@ class ldapDrivers
|
|||||||
global $c;
|
global $c;
|
||||||
|
|
||||||
$query = $this->ldap_query_all;
|
$query = $this->ldap_query_all;
|
||||||
$entry = $query($this->connect,$this->baseDNUsers,$this->filterUsers,$attributes);
|
|
||||||
if (!ldap_first_entry($this->connect,$entry))
|
foreach($this->baseDNUsers as $baseDNUsers) {
|
||||||
$c->messages[] = sprintf(i18n("Error NoUserFound with filter >%s<, attributes >%s< , dn >%s<"),$this->filterUsers,join(', ',$attributes), $this->baseDNUsers);
|
$entry = $query($this->connect,$baseDNUsers,$this->filterUsers,$attributes);
|
||||||
for($i=ldap_first_entry($this->connect,$entry);
|
|
||||||
$i&&$arr=ldap_get_attributes($this->connect,$i);
|
if (!ldap_first_entry($this->connect,$entry))
|
||||||
$i=ldap_next_entry($this->connect,$i)
|
$c->messages[] = sprintf(i18n("Error NoUserFound with filter >%s<, attributes >%s< , dn >%s<"),$this->filterUsers,join(', ',$attributes), $baseDNUsers);
|
||||||
)
|
|
||||||
{
|
for($i = ldap_first_entry($this->connect,$entry);
|
||||||
for($j=0;$j<$arr['count'];$j++){
|
$i && $arr = ldap_get_attributes($this->connect,$i);
|
||||||
|
$i = ldap_next_entry($this->connect,$i) ) {
|
||||||
|
for ($j=0; $j < $arr['count']; $j++) {
|
||||||
$row[$arr[$j]] = $arr[$arr[$j]][0];
|
$row[$arr[$j]] = $arr[$arr[$j]][0];
|
||||||
|
}
|
||||||
|
$ret[]=$row;
|
||||||
}
|
}
|
||||||
$ret[]=$row;
|
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@ -154,7 +158,14 @@ class ldapDrivers
|
|||||||
$entry=NULL;
|
$entry=NULL;
|
||||||
// We get the DN of the USER
|
// We get the DN of the USER
|
||||||
$query = $this->ldap_query_one;
|
$query = $this->ldap_query_one;
|
||||||
$entry = $query($this->connect, $this->baseDNUsers, $filter,$attributes);
|
|
||||||
|
foreach($this->baseDNUsers as $baseDNUsers) {
|
||||||
|
$entry = $query($this->connect, $baseDNUsers, $filter, $attributes);
|
||||||
|
|
||||||
|
if (ldap_first_entry($this->connect,$entry) )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !ldap_first_entry($this->connect, $entry) ){
|
if ( !ldap_first_entry($this->connect, $entry) ){
|
||||||
dbg_error_log( "ERROR", "drivers_ldap : Unable to find the user with filter %s",$filter );
|
dbg_error_log( "ERROR", "drivers_ldap : Unable to find the user with filter %s",$filter );
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user