Changeset 5126 in subversion


Ignore:
Timestamp:
Aug 24, 2011 3:38:50 PM (21 months ago)
Author:
thomasb
Message:

Fix group members listing for ldap directories

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_ldap.php

    r5074 r5126  
    432432        if ($this->ldap_result && $this->result->count > 0) 
    433433        { 
     434            // sorting still on the ldap server 
    434435            if ($this->sort_col && $this->prop['scope'] !== 'base' && !$this->vlv_active) 
    435436                ldap_sort($this->conn, $this->ldap_result, $this->sort_col); 
    436437 
     438            // start and end of the page 
    437439            $start_row = $this->vlv_active ? 0 : $this->result->first; 
    438440            $start_row = $subset < 0 ? $start_row + $this->page_size + $subset : $start_row; 
     
    440442            $last_row = $subset != 0 ? $start_row + abs($subset) : $last_row; 
    441443 
     444            // get all entries from the ldap server 
    442445            $entries = ldap_get_entries($this->conn, $this->ldap_result); 
     446 
     447            // filtering for group members 
     448            if ($this->groups and $this->group_id) 
     449            { 
     450                $count = 0; 
     451                $members = array(); 
     452                foreach ($entries as $entry) 
     453                { 
     454                    if ($this->group_members[base64_encode($entry['dn'])]) 
     455                    { 
     456                        $members[] = $entry; 
     457                        $count++; 
     458                    } 
     459                } 
     460                $entries = $members; 
     461                $entries['count'] = $count; 
     462                $this->result->count = $count; 
     463            } 
     464 
     465            // filter entries for this page 
    443466            for ($i = $start_row; $i < min($entries['count'], $last_row); $i++) 
    444467                $this->result->add($this->_ldap2result($entries[$i])); 
    445468        } 
    446  
    447         // temp hack for filtering group members 
    448         if ($this->groups and $this->group_id) 
    449         { 
    450             $result = new rcube_result_set(); 
    451             while ($record = $this->result->iterate()) 
    452             { 
    453                 if ($this->group_members[$record['ID']]) 
    454                 { 
    455                     $result->add($record); 
    456                     $result->count++; 
    457                 } 
    458             } 
    459             $this->result = $result; 
    460         } 
    461  
    462469        return $this->result; 
    463470    } 
Note: See TracChangeset for help on using the changeset viewer.