mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
[ldap-contacts-suggestions] Better handling of mixed case attributes
While the LDAP search is case insensitive, the array which is returned from ldap_get_entries() will only use lowercase. This means that if one configures the plugin to look for e.g. "givenName", no results will be returned.
This commit is contained in:
parent
11294a8f8b
commit
725f217778
2 changed files with 5 additions and 2 deletions
|
|
@ -45,7 +45,7 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sNameField = 'givenname';
|
private $sNameField = 'givenName';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
|
@ -141,6 +141,7 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
|
||||||
{
|
{
|
||||||
foreach ($aEmailFields as $sField)
|
foreach ($aEmailFields as $sField)
|
||||||
{
|
{
|
||||||
|
$sField = \strtolower($sField);
|
||||||
if (!empty($aLdapItem[$sField][0]))
|
if (!empty($aLdapItem[$sField][0]))
|
||||||
{
|
{
|
||||||
$sEmail = \trim($aLdapItem[$sField][0]);
|
$sEmail = \trim($aLdapItem[$sField][0]);
|
||||||
|
|
@ -153,6 +154,7 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
|
||||||
|
|
||||||
foreach ($aNameFields as $sField)
|
foreach ($aNameFields as $sField)
|
||||||
{
|
{
|
||||||
|
$sField = \strtolower($sField);
|
||||||
if (!empty($aLdapItem[$sField][0]))
|
if (!empty($aLdapItem[$sField][0]))
|
||||||
{
|
{
|
||||||
$sName = \trim($aLdapItem[$sField][0]);
|
$sName = \trim($aLdapItem[$sField][0]);
|
||||||
|
|
@ -165,6 +167,7 @@ class LdapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
|
||||||
|
|
||||||
foreach ($aUidFields as $sField)
|
foreach ($aUidFields as $sField)
|
||||||
{
|
{
|
||||||
|
$sField = \strtolower($sField);
|
||||||
if (!empty($aLdapItem[$sField][0]))
|
if (!empty($aLdapItem[$sField][0]))
|
||||||
{
|
{
|
||||||
$sUid = \trim($aLdapItem[$sField][0]);
|
$sUid = \trim($aLdapItem[$sField][0]);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class LdapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
\RainLoop\Plugins\Property::NewInstance('search_field')->SetLabel('Search field')
|
\RainLoop\Plugins\Property::NewInstance('search_field')->SetLabel('Search field')
|
||||||
->SetDefaultValue('uid'),
|
->SetDefaultValue('uid'),
|
||||||
\RainLoop\Plugins\Property::NewInstance('name_field')->SetLabel('Name field')
|
\RainLoop\Plugins\Property::NewInstance('name_field')->SetLabel('Name field')
|
||||||
->SetDefaultValue('givenname'),
|
->SetDefaultValue('givenName'),
|
||||||
\RainLoop\Plugins\Property::NewInstance('mail_field')->SetLabel('Mail field')
|
\RainLoop\Plugins\Property::NewInstance('mail_field')->SetLabel('Mail field')
|
||||||
->SetDefaultValue('mail'),
|
->SetDefaultValue('mail'),
|
||||||
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
|
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue