Author Topic: 0.2 LDAP Auto-complete Fills in system users  (Read 5922 times)

Offline smultronstallet

  • Jr. Member
  • **
  • Posts: 11
0.2 LDAP Auto-complete Fills in system users
« on: January 13, 2009, 09:34:01 PM »
After upgrading to 0.2stable (and during 0.2-pre-SVN) the LDAP email-address auto-complete no longer functions as it did in previous version.

In previous versions it would only display (auto-fill) a name if they had an email-address somewhere in their LDAP record. If they didn't have an email address, it wouldn't show up (as it should).

Now, using the same settings, RC shows system users (admin, diradmin, etc.) as well as everyone else during auto-complete searches regardless if they have an email address or not.

Is there a way to set it up as before to show only users with an email address?

Here's my LDAP config:
Code: [Select]
$rcmail_config['ldap_public']['ACME'] = array(
  'name'          => 'ACME Directory',
  'hosts'         => array('host.domain.net'),
  'port'          => 389,
  'use_tls'    => false,
  'user_specific' => false,   // If true the base_dn, bind_dn and bind_pass default to the user's IMAP login.
  // %fu - The full username provided, assumes the username is an email
  //       address, uses the username_domain value if not an email address.
  // %u  - The username prior to the '@'.
  // %d  - The domain name after the '@'.
  'base_dn'       => 'dc=host,dc=domain,dc=net',
  'bind_dn'       => 'uid=%u,cn=users,dc=host,dc=domain,dc=net',
  'bind_pass'     => '',
  'writable'      => false,   // Indicates if we can write to the LDAP directory or not.
  // If writable is true then these fields need to be populated:
  // LDAP_Object_Classes, required_fields, LDAP_rdn
  'LDAP_Object_Classes' => array("top", "inetOrgPerson"), // To create a new contact these are the object classes to specify (or any other classes you wish to use).
  'required_fields'     => array("cn", "sn", "mail"),     // The required fields needed to build a new contact as required by the object classes (can include additional fields not required by the object classes).
  'LDAP_rdn'      => 'mail', // The RDN field that is used for new entries, this field needs to be one of the search_fields, the base of base_dn is appended to the RDN to insert into the LDAP directory.
  'ldap_version'  => 3,       // using LDAPv3
  'search_fields' => array('mail', 'cn'),  // fields to search in
  'name_field'    => 'cn',    // this field represents the contact's name
  'email_field'   => 'mail',  // this field represents the contact's e-mail
  'surname_field' => 'sn',    // this field represents the contact's last name
  'firstname_field' => 'givenName',  // this field represents the contact's first name
  'sort'          => 'cn',    // The field to sort the listing by.
  'scope'         => 'sub',   // search mode: sub|base|list
  'filter'        => '',      // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
  'global_search' => true,    // perform a global search for address auto-completion on compose
  'fuzzy_search'  => true);   // server allows wildcard search

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
0.2 LDAP Auto-complete Fills in system users
« Reply #1 on: January 14, 2009, 01:01:21 AM »
./program/steps/mail/autocomplete.inc ...

If you have basic PHP coding knowledge it should be easy to some code to filter the addresses.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline smultronstallet

  • Jr. Member
  • **
  • Posts: 11
0.2 LDAP Auto-complete Fills in system users
« Reply #2 on: January 14, 2009, 12:10:57 PM »
Quote from: rosali;16339
./program/steps/mail/autocomplete.inc ...

If you have basic PHP coding knowledge it should be easy to some code to filter the addresses.


Filters can be set in the LDAP settings in main.inc.php as well, but I'm not sure how to filter out everyone without an email address. Anyone know how?

Does this not seem like a bug? Why would you want people (or accounts) without any email addresses listed?

Offline humberto.pedroso

  • Newbie
  • *
  • Posts: 1
0.2 LDAP Auto-complete Fills in system users
« Reply #3 on: January 14, 2009, 02:30:01 PM »
Hi,

You can set a filter like this: (&(mail=*)(objectClass=person))

Humberto

Offline smultronstallet

  • Jr. Member
  • **
  • Posts: 11
0.2 LDAP Auto-complete Fills in system users
« Reply #4 on: January 20, 2009, 07:35:02 PM »
Quote from: humberto.pedroso;16366
Hi,

You can set a filter like this: (&(mail=*)(objectClass=person))

Humberto


Thank you Humberto. This worked perfectly.