diff --git a/api/src/Accounts/Import.php b/api/src/Accounts/Import.php index 4ed8881e33..110a1c9ac0 100644 --- a/api/src/Accounts/Import.php +++ b/api/src/Accounts/Import.php @@ -276,6 +276,12 @@ class Import $contact = $reconnected = null; foreach ($this->contacts->search('', false, '', 'account_lid', '', '', 'AND', $start, $filter) as $contact) { + // if we have a regexp to filter the DN, continue on non-match + if (!empty($GLOBALS['egw_info']['server']['account_import_dn_regexp']) && + !preg_match($GLOBALS['egw_info']['server']['account_import_dn_regexp'], $contact['dn'])) + { + continue; + } $new = null; if (!isset($last_modified) || (int)$last_modified < (int)$contact['modified']) { @@ -679,6 +685,12 @@ class Import $created = $updated = $uptodate = $errors = $deleted = $num = 0; foreach($this->accounts->search($filter) as $account_id => $group) { + // if we have a regexp to filter the DN, continue on non-match + if (!empty($GLOBALS['egw_info']['server']['account_import_dn_regexp']) && + !preg_match($GLOBALS['egw_info']['server']['account_import_dn_regexp'], $group['account_dn'])) + { + continue; + } // for local-groups, we always have to read all groups (to be able to determine which ones are local and preserve their memberships) if ($modified && $local_groups && $group['account_modified'] < $modified && ($sql_id = $this->accounts_sql->name2id($group['account_lid']))) diff --git a/api/src/Contacts/Ldap.php b/api/src/Contacts/Ldap.php index 753978a6ac..f8a850d7eb 100644 --- a/api/src/Contacts/Ldap.php +++ b/api/src/Contacts/Ldap.php @@ -1302,6 +1302,7 @@ class Ldap $contact = array( 'id' => $entry['uid'][0] ?? $entry['entryuuid'][0], + 'dn' => $entry['dn'], 'tid' => 'n', // the type id for the addressbook ); if (!empty($this->schema2egw[self::CF_OBJECTCLASS])) diff --git a/setup/templates/default/config.tpl b/setup/templates/default/config.tpl index ff6d273ea5..c3cefbdb25 100644 --- a/setup/templates/default/config.tpl +++ b/setup/templates/default/config.tpl @@ -469,7 +469,7 @@