fixed CardDAV for accounts in ADS

This commit is contained in:
Ralf Becker 2013-06-29 11:41:55 +00:00
parent 300cdbe0c3
commit 5e153a1a48
2 changed files with 8 additions and 10 deletions

View File

@ -108,15 +108,13 @@ class addressbook_ads extends addressbook_ldap
// AD seems to use user, instead of inetOrgPerson // AD seems to use user, instead of inetOrgPerson
unset($this->schema2egw['posixaccount']); unset($this->schema2egw['posixaccount']);
$this->schema2egw['user'] = $this->schema2egw['inetorgperson']; $this->schema2egw['user'] = array_merge($this->schema2egw['inetorgperson'], array(
$this->schema2egw['user'] += array(
'account_id' => 'objectsid', 'account_id' => 'objectsid',
'account_lid' => 'samaccountname', 'id' => 'objectguid',
'contact_uid' => 'objectguid', 'uid' => 'objectguid',
'n_fn' => 'displayname', // leave CN used in DN untouched
'accountexpires', 'useraccountcontrol', // needed to exclude deactivated or expired accounts 'accountexpires', 'useraccountcontrol', // needed to exclude deactivated or expired accounts
); ));
$this->schema2egw['user']['n_fn'] = 'displayname'; // leave CN used in DN untouched
foreach($this->schema2egw as $schema => $attributes) foreach($this->schema2egw as $schema => $attributes)
{ {
$this->all_attributes = array_merge($this->all_attributes,array_values($attributes)); $this->all_attributes = array_merge($this->all_attributes,array_values($attributes));
@ -189,7 +187,7 @@ class addressbook_ads extends addressbook_ldap
function _user2egw(&$contact, $data) function _user2egw(&$contact, $data)
{ {
$contact['account_id'] = $this->accounts_ads->objectsid2account_id($data['objectsid']); $contact['account_id'] = $this->accounts_ads->objectsid2account_id($data['objectsid']);
$contact['id'] = $contact['contact_uid'] = $this->accounts_ads->objectguid2str($data['objectguid']); $contact['id'] = $contact['uid'] = $this->accounts_ads->objectguid2str($data['objectguid']);
// ignore system accounts // ignore system accounts
if ($contact['account_id'] < accounts_ads::MIN_ACCOUNT_ID) return false; if ($contact['account_id'] < accounts_ads::MIN_ACCOUNT_ID) return false;

View File

@ -74,8 +74,8 @@ class addressbook_groupdav extends groupdav_handler
// since 1.9.007 we allow clients to specify the URL when creating a new contact, as specified by CardDAV // since 1.9.007 we allow clients to specify the URL when creating a new contact, as specified by CardDAV
// LDAP does NOT have a carddav_name attribute --> stick with id mapped to LDAP attribute uid // LDAP does NOT have a carddav_name attribute --> stick with id mapped to LDAP attribute uid
if (version_compare($GLOBALS['egw_info']['apps']['phpgwapi']['version'], '1.9.007', '<') || if (version_compare($GLOBALS['egw_info']['apps']['phpgwapi']['version'], '1.9.007', '<') ||
$this->bo->contact_repository == 'ldap' || $this->bo->contact_repository != 'sql' ||
$this->bo->account_repository == 'ldap' && strpos($_SERVER['REQUEST_URI'].'/','/addressbook-accounts/') !== false) $this->bo->account_repository != 'sql' && strpos($_SERVER['REQUEST_URI'].'/','/addressbook-accounts/') !== false)
{ {
groupdav_handler::$path_extension = '.vcf'; groupdav_handler::$path_extension = '.vcf';
} }