LDAP being used is AD. name_field is 'displayName'.
If I specify name_field as 'displayname', then it properly displays names in the list (for search results), but it won't show the display name in the contact details.
If I specify name_field as 'displayName', then it displays empty (but clickable) fields in the list, but the display name shows up properly in the contact details.
By dumping variables, I can see that the same is happening for firstname_field (givenName in LDAP), but that isn't a big deal since that isn't used in the listing, only in the details.
Any thoughts?
Kyle _______________________________________________ List info: http://lists.roundcube.net/dev/
Okay...
program/steps/addressbook/show.inc uses $CONTACTS->get_result()
program/steps/addressbook/list.inc uses $CONTACTS->list_records()
I tried changing both to get_result() and it didn't work. Changed both to list_records() and both work fine (with case-sensitive fields specified for search_fields and name_field arrays.
So, line 33 in show.inc changed to the following yields expected results.
if (!(($result = $CONTACTS->list_records()) && ($record = $result->first()))) {
Kyle
Terminal Addict wrote:
LDAP being used is AD. name_field is 'displayName'.
If I specify name_field as 'displayname', then it properly displays names in the list (for search results), but it won't show the display name in the contact details.
If I specify name_field as 'displayName', then it displays empty (but clickable) fields in the list, but the display name shows up properly in the contact details.
By dumping variables, I can see that the same is happening for firstname_field (givenName in LDAP), but that isn't a big deal since that isn't used in the listing, only in the details.
Any thoughts?
Kyle _______________________________________________ List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
Oops. :)
The change does indeed work, but it required the "*_field" values to be all lower case. The values in "search_fields" seem to be case-insensitive (which I believe they should be).
Kyle
Terminal Addict wrote:
Okay...
program/steps/addressbook/show.inc uses $CONTACTS->get_result()
program/steps/addressbook/list.inc uses $CONTACTS->list_records()
I tried changing both to get_result() and it didn't work. Changed both to list_records() and both work fine (with case-sensitive fields specified for search_fields and name_field arrays.
So, line 33 in show.inc changed to the following yields expected results.
if (!(($result = $CONTACTS->list_records()) && ($record = $result->first()))) {
Kyle
Terminal Addict wrote:
LDAP being used is AD. name_field is 'displayName'.
If I specify name_field as 'displayname', then it properly displays names in the list (for search results), but it won't show the display name in the contact details.
If I specify name_field as 'displayName', then it displays empty (but clickable) fields in the list, but the display name shows up properly in the contact details.
By dumping variables, I can see that the same is happening for firstname_field (givenName in LDAP), but that isn't a big deal since that isn't used in the listing, only in the details.
Any thoughts?
Kyle _______________________________________________ List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
The change to list_records didn't quite work. It seemed to work well until I did a search that returned multiple pages of results. It was possible to click on contacts in the first page and see the full details, but clicking on contacts on any subsequent pages caused it to report "Contact not found".
I changed show.inc back to get_result, and looked more carefully at all of the functions in program/include/rcube_ldap.php. The culprit is the _ldap2result function that looks for case-sensitive field maps in the LDAP results. If the ldap results return all lower case keys, then the function will exclude ones defined with mixed-case in main.inc.php.
I added an "elseif" to also check for the lower case key, and assign it if the case-sensitive check fails. LDAP attributes should be case insensitive, so there should never be separate values in "displayname" and "displayName". The "search_fields" and "*_field" values are assigned case-sensitive values in main.inc.php, and I get expected results for both the list and the contact details.
Kyle
/** * @access private */ function _ldap2result($rec) { $out = array();
if ($rec['dn'])
$out[$this->primary_key] = base64_encode($rec['dn']);
foreach ($this->fieldmap as $rf => $lf)
{
if ($rec[$lf]['count'])
$out[$rf] = $rec[$lf][0];
elseif ($rec[strtolower($lf)]['count'])
$out[$rf] = $rec[strtolower($lf)][0];
}
return $out;
Terminal Addict wrote:
Oops. :)
The change does indeed work, but it required the "*_field" values to be all lower case. The values in "search_fields" seem to be case-insensitive (which I believe they should be).
Kyle
Terminal Addict wrote:
Okay...
program/steps/addressbook/show.inc uses $CONTACTS->get_result()
program/steps/addressbook/list.inc uses $CONTACTS->list_records()
I tried changing both to get_result() and it didn't work. Changed both to list_records() and both work fine (with case-sensitive fields specified for search_fields and name_field arrays.
So, line 33 in show.inc changed to the following yields expected results.
if (!(($result = $CONTACTS->list_records()) && ($record = $result->first()))) {
Kyle
Terminal Addict wrote:
LDAP being used is AD. name_field is 'displayName'.
If I specify name_field as 'displayname', then it properly displays names in the list (for search results), but it won't show the display name in the contact details.
If I specify name_field as 'displayName', then it displays empty (but clickable) fields in the list, but the display name shows up properly in the contact details.
By dumping variables, I can see that the same is happening for firstname_field (givenName in LDAP), but that isn't a big deal since that isn't used in the listing, only in the details.
Any thoughts?
Kyle _______________________________________________ List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
Terminal Addict wrote:
foreach ($this->fieldmap as $rf => $lf) { if ($rec[$lf]['count']) $out[$rf] = $rec[$lf][0]; elseif ($rec[strtolower($lf)]['count']) $out[$rf] = $rec[strtolower($lf)][0];
Ok. Can't we do this (strtolower) in __construct()?
The main question is: Have all ldap servers case insensitive attribute names?
Well, I can't guarantee that all LDAP servers have case insensitive attribute names, but I do believe they are supposed to. :)
The problem I seemed to be having was in the way the list and show retrieved records and used '*_field'.
In my configuration, I was using 'displayName' in the 'search_fields' as well as for the 'name_field'. Changing the case in 'search_fields' had absolutely no effect on the results. I was able to use displayname and displayName interchangeably.
The problem was in 'name_field'. If I specified 'displayname' for 'name_field', the list following a search would show names, but if you click on a name in the list, the name would be empty in the details. If I specified 'displayName' for 'name_field', then the list would have empty entries, but clicking on one of those empty entries would show the full contact details including the name.
I did try strtolower in __construct(), but that only replicated one of the issues described above (I can't remember for sure which one now).
Honestly, I'm not sure why there is a difference in case-usage between the listing of records and displaying details of a specific record. As it is, it took me quite some time to track down the "filtering" effect of _ldap2result (I have admitted, and admit again here, that I am not a professional programmer or debugger :) ).
Kyle
A.L.E.C wrote:
Terminal Addict wrote:
foreach ($this->fieldmap as $rf => $lf) { if ($rec[$lf]['count']) $out[$rf] = $rec[$lf][0]; elseif ($rec[strtolower($lf)]['count']) $out[$rf] = $rec[strtolower($lf)][0];
Ok. Can't we do this (strtolower) in __construct()?
The main question is: Have all ldap servers case insensitive attribute names?
List info: http://lists.roundcube.net/dev/
Terminal Addict wrote:
The problem was in 'name_field'. If I specified 'displayname' for 'name_field', the list following a search would show names, but if you click on a name in the list, the name would be empty in the details. If I specified 'displayName' for 'name_field', then the list would have empty entries, but clicking on one of those empty entries would show the full contact details including the name.
I did try strtolower in __construct(), but that only replicated one of the issues described above (I can't remember for sure which one now).
This will probably work if we rewrite rcube_ldap::get_record() function for use ldap_get_entries() instead of ldap_get_attributes(). I don't use LDAP so I cannot test this idea.
Okay, tried replacing ldap_get_attributes with ldap_get_entries in
get_record with following results:
In both cases, when clicking on an entry, I get "The requested contact
cannot be found".
Kyle
ps: sorry ALEC for replying to you and not list (again).
Quoting "A.L.E.C" alec@alec.pl:
Terminal Addict wrote:
The problem was in 'name_field'. If I specified 'displayname' for 'name_field', the list following a search would show names, but if you click on a name in the list, the name would be empty in the details. If I specified 'displayName' for 'name_field', then the list would have empty entries, but clicking on one of those empty entries would show the full contact details including the name.
I did try strtolower in __construct(), but that only replicated one of the issues described above (I can't remember for sure which one now).
This will probably work if we rewrite rcube_ldap::get_record() function for use ldap_get_entries() instead of ldap_get_attributes(). I don't use LDAP so I cannot test this idea.
-- Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252 LAN Management System Developer http://lms.org.pl Roundcube Webmail Developer http://roundcube.net _______________________________________________ List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
taroundcube@terminal-addiction.com wrote:
Okay, tried replacing ldap_get_attributes with ldap_get_entries in
get_record with following results:
- When name_field is "displayName", I get empty entries in the list.
- When name_field is "displayname", I get names in the list.
In both cases, when clicking on an entry, I get "The requested contact
cannot be found".
Finally I've set up OpenLDAP server and I've made some changes in svn. Works for me. Verify, please.
Sorry for the late response. Moved last week, and this was first week of classes.
The changes do seem to have corrected the issue. :)
Unfortunately, I'll still need to modify rcube_ldap.php to allow me to use multiple DN's for searching. The AD implementation where I am is messy. Searching on the top DN mostly returns errors, but even if/when it works, it will include a bunch of temp/fake accounts. And, no, I didn't choose, setup, or administer the AD I'm stuck with. :)
Kyle
A.L.E.C wrote:
taroundcube@terminal-addiction.com wrote:
Okay, tried replacing ldap_get_attributes with ldap_get_entries in
get_record with following results:
- When name_field is "displayName", I get empty entries in the list.
- When name_field is "displayname", I get names in the list.
In both cases, when clicking on an entry, I get "The requested contact
cannot be found".Finally I've set up OpenLDAP server and I've made some changes in svn. Works for me. Verify, please.
List info: http://lists.roundcube.net/dev/