forked from extern/egroupware
* Addressbook/ActiveDirectory: accounts addressbook was empty, if not explicit context was set
This commit is contained in:
parent
7b9bcffb74
commit
fe96404533
@ -38,7 +38,7 @@ class addressbook_ads extends addressbook_ldap
|
|||||||
* Filter used for accounts addressbook
|
* Filter used for accounts addressbook
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $accountsFilter = '(objectclass=user)';
|
var $accountsFilter = '(objectCategory=person)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute used for DN
|
* Attribute used for DN
|
||||||
@ -70,7 +70,6 @@ class addressbook_ads extends addressbook_ldap
|
|||||||
*/
|
*/
|
||||||
function __construct(array $ldap_config=null, $ds=null)
|
function __construct(array $ldap_config=null, $ds=null)
|
||||||
{
|
{
|
||||||
//$this->db_data_cols = $this->stock_contact_fields + $this->non_contact_fields;
|
|
||||||
$this->accountName = $GLOBALS['egw_info']['user']['account_lid'];
|
$this->accountName = $GLOBALS['egw_info']['user']['account_lid'];
|
||||||
|
|
||||||
if ($ldap_config)
|
if ($ldap_config)
|
||||||
|
@ -705,15 +705,7 @@ class addressbook_ldap
|
|||||||
*/
|
*/
|
||||||
function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false)
|
function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false)
|
||||||
{
|
{
|
||||||
#$order_by = explode(',',$order_by);
|
error_log(__METHOD__."(".array2string($criteria).", ".array2string($only_keys).", '$order_by', ".array2string($extra_cols).", '$wildcard', '$empty', '$op', ".array2string($start).", ".array2string($filter).")");
|
||||||
#$order_by = explode(' ',$order_by);
|
|
||||||
#$sort = $order_by[0];
|
|
||||||
#$order = $order_by[1];
|
|
||||||
#$query = $criteria;
|
|
||||||
#$fields = $only_keys ? ($only_keys === true ? $this->contacts_id : $only_keys) : '';
|
|
||||||
#$limit = $need_full_no_count ? 0 : $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
|
||||||
#return parent::read($start,$limit,$fields,$query,$filter,$sort,$order);
|
|
||||||
|
|
||||||
if (is_array($filter['owner']))
|
if (is_array($filter['owner']))
|
||||||
{
|
{
|
||||||
if (count($filter['owner']) == 1)
|
if (count($filter['owner']) == 1)
|
||||||
@ -769,7 +761,7 @@ class addressbook_ldap
|
|||||||
// exclude expired accounts
|
// exclude expired accounts
|
||||||
//$shadowExpireNow = floor((time()+date('Z'))/86400);
|
//$shadowExpireNow = floor((time()+date('Z'))/86400);
|
||||||
//$objectFilter .= "(|(!(shadowExpire=*))(shadowExpire>=$shadowExpireNow))";
|
//$objectFilter .= "(|(!(shadowExpire=*))(shadowExpire>=$shadowExpireNow))";
|
||||||
// shadowExpire>= does NOT work, as shadow schema only specifies intergerMatch and not integerOrderingMatch :-(
|
// shadowExpire>= does NOT work, as shadow schema only specifies integerMatch and not integerOrderingMatch :-(
|
||||||
|
|
||||||
$searchFilter = '';
|
$searchFilter = '';
|
||||||
if(is_array($criteria) && count($criteria) > 0)
|
if(is_array($criteria) && count($criteria) > 0)
|
||||||
@ -979,9 +971,9 @@ class addressbook_ldap
|
|||||||
$_attributes[] = 'creatorsName';
|
$_attributes[] = 'creatorsName';
|
||||||
$_attributes[] = 'modifiersName';
|
$_attributes[] = 'modifiersName';
|
||||||
|
|
||||||
//echo "<p>ldap_search($this->ds, '$_ldapContext', '$_filter', ".array2string($_attributes).", 0, $this->ldapLimit)</p>\n";
|
//error_log(__METHOD__."('$_ldapContext', '$_filter', ".array2string($_attributes).", $_addressbooktype)");
|
||||||
|
|
||||||
if($_addressbooktype == ADDRESSBOOK_ALL)
|
if($_addressbooktype == ADDRESSBOOK_ALL || $_ldapContext == $this->allContactsDN)
|
||||||
{
|
{
|
||||||
$result = ldap_search($this->ds, $_ldapContext, $_filter, $_attributes, 0, $this->ldapLimit);
|
$result = ldap_search($this->ds, $_ldapContext, $_filter, $_attributes, 0, $this->ldapLimit);
|
||||||
}
|
}
|
||||||
@ -990,6 +982,7 @@ class addressbook_ldap
|
|||||||
$result = @ldap_list($this->ds, $_ldapContext, $_filter, $_attributes, 0, $this->ldapLimit);
|
$result = @ldap_list($this->ds, $_ldapContext, $_filter, $_attributes, 0, $this->ldapLimit);
|
||||||
}
|
}
|
||||||
if(!$result || !$entries = ldap_get_entries($this->ds, $result)) return array();
|
if(!$result || !$entries = ldap_get_entries($this->ds, $result)) return array();
|
||||||
|
//error_log(__METHOD__."('$_ldapContext', '$_filter', ".array2string($_attributes).", $_addressbooktype) result of $entries[count]");
|
||||||
|
|
||||||
$this->total = $entries['count'];
|
$this->total = $entries['count'];
|
||||||
foreach($entries as $i => $entry)
|
foreach($entries as $i => $entry)
|
||||||
|
Loading…
Reference in New Issue
Block a user