mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Merge 3dd6c85c87 into c154d23cfe
This commit is contained in:
commit
a9f856a2b1
2 changed files with 32 additions and 20 deletions
|
|
@ -139,8 +139,18 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
|
||||||
$sFilter .= (1 < count($aItems) ? '(|' : '').$sSubFilter.(1 < count($aItems) ? ')' : '');
|
$sFilter .= (1 < count($aItems) ? '(|' : '').$sSubFilter.(1 < count($aItems) ? ')' : '');
|
||||||
$sFilter .= ')';
|
$sFilter .= ')';
|
||||||
|
|
||||||
$this->logWrite('ldap_search: start: '.$sBaseDn.' / '.$sFilter, \LOG_INFO, 'LDAP');
|
// A directory rarely keeps everything worth suggesting in one branch:
|
||||||
$oS = @\ldap_search($oCon, $sBaseDn, $sFilter, $aItems, 0, 30, 30);
|
// meeting rooms and other bookable resources commonly live outside
|
||||||
|
// the people branch. Searching a single subtree either misses them,
|
||||||
|
// or - if the base is widened to the domain root - drags every
|
||||||
|
// service account into the suggestion list. Base DNs are therefore
|
||||||
|
// separated by '|', which cannot appear unescaped in a DN, so an
|
||||||
|
// existing single-branch configuration keeps working unchanged.
|
||||||
|
$aBaseDns = \array_filter(\array_map('trim', \explode('|', $sBaseDn)), 'strlen');
|
||||||
|
|
||||||
|
foreach ($aBaseDns as $sOneBaseDn) {
|
||||||
|
$this->logWrite('ldap_search: start: '.$sOneBaseDn.' / '.$sFilter, \LOG_INFO, 'LDAP');
|
||||||
|
$oS = @\ldap_search($oCon, $sOneBaseDn, $sFilter, $aItems, 0, 30, 30);
|
||||||
if ($oS) {
|
if ($oS) {
|
||||||
$aEntries = @\ldap_get_entries($oCon, $oS);
|
$aEntries = @\ldap_get_entries($oCon, $oS);
|
||||||
if (is_array($aEntries)) {
|
if (is_array($aEntries)) {
|
||||||
|
|
@ -161,7 +171,9 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
|
||||||
$this->logLdapError($oCon, 'ldap_get_entries');
|
$this->logLdapError($oCon, 'ldap_get_entries');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->logLdapError($oCon, 'ldap_search');
|
// One unreachable branch must not silence the others.
|
||||||
|
$this->logLdapError($oCon, 'ldap_search ('.$sOneBaseDn.')');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ class LdapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'Contacts suggestions (LDAP)',
|
NAME = 'Contacts suggestions (LDAP)',
|
||||||
VERSION = '2.14',
|
VERSION = '2.15',
|
||||||
RELEASE = '2024-03-12',
|
RELEASE = '2026-08-19',
|
||||||
REQUIRED = '2.35.3',
|
REQUIRED = '2.35.3',
|
||||||
CATEGORY = 'Contacts',
|
CATEGORY = 'Contacts',
|
||||||
DESCRIPTION = 'Get contacts suggestions from LDAP.';
|
DESCRIPTION = 'Get contacts suggestions from LDAP.';
|
||||||
|
|
@ -79,7 +79,7 @@ class LdapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
||||||
->SetDefaultValue(''),
|
->SetDefaultValue(''),
|
||||||
\RainLoop\Plugins\Property::NewInstance('base_dn')->SetLabel('Search base DN')
|
\RainLoop\Plugins\Property::NewInstance('base_dn')->SetLabel('Search base DN')
|
||||||
->SetDescription('DN to use as the search base. Supported tokens: {domain}, {domain:dc}, {email}, {email:user}, {email:domain}, {login}, {imap:login}, {imap:host}, {imap:port}')
|
->SetDescription('DN to use as the search base. Supported tokens: {domain}, {domain:dc}, {email}, {email:user}, {email:domain}, {login}, {imap:login}, {imap:host}, {imap:port} Several branches may be given, separated by | - useful when meeting rooms or other resources live outside the people branch.')
|
||||||
->SetDefaultValue('ou=People,dc=example,dc=com'),
|
->SetDefaultValue('ou=People,dc=example,dc=com'),
|
||||||
\RainLoop\Plugins\Property::NewInstance('object_classes')->SetLabel('objectClasses')
|
\RainLoop\Plugins\Property::NewInstance('object_classes')->SetLabel('objectClasses')
|
||||||
->SetDescription('LDAP objectClasses to search for, comma separated list')
|
->SetDescription('LDAP objectClasses to search for, comma separated list')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue