Roundcube Community Forum

 

roundcubemail-0.1-rc2 and Active directory

Started by Bcrosswize, February 05, 2008, 11:03:18 AM

Previous topic - Next topic

Bcrosswize

Hi everyone. Posting how I got RC and 2003 active directory working.

main.ini.php:
$rcmail_config['ldap_public']['That'] = array(
 'name'     => 'That School',
 'hosts'    => array('192.168.1.1'), // 2003 active directory server
 'port'     => 389, // 2003 active directory server port
 'base_dn'   => 'OU=That School,DC=thatschool,DC=k12,DC=state,DC=us', // base of orginazational unit
 'bind_dn'   => 'User', // 2003 active directory user to log on with
 'bind_pass'  => 'Pass', // 2003 active directory users password
 'ldap_version' => 3,   // using LDAPv3
 'search_fields' => array('sn', 'cn', 'givenName'), // 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
 'scope'    => 'sub', // search mode: sub|base|list
 'filter'    => 'mail=*',   // used for basic listing (if not empty) and will be &'d with search queries. ex: (status=act)
 'fuzzy_search' => 0); // server allows wildcard search

rcube_ldap.inc
Make it sort by 'sn'
around line 234
// we have a search result resource
  if ($this->ldap_result && $this->result->count > 0)
  {
   if ($this->sort_col && $this->prop['scope'] !== "base")
     @ldap_sort($this->conn, $this->ldap_result, $this->sort_col);

     // Change 01/30/08 Sort Results - Start
     ldap_sort($this->conn, $this->ldap_result, "sn");
     // Change 01/30/08 Sort Results - End

Make search work
around line 294
// add general filter to querry
if (!empty($this->prop['filter']))
  // Change 01/30/08 Filter Query Correction
  //$filter = '(&'.$this->prop['filter'] . $filter . ')';
  $filter = '(&('.$this->prop['filter']. ')' . $filter . ')';


Hhoodd

If we have multiply OU items, we should use base_dn "DC=thatschool,DC=k12,DC=state,DC=us" and "3268" globalcatalog AD port instead of "368"