Changeset 4953 in subversion


Ignore:
Timestamp:
Jul 22, 2011 6:49:45 AM (22 months ago)
Author:
alec
Message:
  • Fix setting fieldmap and search fields, again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/acl/acl.php

    r4950 r4953  
    8686        $this->load_config(); 
    8787 
    88         $search    = get_input_value('_search', RCUBE_INPUT_GPC, true); 
    89         $uid_field = $this->rc->config->get('acl_users_uid_field', 'uid'); 
    90         $users     = array(); 
     88        $search = get_input_value('_search', RCUBE_INPUT_GPC, true); 
     89        $users  = array(); 
    9190 
    9291        if ($this->init_ldap()) { 
     
    9594 
    9695            foreach ($result->records as $record) { 
    97                 $user = $record[$uid_field]; 
     96                $user = $record['uid']; 
    9897 
    9998                if (is_array($user)) { 
     
    103102 
    104103                if ($user) { 
    105  
    106104                    if ($record['name']) 
    107105                        $user = $record['name'] . ' (' . $user . ')'; 
     
    182180        $this->rc->output->set_env('acl_users_source', (bool) $this->rc->config->get('acl_users_source')); 
    183181        $this->rc->output->set_env('mailbox', $mbox_imap); 
    184         $this->rc->output->add_label('searching'); 
    185182        $this->rc->output->add_handlers(array( 
    186183            'acltable'  => array($this, 'templ_table'), 
     
    634631        } 
    635632 
    636         // search also in UID field 
    637         $ldap_config[$addressbook]['search_fields'] = array_unique( 
    638             array_merge((array)$uid_field, (array)$ldap_config[$addressbook]['search_fields'])); 
    639  
    640         // add UID field to fieldmap, so it will be returned in a record 
    641         if (isset($ldap_config[$addressbook]['fieldmap'])) { 
    642             if (empty($ldap_config[$addressbook]['fieldmap']['uid'])) { 
    643                 $ldap_config[$addressbook]['fieldmap']['uid'] = $uid_field; 
    644             } 
     633        $ldap_config = $ldap_config[$addressbook]; 
     634 
     635        // get name attribute 
     636        if (!empty($ldap_config['fieldmap'])) { 
     637            $name_field = $ldap_config['fieldmap']['name_field']; 
    645638        } 
    646639        // ... no fieldmap, use the old method 
    647         else if (empty($ldap_config[$addressbook]['uid_field'])) { 
    648             $ldap_config[$addressbook]['uid_field'] = $uid_field; 
    649         } 
     640        if (empty($name_field)) { 
     641            $name_field = $ldap_config['name_field']; 
     642        } 
     643 
     644        // add UID field to fieldmap, so it will be returned in a record with name 
     645        $ldap_config['fieldmap'] = array( 
     646            'name' => $name_field, 
     647            'uid'  => $uid_field, 
     648        ); 
     649 
     650        // search in UID and name fields 
     651        $ldap_config['search_fields'] = array_values($ldap_config['fieldmap']); 
     652 
     653        // disable vlv 
     654        $ldap_config['vlv'] = false; 
    650655 
    651656        // Initialize LDAP connection 
    652         $this->ldap = new rcube_ldap( 
    653             $ldap_config[$addressbook], 
     657        $this->ldap = new rcube_ldap($ldap_config, 
    654658            $this->rc->config->get('ldap_debug'), 
    655659            $this->rc->config->mail_domain($_SESSION['imap_host'])); 
Note: See TracChangeset for help on using the changeset viewer.