* ActiveDirectory: users not found when search starting with A-F and fixed attribute-names: company, department, ...

This commit is contained in:
Ralf Becker 2020-09-03 15:47:07 +02:00
parent 60ee8a7127
commit 7614e3e851
2 changed files with 35 additions and 6 deletions

View File

@ -118,11 +118,8 @@ class Ads extends Ldap
// AD seems to use user, instead of inetOrgPerson
unset($this->schema2egw['posixaccount']);
$this->schema2egw['user'] = array_merge($this->schema2egw['inetorgperson'], array(
$this->schema2egw['user'] = array_merge($this->schema2egw['organizantionalperson'], array(
'account_id' => 'objectsid',
'id' => 'objectguid',
'uid' => 'objectguid',
'n_fn' => 'displayname', // leave CN used in DN untouched
'accountexpires', 'useraccountcontrol', // needed to exclude deactivated or expired accounts
));
unset($this->schema2egw['user']['n_fileas']);
@ -160,7 +157,7 @@ class Ads extends Ldap
{
// check that GUID eg. from URL contains only valid hex characters and dash
// we cant use ldap::quote() for win2008r2 hex GUID, as it contains backslashes
if (!preg_match('/^[0-9A-Fa-f-]+/', $contact_id))
if (strlen($contact_id) !== 36 || !preg_match('/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i', $contact_id))
{
throw new Api\Exception\AssertionFailed("'$contact_id' is NOT a valid GUID!");
}

View File

@ -158,7 +158,39 @@ class Ldap
'uid' => 'entryuuid',
'id' => 'uid',
),
'organizantionalperson' => [ // ActiveDirectory
'n_fn' => 'displayname', // to leave CN as part of DN untouched
'n_given' => 'givenname',
'n_family' => 'sn',
//'sound' => 'audio',
'note' => 'description',
'url' => 'url',
'org_name' => 'company',
'org_unit' => 'department',
'title' => 'title',
'adr_one_street' => 'streetaddress',
'adr_one_locality' => 'l',
'adr_one_region' => 'st',
'adr_one_postalcode' => 'postalcode',
'adr_one_countryname' => 'co',
'adr_one_countrycode' => 'countrycode',
'tel_work' => 'telephonenumber',
'tel_home' => 'homephone',
'tel_fax' => 'facsimiletelephonenumber',
'tel_cell' => 'mobile',
'tel_pager' => 'pager',
'tel_other' => 'othertelephone',
'tel_cell_private' => 'othermobile',
'assistent' => 'assistant',
'email' => 'mail',
'room' => 'roomnumber',
'jpegphoto' => 'jpegphoto',
'n_fileas' => 'displayname',
'label' => 'postaladdress',
'pubkey' => 'usersmimecertificate',
'uid' => 'objectguid',
'id' => 'objectguid',
],
#displayName
#mozillaCustom1
#mozillaCustom2