Ignore:
Timestamp:
01/05/09 09:25:35 (15 years ago)
Author:
niltonneto
Message:

Correções referentes ao release 0.7.10

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/inc/class.ldap_im.inc.php

    r551 r563  
    2525        private $jid; 
    2626        private $max_result; 
     27        private $ou_User; 
    2728         
    2829        public final function __construct() 
    2930        { 
    30                 $this->ldap_host        = $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit']; 
    31                 $this->ldap_context     = $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit']; 
    32                 $this->ldap_dn          = $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit']; 
    33                 $this->ldap_pass        = $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit']; 
     31                $this->ldap_host        = (isset($_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_host']; 
     32                $this->ldap_context     = (isset($_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_context']; 
     33                $this->ldap_dn          = (isset($_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 
     34                $this->ldap_pass        = (isset($_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 
    3435                $this->jid                      = $_SESSION['phpgw_info']['jabberit_messenger']['user']; 
    3536                $this->max_result       = 50; 
     37                 
     38                // Ou User 
     39                $this->ou_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn']; 
     40                $this->ou_User = substr($this->ou_User,strpos($this->ou_User, "ou=")); 
     41                $this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc="))); 
    3642        } 
    3743 
     
    4955                { 
    5056                        $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 
    51                         $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, true ); 
     57                        $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, false ); 
    5258                } 
    5359        } 
     
    150156        } 
    151157 
    152         public final function list_users_ldap($search, $uidnumber) 
     158        public final function list_users_ldap($search, $uidnumber, $groupsDeny) 
    153159        { 
    154160                $this->_connect_ldap(); 
     
    159165                        $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto"); 
    160166                        // SERPRO 
    161                         //$justthese = array("uid","uidNumber","cn","mail","description","phpgwAccountVisible","dn","jpegPhoto");                        
    162                         $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 
     167                        //$justthese = array("uid","uidNumber","cn","mail","description","phpgwAccountVisible","dn","jpegPhoto"); 
     168                        if( $groupsDeny )                        
     169                                $search = ldap_search($this->ldap,$this->ou_User.",".$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 
     170                        else 
     171                                $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 
    163172                        $entry1 = ldap_get_entries($this->ldap,$search); 
    164173                        $entry = ldap_first_entry( $this->ldap, $search ); 
     
    243252        } 
    244253         
    245         public final function list_organizations_ldap() 
    246         { 
    247                 $result_org = "<organizations>"; 
     254        public final function listOrganizationsLdap() 
     255        { 
    248256 
    249257                $this->_connect_ldap(); 
     
    259267                foreach($entry as $tmp) 
    260268                        if($tmp['ou'][0] != "") 
    261                                 $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>";   
    262  
    263                 $result_org .= "</organizations>"; 
    264                  
     269                                $result_org[] = $tmp['ou'][0];   
     270 
    265271                return $result_org; 
    266272        } 
     273         
     274        public final function getGroupsLdap($pOrg) 
     275        { 
     276                $this->_ldapConnect(true); 
     277                $organization = 'ou=' . $pOrg['ou'] .",". $this->ldap_context; 
     278                 
     279                if( $this->ldap )        
     280                { 
     281                        $filter = "(&(phpgwAccountType=g)(objectClass=posixGroup))"; 
     282                        $justthese = array("cn","gidNumber"); 
     283                        $search = ldap_list($this->ldap, $organization, $filter, $justthese); 
     284                        $entry = ldap_get_entries( $this->ldap, $search ); 
     285 
     286                        if( $entry ) 
     287                        {                                        
     288                                $result_groups = "<ldap>"; 
     289                                foreach($entry as $tmp) 
     290                                        if( $tmp['gidnumber'][0] != "" ) 
     291                                                $result_groups .= "<org><cn>".$tmp['cn'][0]."</cn><gid>".$tmp['gidnumber'][0]."</gid></org>"; 
     292                                 
     293                                $result_groups .= "</ldap>";                                             
     294                        } 
     295                } 
     296 
     297                return $result_groups; 
     298        } 
     299 
    267300} 
    268301 
Note: See TracChangeset for help on using the changeset viewer.