* ActiveDirectory: fix making extra AD attributes available via custom fields with "ldap_" prefix

This commit is contained in:
ralf 2023-02-23 19:55:52 +01:00
parent ab812c8dec
commit ce555f7f0e
2 changed files with 11 additions and 1 deletions

View File

@ -339,6 +339,7 @@ class Import
{
// photo and public keys are not stored in SQL but in filesystem, fetch it to compare
$contact['files'] = 0;
if ($contact['jpegphoto'] === false) $contact['jpegphoto'] = null;
foreach($this->files2attrs as $file => [$attr, $mask, $regexp])
{
if (isset($contact[$attr]))

View File

@ -84,7 +84,7 @@ class Ads extends Ldap
*/
function __construct(array $ldap_config=null, $ds=null)
{
if (false) parent::__construct (); // quiten IDE warning, we are explicitly NOT calling parrent constructor!
if (false) parent::__construct (); // quiten IDE warning, we are explicitly NOT calling parent constructor!
$this->accountName = $GLOBALS['egw_info']['user']['account_lid'];
@ -121,6 +121,15 @@ class Ads extends Ldap
$this->ldapServerInfo = Api\Ldap\ServerInfo::get($this->ds, $this->ldap_config['ads_host']);
$this->is_samba4 = $this->ldapServerInfo->serverType == Api\Ldap\ServerInfo::SAMBA4;
// check if there are any attributes defined via custom-fields
foreach(Api\Storage\Customfields::get('addressbook') as $cf)
{
if (substr($cf['name'], 0, 5) === 'ldap_')
{
$this->schema2egw[self::CF_OBJECTCLASS]['#'.$cf['name']] = strtolower(substr($cf['name'], 5));
}
}
// AD seems to use user, instead of inetOrgPerson
unset($this->schema2egw['posixaccount']);
$this->schema2egw['user'] = array_merge($this->schema2egw['organizantionalperson'], array(