Changeset 4590


Ignore:
Timestamp:
06/07/11 18:07:38 (13 years ago)
Author:
niltonneto
Message:

Ticket #1982 - Corrigido problema ao add/rem usuário de lista com MasterLDAP.

File:
1 edited

Legend:

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

    r3530 r4590  
    974974        function add_user2maillist($uid, $mail) 
    975975        { 
    976                 if ( !$ldapMasterConnect = $this->ldapMasterConnect() ) 
    977                 { 
    978                         $result['status'] = false; 
    979                         $result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect); 
    980                         return $result; 
    981                 } 
    982                          
    983976                $filter = "(&(phpgwAccountType=l)(uid=$uid))"; 
    984977                $justthese = array("dn"); 
    985                 $search = ldap_search($ldapMasterConnect, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
    986                 $entry = ldap_get_entries($ldapMasterConnect, $search); 
     978                $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     979                $entry = ldap_get_entries($this->ldap, $search); 
    987980                $group_dn = $entry[0]['dn']; 
    988981                $attrs['mailForwardingAddress'] = $mail; 
    989                 $res = @ldap_mod_add($ldapMasterConnect, $group_dn, $attrs); 
     982                $res = @ldap_mod_add($this->ldap, $group_dn, $attrs); 
    990983                 
    991984                if ($res) 
     
    996989                { 
    997990                        $result['status'] = false; 
    998                         if (ldap_errno($ldapMasterConnect) == '50') 
     991                        if (ldap_errno($this->ldap) == '50') 
    999992                        { 
    1000993                                $result['msg'] =        $this->functions->lang('Error on the function') . ' ldap_functions->add_user2maillist' . ".\n" . 
    1001                                                                         $this->functions->lang('The user used for record on LPDA, must have write access') . ".\n"; 
     994                                                                        $this->functions->lang('The user used for record on LDAP, must have write access') . ".\n"; 
    1002995                                                                        $this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n"; 
    1003996                                                                        $this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n"; 
    1004997                        }                                         
    1005998                        else 
    1006                                 $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect); 
    1007                 } 
    1008                  
    1009                 ldap_close($ldapMasterConnect); 
     999                                $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap); 
     1000                } 
     1001                 
     1002                ldap_close($this->ldap); 
    10101003                return $result; 
    10111004        } 
     
    10311024        function remove_user2maillist($uid, $mail) 
    10321025        { 
    1033                 if ( !$ldapMasterConnect = $this->ldapMasterConnect() ) 
    1034                 { 
    1035                         $result['status'] = false; 
    1036                         $result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect); 
    1037                         return $result; 
    1038                 } 
    1039                  
    10401026                $filter = "(&(phpgwAccountType=l)(uid=$uid))"; 
    10411027                $justthese = array("dn"); 
    1042                 $search = ldap_search($ldapMasterConnect, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
    1043                 $entry = ldap_get_entries($ldapMasterConnect, $search); 
     1028                $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     1029                $entry = ldap_get_entries($this->ldap, $search); 
    10441030                $group_dn = $entry[0]['dn']; 
    10451031                $attrs['mailForwardingAddress'] = $mail; 
    1046                 $res = @ldap_mod_del($ldapMasterConnect, $group_dn, $attrs); 
     1032                $res = @ldap_mod_del($this->ldap, $group_dn, $attrs); 
    10471033                 
    10481034                if ($res) 
     
    10531039                { 
    10541040                        $result['status'] = false; 
    1055                         if (ldap_errno($ldapMasterConnect) == '50') 
     1041                        if (ldap_errno($this->ldap) == '50') 
    10561042                        { 
    10571043                                $result['msg'] =        $this->functions->lang('Error on the function') . ' ldap_functions->remove_user2maillist' . ".\n" . 
    1058                                                                         $this->functions->lang('The user used for record on LPDA, must have write access') . ".\n"; 
     1044                                                                        $this->functions->lang('The user used for record on LDAP, must have write access') . ".\n"; 
    10591045                                                                        $this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n"; 
    10601046                                                                        $this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n"; 
    10611047                        }                                         
    10621048                        else 
    1063                                 $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect); 
    1064                 } 
    1065                 ldap_close($ldapMasterConnect); 
     1049                                $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap); 
     1050                } 
     1051                ldap_close($this->ldap); 
    10661052                return $result; 
    10671053        } 
Note: See TracChangeset for help on using the changeset viewer.