[horde] Some questions

Oscar del Rio delrio at mie.utoronto.ca
Wed Dec 19 18:51:33 UTC 2012


On 12/19/12 11:03 AM, Nicolas Fo wrote:
>
> I'd like to have the fullname (cn in my AD base) autofilled in relation
> with the login user (mail in my AD database).
>

This is the relevant part of my hooks.php which works with our openldap 
server.
It searches for uid=$username and gets the full name from "cn"
I don't know what you would need to change for Active Directory.

case 'fullname':
             if (is_null($username)) {
                 return $value;
             }
             $name='';
             $ds = @ldap_connect($ldapServer);
             if ($ds) {
                 $searchResult = @ldap_search($ds, $searchBase, 'uid=' . 
$username);
                 if (ldap_count_entries($ds,$searchResult) > 0) {
                     $information = @ldap_get_entries($ds, $searchResult);
                     if ($information)
                         $name=$information[0]['cn'][0];
                 }
                 ldap_close($ds);
             }
             return empty($name) ? $username : $name;

         }



More information about the horde mailing list