Ignore:
Timestamp:
11/23/10 15:22:12 (13 years ago)
Author:
brunocosta
Message:

Ticket #1325 - Adapta buscas LDAP para casos que não existem OUs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/class.ldap_functions.inc.php

    r3388 r3530  
    405405                        $info = ldap_get_entries($this->ds, $sr); 
    406406 
     407                        if($info["count"] == 0) 
     408                        { 
     409                            $organizations[0]['ou'] = $this->ldap_context; 
     410                        } 
     411 
    407412                        for ($i=0; $i<$info["count"]; $i++) 
    408413                                $organizations[$i] = $info[$i]["ou"][0]; 
     
    420425                $this->ldapRootConnect($referral); 
    421426                if ($this->ds) { 
    422                         $filter="(&(ou=*)(!(phpgwAccountVisible=-1)))"; 
     427                        $filter="(&(objectClass=organizationalUnit)(!(phpgwAccountVisible=-1)))"; 
    423428                        $justthese = array("ou"); 
    424429                        $sr = ldap_list($this->ds, $this->ldap_context, $filter, $justthese); 
    425430                        $info = ldap_get_entries($this->ds, $sr); 
    426431 
    427                         for ($i=0; $i<$info["count"]; $i++) 
    428                         { 
    429                                 $organizations[$i]['ou'] = $info[$i]["ou"][0]; 
    430                                 $organizations[$i]['dn'] = $info[$i]["dn"]; 
    431                         } 
    432  
     432 
     433                        if($info["count"] == 0) 
     434                        { 
     435                            $organizations[0]['ou'] = $this->ldap_context; 
     436                            $organizations[0]['dn'] = $this->ldap_context; 
     437                        } 
     438                        else{ 
     439                            for ($i=0; $i<$info["count"]; $i++) 
     440                            { 
     441                                    $organizations[$i]['ou'] = $info[$i]["ou"][0]; 
     442                                    $organizations[$i]['dn'] = $info[$i]["dn"]; 
     443                            } 
     444                        } 
    433445                        ldap_close($this->ds); 
    434446                        sort($organizations); 
Note: See TracChangeset for help on using the changeset viewer.