Changeset 3186


Ignore:
Timestamp:
08/31/10 16:23:09 (14 years ago)
Author:
fabianok
Message:

Ticket #1176 - Correção do problema de busca na base ldap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/workflow/inc/class.WorkflowLDAP.inc.php

    r3167 r3186  
    513513        function getNames($entitiesID) 
    514514        { 
     515 
     516                /* if parameter is not array make a new array with value in entitiesID */ 
     517                if(!is_array($entitiesID)) 
     518                        $entitiesID = array($entitiesID); 
     519 
    515520                /* check if the required information is in cache */ 
    516521                $methodName = 'getNames'; 
     
    530535                /* load the entity information ten entities at a time. This approach was proven to be faster on some systems */ 
    531536                $result = array(); 
     537 
    532538                while (count($entitiesID) > 0) 
    533539                { 
    534540                        $selectedEntitiesID = array_splice($entitiesID, 0, 10); 
    535                         $resourceIdentifier = ldap_search($this->dataSource, $this->ldapContext, "(|" . implode('', array_map(create_function('$a', 'return "(|(&(uidnumber={$a})(|(phpgwaccounttype=u)(phpgwaccounttype=l)))(&(gidnumber={$a})(phpgwaccounttype=g)))";'), array_unique($selectedEntitiesID))) . ')', array('cn', 'uidnumber', 'gidnumber', 'phpgwaccounttype')); 
     541 
     542                        /* if parameter is null make array without values */ 
     543                        if(!is_array($entitiesID)) 
     544                                $entitiesID = array(); 
     545                        $resourceIdentifier = ldap_search( 
     546                                $this->dataSource, 
     547                                $this->ldapContext,  
     548                                sprintf( 
     549                                        '(&(|%s)(|(phpgwaccounttype=u)(phpgwaccounttype=l)(phpgwaccounttype=g)))', 
     550                                        implode( 
     551                                                '',  
     552                                                array_map( 
     553                                                        create_function('$a', 'return "(uidnumber={$a})(gidnumber={$a})";'), 
     554                                                        array_unique($selectedEntitiesID) 
     555                                                ) 
     556                                        ) 
     557                                ), 
     558                                array('cn', 'uidnumber', 'gidnumber', 'phpgwaccounttype') 
     559                        ); 
     560 
    536561                        $result = array_merge($result, ldap_get_entries($this->dataSource, $resourceIdentifier)); 
    537562                        unset($result['count']); 
    538563                } 
     564                 
    539565 
    540566                $output = array(); 
Note: See TracChangeset for help on using the changeset viewer.