Ignore:
Timestamp:
10/09/08 08:58:47 (16 years ago)
Author:
niltonneto
Message:

Alterações do desenvolvedor, referente ao:

  • Atributo LDAP que será usado para autenticação.
  • Tela para incluir OUs que usam outro tipo de atributo (ex. mail) para autenticação.
  • Pacotes JAR assinados novamente.
Location:
trunk/jabberit_messenger/inc
Files:
1 added
5 edited

Legend:

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

    r417 r519  
    3535                $this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type']; 
    3636                $this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id']; 
     37                $this->connectDB(); 
    3738        } 
    3839 
     
    4041        { 
    4142                $this->db = new db(); 
     43                $this->db_name = ( !$this->db_name ) ? $_SESSION['phpgwinfo']['db_name'] : $this->db_name; 
     44                $this->db_host = ( !$this->db_host ) ? $_SESSION['phpgwinfo']['db_host'] : $this->db_host; 
     45                $this->db_port = ( !$this->db_port ) ? $_SESSION['phpgwinfo']['db_port'] : $this->db_port; 
     46                $this->db_user = ( !$this->db_user ) ? $_SESSION['phpgwinfo']['db_user'] : $this->db_user; 
     47                $this->db_pass = ( !$this->db_pass ) ? $_SESSION['phpgwinfo']['db_pass'] : $this->db_pass; 
     48                $this->db_type = ( !$this->db_type ) ? $_SESSION['phpgwinfo']['db_type'] : $this->db_type; 
     49                 
    4250                $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);           
    4351        }        
     
    4553        public final function getApplicationsEnabled() 
    4654        { 
    47                 $this->connectDB(); 
     55                 
    4856                $this->db->query("SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'"); 
    4957                if($this->db->num_rows()) 
     
    6169        public final function getApplicationsList() 
    6270        { 
    63                 $this->connectDB(); 
    6471                $this->db->query("SELECT * FROM phpgw_applications WHERE app_enabled = '1' order by app_name"); 
    6572                if($this->db->num_rows()) 
     
    8592        public final function get_accounts_acl() 
    8693        { 
    87                 $this->connectDB();                      
    88                  
    8994                $query  = "select acl_account from phpgw_acl where acl_location in (select acl_account from phpgw_acl where acl_appname = 'jabberit_messenger') "; 
    9095                $query .= "union select acl_account from phpgw_acl where acl_appname = 'jabberit_messenger'"; 
     
    109114        public final function getPreferences() 
    110115        { 
    111                 $this->connectDB(); 
    112                  
    113116                $result = array(); 
    114117                $query = "select * from phpgw_preferences where preference_owner = '".$this->user_id."' and preference_app = 'jabberit_messenger'"; 
     
    128131        public final function setPreferences($pParam) 
    129132        { 
    130                 $this->connectDB(); 
    131133                $preferences = $pParam['preferences']; 
    132134                $user_id  = $this->user_id; 
     
    151153        public final function setApplications($pApplications) 
    152154        { 
    153                 $this->connectDB(); 
    154155                $apps = serialize($pApplications); 
    155156                 
     
    175176                return false;    
    176177        } 
     178         
     179        public final function setAttributesLdap($pAttributes) 
     180        { 
     181                $values = $pAttributes['conf']; 
     182                $attributesOrg = "";             
     183 
     184                if( $this->db ) 
     185                { 
     186                        $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'"; 
     187 
     188                        if ( $this->db->query($query) ) 
     189                        {        
     190                                while($this->db->next_record()) 
     191                                        $result[] = $this->db->row(); 
     192                 
     193                                if(count($result) > 0) 
     194                                        $attributesOrg = $result[0]['config_value']; 
     195                        } 
     196 
     197                        if( trim($attributesOrg) == "" ) 
     198                        { 
     199                                $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','attributes_org_ldap_jabberit','".$values."')"; 
     200                                $this->db->query($query); 
     201                                 
     202                                $attr = explode(";", $values); 
     203                                $values = "<return><ou attr='".$attr[1]."'>".$attr[0]."</ou></return>"; 
     204                                return $values; 
     205                        } 
     206                        else 
     207                        { 
     208                                $org = explode(",", $attributesOrg); 
     209                                $newValue = explode(";", $values); 
     210                                 
     211                                foreach( $org as $tmp ) 
     212                                { 
     213                                        $attr = explode(";",$tmp); 
     214                                        if( strtolower(trim($attr[0])) == strtolower(trim($newValue[0])) ) 
     215                                                return false; 
     216                                } 
     217 
     218                                $values = $values . "," . $attributesOrg; 
     219                                $query = "UPDATE phpgw_config SET config_value = '".$values."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'"; 
     220                                $this->db->query($query); 
     221 
     222                                $return = explode(",",$values); 
     223                                natcasesort($return); 
     224 
     225                                $values = "<return>"; 
     226                                 
     227                                foreach($return as $tmp) 
     228                                { 
     229                                        $attr = explode(";", $tmp); 
     230                                        $values .= "<ou attr='" . $attr[1] . "'>" . $attr[0] . "</ou>"; 
     231                                } 
     232                                         
     233                                $values .= "</return>"; 
     234                                 
     235                                return $values;                          
     236                        } 
     237                } 
     238                return false;  
     239        } 
     240         
     241        public final function removeAttributesLdap($pOrg) 
     242        { 
     243                $organization = $pOrg['org']; 
     244                 
     245                if( $this->db ) 
     246                { 
     247                        $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'"; 
     248                                 
     249                        if ( $this->db->query($query) ) 
     250                        {        
     251                                while( $this->db->next_record() ) 
     252                                        $result[] = $this->db->row(); 
     253                 
     254                                if( count($result) > 0 ) 
     255                                        $attributesOrg = $result[0]['config_value']; 
     256                        } 
     257 
     258                        $attributesOrg = explode(",", $attributesOrg); 
     259                        $newValue = "";  
     260                        foreach($attributesOrg as $tmp) 
     261                        { 
     262                                $attr = explode(";",$tmp); 
     263                                  
     264                                if( strtolower(trim($attr[0])) != strtolower(trim($organization))) 
     265                                { 
     266                                        $newValue .= $attr[0] . ";" . $attr[1] . ","; 
     267                                } 
     268                        } 
     269                         
     270                        $newValue = substr($newValue, 0,(strlen($newValue) -1 )); 
     271                         
     272                        if( trim($newValue) != "") 
     273                                $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'"; 
     274                        else 
     275                                $query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'"; 
     276                                 
     277                        if( $this->db->query($query)) 
     278                                return true; 
     279                        else 
     280                                return false; 
     281                } 
     282                return false;    
     283        } 
    177284} 
    178285?> 
  • trunk/jabberit_messenger/inc/class.ldap_im.inc.php

    r417 r519  
    4949                { 
    5050                        $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 
    51                         $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass ); 
     51                        $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, true ); 
    5252                } 
    5353        } 
     
    113113        } 
    114114         
    115         public final function teste() 
     115        public final function list_organizations_ldap() 
    116116        { 
    117                  return 'dentro da classe do php'; 
     117                $result_org = "<organizations>"; 
     118 
     119                $this->_connect_ldap(); 
     120         
     121                if( $this->ldap ) 
     122                { 
     123                        $filter="ou=*";          
     124                        $justthese = array("ou"); 
     125                        $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese);                       
     126                        $entry = ldap_get_entries($this->ldap, $search); 
     127                } 
     128 
     129                foreach($entry as $tmp) 
     130                        if($tmp['ou'][0] != "") 
     131                                $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>";   
     132 
     133                $result_org .= "</organizations>"; 
     134                 
     135                return $result_org; 
    118136        } 
    119137} 
  • trunk/jabberit_messenger/inc/controller.xml

    r494 r519  
    3232                        <item ref="contacts_im" alias="list_contacts" class="contacts_im" method="list_contacts" prefix="class." suffix=".inc.php"/> 
    3333                        <item ref="db_im" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/> 
     34                        <item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/> 
    3435                        <item ref="db_im" alias="setPreferences" class="db_im" method="setPreferences" prefix="class." suffix=".inc.php"/> 
     36                        <item ref="db_im" alias="removeAttributesLdap" class="db_im" method="removeAttributesLdap" prefix="class." suffix=".inc.php"/>                   
    3537                        <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/> 
    3638                        <item ref="ldap_im" alias="photo_ldap" class="ldap_im" method="photo_ldap" prefix="class." suffix=".inc.php"/> 
  • trunk/jabberit_messenger/inc/hook_admin.inc.php

    r423 r519  
    1515        $file = array( 
    1616                'Site Configuration'    => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), 
    17                 'Enable the Expresso Messenger inside of the modules' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.edit_conf') 
     17                'Enable the Expresso Messenger inside of the modules' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.edit_conf'), 
     18                'Configuration of authentication attribute by Organization (OU)' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.edit_conf') 
    1819        ); 
    1920         
    2021//Do not modify below this line 
    2122        display_section($appname,$title,$file); 
     23         
    2224?> 
  • trunk/jabberit_messenger/inc/jabberit_sessions.inc.php

    r512 r519  
    4040                $_SESSION['phpgw_info']['jabberit_messenger']['name_company']                   = $GLOBALS['phpgw_info']['server']['name_company_applet_jabberit']; 
    4141                $_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit'] = $GLOBALS['phpgw_info']['server']['use_attribute_jabberit']; 
     42                $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit'] = $GLOBALS['phpgw_info']['server']['attributes_org_ldap_jabberit']; 
    4243 
    4344?> 
Note: See TracChangeset for help on using the changeset viewer.