Changeset 355


Ignore:
Timestamp:
07/18/08 11:36:30 (16 years ago)
Author:
niltonneto
Message:

Alterações do Desenvolvedor.

Location:
trunk/expressoAdmin1_2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/inc/class.functions.inc.php

    r317 r355  
    747747                                return $key . '*'; 
    748748                } 
     749                 
     750                 
     751                function checkCPF($cpf) 
     752                { 
     753                        $nulos = array("12345678909","11111111111","22222222222","33333333333", 
     754                               "44444444444","55555555555","66666666666","77777777777", 
     755                           "88888888888","99999999999","00000000000"); 
     756 
     757                        /* Retira todos os caracteres que nao sejam 0-9 */ 
     758                        $cpf = ereg_replace("[^0-9]", "", $cpf); 
     759 
     760                        /*Retorna falso se houver letras no cpf */ 
     761                        if (!(ereg("[0-9]",$cpf))) 
     762                        return false; 
     763 
     764                        /* Retorna falso se o cpf for nulo */ 
     765                        if( in_array($cpf, $nulos) ) 
     766                        return false; 
     767 
     768                        /*Calcula o penúltimo dígito verificador*/ 
     769                        $acum=0; 
     770                        for($i=0; $i<9; $i++) 
     771                        { 
     772                                $acum+= $cpf[$i]*(10-$i); 
     773                        } 
     774 
     775                        $x=$acum % 11; 
     776                        $acum = ($x>1) ? (11 - $x) : 0; 
     777                        /* Retorna falso se o digito calculado eh diferente do passado na string */ 
     778                        if ($acum != $cpf[9]){ 
     779                                return false; 
     780                        } 
     781                        /*Calcula o último dígito verificador*/ 
     782                        $acum=0; 
     783                        for ($i=0; $i<10; $i++) 
     784                        { 
     785                                $acum+= $cpf[$i]*(11-$i); 
     786                        } 
     787 
     788                        $x=$acum % 11; 
     789                        $acum = ($x > 1) ? (11-$x) : 0; 
     790                        /* Retorna falso se o digito calculado eh diferente do passado na string */ 
     791                        if ( $acum != $cpf[10]) 
     792                        { 
     793                                return false; 
     794                        } 
     795                        /* Retorna verdadeiro se o cpf eh valido */ 
     796                        return true; 
     797                } 
    749798        } 
    750799         
  • trunk/expressoAdmin1_2/inc/class.group.inc.php

    r317 r355  
    168168                        if ($diff['context'] || $diff['cn']) 
    169169                        { 
    170                                 $newrdn = 'cn=' . $new_values['cn']; 
    171                                 $newparent = $new_values['context']; 
    172                                 $result =  $this->ldap_functions->change_user_context($dn, $newrdn, $newparent); 
    173                                 if (!$result['status']) 
    174                                 { 
    175                                         $return['status'] = false; 
    176                                         $return['msg'] .= $result['msg']; 
    177                                 } 
    178                                 else 
    179                                 { 
    180                                         $dn = $newrdn . ',' . $newparent; 
    181                                         $this->db_functions->write_log('Renomeado grupo de usuários de '.$old_values['cn']." para $dn.",'',$dn,$old_values['cn'],''); 
     170                                if ( (strcasecmp($old_values['cn'], $new_values['cn']) != 0) || (strcasecmp($old_values['context'], $new_values['context']) != 0) ) 
     171                                { 
     172                                        $newrdn = 'cn=' . $new_values['cn']; 
     173                                        $newparent = $new_values['context']; 
     174                                        $result =  $this->ldap_functions->change_user_context($dn, $newrdn, $newparent); 
     175                                        if (!$result['status']) 
     176                                        { 
     177                                                $return['status'] = false; 
     178                                                $return['msg'] .= $result['msg']; 
     179                                        } 
     180                                        else 
     181                                        { 
     182                                                $dn = $newrdn . ',' . $newparent; 
     183                                                $this->db_functions->write_log('Renomeado grupo de usuários de '.$old_values['cn']." para $dn.",'',$dn,$old_values['cn'],''); 
     184                                        } 
    182185                                } 
    183186                        } 
  • trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php

    r317 r355  
    77function ldapRebind($ldap_connection, $ldap_url) 
    88{ 
     9        // Enquanto estivermos utilizando referral na arvore ldap, teremos que continuar a utilizar o usuário sistemas:expresso. 
     10        // Depois, quando não existir mais referral, não existirá a necessidade de ldapRebind. 
     11        //ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_master_root_pw']); 
    912        if ( ($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] != '') && ($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['pw'] != '') ) 
    1013        { 
     
    2023        var $manager_contexts; 
    2124         
    22         function ldap_functions(){ 
     25        function ldap_functions(){               
    2326                $GLOBALS['phpgw_info']['server'] = $_SESSION['phpgw_info']['expresso']['server']; 
    2427                $this->current_config = $_SESSION['phpgw_info']['expresso']['expressoAdmin']; 
    2528                $common = new common(); 
    26                 $this->ldap = $common->ldapConnect(); 
     29                 
     30                if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) && 
     31                         (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_dn'])) && 
     32                         (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_pw'])) ) 
     33                { 
     34                        $this->ldap = $common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_master_host'], 
     35                                                                                           $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'], 
     36                                                                                           $GLOBALS['phpgw_info']['server']['ldap_master_root_pw']); 
     37                } 
     38                else 
     39                { 
     40                        $this->ldap = $common->ldapConnect(); 
     41                } 
    2742                 
    2843                $this->functions = new functions; 
     
    3146        } 
    3247         
    33         /* ldap connection following referals and using Contac Center config*/ 
     48        /* expressoAdmin: email lists : deve utilizar o ldap Host Master com o usuario e senha do CC*/ 
     49        /* ldap connection following referrals and using Master config, from setup */ 
    3450        function ldapMasterConnect() 
    3551        { 
    36                 if ( (is_array($_SESSION['phpgw_info']['expresso']['cc_ldap_server'])) && ($ldap_connection = ldap_connect($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['host'])) ) 
     52                /* 
     53                $common = new common(); 
     54                if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) && 
     55                         (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_dn'])) && 
     56                         (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_pw'])) ) 
     57                { 
     58                        $ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_master_host']); 
     59                        ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 
     60                        ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 
     61                        ldap_set_rebind_proc($ldap_connection, ldapRebind); 
     62                        ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_master_root_pw']); 
     63                } 
     64                else 
     65                { 
     66                        $ldap_connection = $common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_host'], 
     67                                                                                           $GLOBALS['phpgw_info']['server']['ldap_root_dn'], 
     68                                                                                           $GLOBALS['phpgw_info']['server']['ldap_root_pw'], true); 
     69                } 
     70                 
     71                // If success, return follow_referral connection. Else, return normal connection. 
     72                if ($ldap_connection) 
     73                        return $ldap_connection; 
     74                else 
     75                        return $this->ldap; 
     76                */ 
     77                 
     78                if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) && ($ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_master_host'])) ) 
    3779                { 
    3880                        ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 
     
    101143                $mail = $params['mail']; 
    102144                $mailalternateaddress = $params['mailalternateaddress']; 
     145                $cpf = $params['cpf']; 
    103146                                 
    104147                if ($_SESSION['phpgw_info']['expresso']['global_denied_users'][$uid]) 
     
    265308                } 
    266309 
     310                //Begin: Check CPF 
     311                if (!empty($cpf)) 
     312                { 
     313                        if (!$this->functions->checkCPF($cpf)) 
     314                        { 
     315                                $result['status'] = false; 
     316                                $result['msg'] = $this->functions->lang('Field CPF is invalid') . '.'; 
     317                                return $result; 
     318                        } 
     319                        else 
     320                        { 
     321                                $local_ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 
     322                                if ($ldap_connection) 
     323                                { 
     324                                        ldap_set_option($local_ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 
     325                                        ldap_set_option($local_ldap_connection, LDAP_OPT_REFERRALS, false); 
     326                                        ldap_bind($local_ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw']); 
     327                                } 
     328                                else 
     329                                { 
     330                                        $result['status'] = false; 
     331                                        $result['msg'] = 'Falha na conexao com o ldap.'; 
     332                                        return $result; 
     333                                } 
     334                                 
     335                                $filter = "(&(phpgwAccountType=u)(cpf=$cpf))"; 
     336                                $justthese = array("cn","uid"); 
     337                                $search = ldap_search($local_ldap_connection, $context, $filter, $justthese); 
     338                                $entries = ldap_get_entries($local_ldap_connection,$search); 
     339                                 
     340                                if ( ($entries['count'] == 1) && (strcasecmp($uid, $entries[0]['uid'][0]) == 0) ) 
     341                                {} 
     342                                else 
     343                                { 
     344                                        if ($entries['count'] > 0) 
     345                                        { 
     346                                                $result['question'] = $this->functions->lang('Field CPF used by') . ":\n"; 
     347                                                for ($i=0; $i<$entries['count']; $i++) 
     348                                                { 
     349                                                        if (strcasecmp($uid, $entries[$i]['uid'][0]) != 0) 
     350                                                                $result['question'] .= "- " . $entries[$i]['cn'][0] . "\n"; 
     351                                                } 
     352                                                $result['question'] .= $this->functions->lang("Do you want to continue anyway") . "?"; 
     353                                                return $result; 
     354                                        } 
     355                                } 
     356                                ldap_close($local_ldap_connection); 
     357                        } 
     358                } 
     359                else if ($this->current_config['expressoAdmin_cpf_obligation']) 
     360                { 
     361                        $result['status'] = false; 
     362                        $result['msg'] = $this->functions->lang('Field CPF must be completed') . '.'; 
     363                        return $result; 
     364                } 
     365                //End: Check CPF 
     366 
    267367                return $result; 
    268368        } 
     
    13571457                 
    13581458                $return['status'] = true; 
    1359                  
     1459                $return['msg'] = ""; 
     1460                                 
    13601461                // GROUPS 
    13611462                $attrs = array(); 
    1362                 $attrs['memberUid'] = $user_info['uid']; 
     1463                $attrs['memberuid'] = $user_info['uid']; 
     1464                 
    13631465                if (count($user_info['groups_info'])) 
    13641466                { 
     
    13711473                        $entry = ldap_get_entries($this->ldap, $search); 
    13721474                                $dn = $entry[0]['dn']; 
    1373                          
     1475 
    13741476                                if (!@ldap_mod_del($this->ldap, $dn, $attrs)) 
    13751477                                { 
    13761478                                        $return['status'] = false; 
    1377                                         $return['msg'] .= 'Erro em ldap_funcitons->delete_user, grupos: ' . ldap_error($this->ldap); 
     1479                                        $return['msg'] .= "Erro em ldap_functions->delete_user from group ($dn): " . ldap_error($this->ldap); 
    13781480                                } 
    13791481                        } 
  • trunk/expressoAdmin1_2/inc/class.maillist.inc.php

    r283 r355  
    144144                        if ($diff['context'] || $diff['uid']) 
    145145                        { 
    146                                 $newrdn = 'uid=' . $new_values['uid']; 
    147                                 $newparent = $new_values['context']; 
    148                                 $result =  $this->ldap_functions->change_user_context($dn, $newrdn, $newparent); 
    149                                 if (!$result['status']) 
    150                                 { 
    151                                         $return['status'] = false; 
    152                                         $return['msg'] .= $result['msg']; 
    153                                 } 
    154                                 else 
    155                                 { 
    156                                         $dn = $newrdn . ',' . $newparent; 
    157                                         $old_dn = $old_values['uid']; 
    158                                         $this->db_functions->write_log("Renomeado login da lista de $old_dn para $dn",'',$dn,$old_values['uid'],''); 
     146                                if ( (strcasecmp($old_values['uid'], $new_values['uid']) != 0) || (strcasecmp($old_values['context'], $new_values['context']) != 0) ) 
     147                                { 
     148                                        $newrdn = 'uid=' . $new_values['uid']; 
     149                                        $newparent = $new_values['context']; 
     150                                        $result =  $this->ldap_functions->change_user_context($dn, $newrdn, $newparent); 
     151                                        if (!$result['status']) 
     152                                        { 
     153                                                $return['status'] = false; 
     154                                                $return['msg'] .= $result['msg']; 
     155                                        } 
     156                                        else 
     157                                        { 
     158                                                $dn = $newrdn . ',' . $newparent; 
     159                                                $old_dn = $old_values['uid']; 
     160                                                $this->db_functions->write_log("Renomeado login da lista de $old_dn para $dn",'',$dn,$old_values['uid'],''); 
     161                                        } 
    159162                                } 
    160163                        } 
  • trunk/expressoAdmin1_2/inc/class.uilogs.inc.php

    r309 r355  
    9292                                } 
    9393                                 
    94                                 $query .= " ORDER by manager ASC, date DESC";  
     94                                $query .= " ORDER by date DESC";  
    9595                                 
    9696                                $GLOBALS['phpgw']->db->query($query); 
     
    136136                                        //_debug_array($log); 
    137137                                        $this->nextmatchs->template_alternate_row_color($p); 
    138  
     138                                         
     139                                        //Date treatment 
     140                                        $a_date = split(" ", $log['date']); 
     141                                        $a_day = split("-", $a_date[0]); 
     142                                        $a_day_tmp = array_reverse($a_day); 
     143                                        $a_day = join($a_day_tmp, "/"); 
     144                                        $a_hour = split("\.", $a_date[1]); 
     145                                         
    139146                                        $var = array( 
    140147                                                'row_manager_lid'       => $log['manager'], 
    141148                                                'row_action'            => $log['action'], 
    142                                                 'row_date'                      => $log['date'], 
     149                                                'row_date'                      => $a_day . '  ' . $a_hour[0], 
    143150                                                //'row_view'  => (!$account['account_lastname']?'&nbsp':$account['account_lastname']) 
    144151                                        ); 
  • trunk/expressoAdmin1_2/inc/class.user.inc.php

    r317 r355  
    266266                                } 
    267267 
    268                                 $this->db_functions->write_log('criado usuario','',$dn,'',''); 
     268                                $this->db_functions->write_log("criado usuario $dn",'','','',''); 
    269269                        } 
    270270 
     
    288288                        print_r($new_values); 
    289289                        echo '<br>'; 
     290                        exit; 
    290291                        */ 
    291292 
     
    310311                                if ($diff['context']) 
    311312                                { 
    312                                         $newrdn = 'uid=' . $new_values['uid']; 
    313                                         $newparent = $new_values['context']; 
    314                                         $result =  $this->ldap_functions->change_user_context($dn, $newrdn, $newparent); 
    315                                         if (!$result['status']) 
    316                                         { 
    317                                                 $return['status'] = false; 
    318                                                 $return['msg'] .= $result['msg']; 
    319                                         } 
    320                                         else 
    321                                         { 
    322                                                 $dn = $newrdn . ',' . $newparent; 
    323                                                 $this->db_functions->write_log('alterado contexto do usuario','',$dn,'',''); 
     313                                        if (strcasecmp($old_values['context'], $new_values['context']) != 0) 
     314                                        { 
     315                                                $newrdn = 'uid=' . $new_values['uid']; 
     316                                                $newparent = $new_values['context']; 
     317                                                $result =  $this->ldap_functions->change_user_context($dn, $newrdn, $newparent); 
     318                                                if (!$result['status']) 
     319                                                { 
     320                                                        $return['status'] = false; 
     321                                                        $return['msg'] .= $result['msg']; 
     322                                                } 
     323                                                else 
     324                                                { 
     325                                                        $dn = $newrdn . ',' . $newparent; 
     326                                                        $this->db_functions->write_log('alterado contexto do usuario' . $new_values['uid'] . ' de: ' . $old_values['context'] . ' para: ' . $new_values['context'],'',$dn,'',''); 
     327                                                } 
    324328                                        } 
    325329                                } 
     
    331335                                        $ldap_mod_replace['givenname'] = $new_values['givenname']; 
    332336                                        $ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn']; 
    333                                         $this->db_functions->write_log("alterado givenname do usuario",'',$dn,'',''); 
     337                                        $this->db_functions->write_log("alterado givenname do usuario $dn de ".$old_values['givenname']." para ".$new_values['givenname'],'','','',''); 
    334338                                } 
    335339                                if ($diff['sn']) 
     
    337341                                        $ldap_mod_replace['sn'] = $new_values['sn']; 
    338342                                        $ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn']; 
    339                                         $this->db_functions->write_log("altera$ldap_mod_do sn do usuario",'',$dn,'',''); 
     343                                        $this->db_functions->write_log("altera sn do usuario de ".$old_values['sn']." para ".$new_values['sn'],'','','',''); 
    340344                                } 
    341345                                if ($diff['mail']) 
     
    344348                                        $this->ldap_functions->replace_user2maillists($new_values['mail'], $old_values['mail']); 
    345349                                        $this->ldap_functions->replace_mail_from_institutional_account($new_values['mail'], $old_values['mail']); 
    346                                         $this->db_functions->write_log("alterado mail do usuario",'',$dn,'',''); 
     350                                        $this->db_functions->write_log("alterado mail do usuario $dn de " . $old_values['mail'] . " para " . $new_values['mail'],'','','',''); 
    347351                                } 
    348352                                /* 
     
    363367                                { 
    364368                                        $ldap_mod_replace['phpgwlastpasswdchange'] = '0'; 
    365                                         $this->db_functions->write_log("Expirado senha do usuário",'',$dn,'',''); 
     369                                        $this->db_functions->write_log("Expirado senha do usuário $dn",'','','',''); 
    366370                                } 
    367371                        } 
     
    395399                                        } 
    396400                                         
    397                                         $this->db_functions->write_log("alterado password do usuario",'',$dn,'',''); 
     401                                        $this->db_functions->write_log("alterado password do usuario $dn",'','','',''); 
    398402                                } 
    399403                        } 
     
    405409                                { 
    406410                                        $ldap_mod_replace['telephonenumber'] = $new_values['telephonenumber']; 
    407                                         $this->db_functions->write_log("alterado telephonenumber do usuario",'',$dn,'',''); 
     411                                        $this->db_functions->write_log("alterado telephonenumber do usuario $dn de ".$old_values['telephonenumber']." para ".$new_values['telephonenumber'],'','','',''); 
    408412                                } 
    409413                        } 
     
    426430                                                        $ldap_atribute = str_replace("corporative_information_", "", $atribute); 
    427431                                                        $ldap_mod_replace[$ldap_atribute] = $new_values[$atribute]; 
    428                                                         $this->db_functions->write_log("alterado $ldap_atribute do usuario",'',$dn,'',''); 
     432                                                        $this->db_functions->write_log("alterado $ldap_atribute do usuario $dn de ".$old_values[$atribute]." para ".$new_values[$atribute],'','','',''); 
    429433                                                } 
    430434                                                //ADD ATTRS OF CORPORATIVE 
     
    432436                                                { 
    433437                                                        $ldap_add[$ldap_atribute] = $new_values[$atribute]; 
    434                                                         $this->db_functions->write_log("adicionado $ldap_atribute ao usuario",'',$dn,'',''); 
     438                                                        $this->db_functions->write_log("adicionado $ldap_atribute ao usuario $dn de ".$old_values[$atribute]." para ".$new_values[$atribute],'','','',''); 
    435439                                                } 
    436440                                                //REMOVE ATTRS OF CORPORATIVE 
     
    438442                                                { 
    439443                                                        $ldap_remove[$ldap_atribute] = array(); 
    440                                                         $this->db_functions->write_log("removido $ldap_atribute do usuario",'',$dn,'','');       
     444                                                        $this->db_functions->write_log("removido $ldap_atribute do usuario $dn de ".$old_values[$atribute]." para ".$new_values[$atribute],'','','','');         
    441445                                                } 
    442446                                        } 
     
    448452                             ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_sambausers_attributes')) ) 
    449453                        { 
     454                                 
     455                                if ($diff['gidnumber']) 
     456                                { 
     457                                        $ldap_mod_replace['gidnumber'] = $new_values['gidnumber']; 
     458                                        $this->db_functions->write_log("alterado gidnumber do usuario $dn. De:".$old_values['gidnumber']." Para:".$new_values['gidnumber'],'','','',''); 
     459                                } 
     460                                 
    450461                                if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($new_values['userSamba']) && ($new_values['use_attrs_samba'] == 'on')) 
    451462                                { 
     463                                        if ($diff['gidnumber']) 
     464                                        { 
     465                                                $ldap_mod_replace['sambaPrimaryGroupSID']       = $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $new_values['gidnumber'])+1001); 
     466                                                $this->db_functions->write_log("alterado sambaPrimaryGroupSID do usuario $dn.",'','','',''); 
     467                                        } 
     468                                         
    452469                                        if ($diff['sambaacctflags']) 
    453470                                        { 
    454471                                                $ldap_mod_replace['sambaacctflags'] = $new_values['sambaacctflags']; 
    455                                                 $this->db_functions->write_log("alterado sambaacctflags do usuario",'',$dn,'',''); 
     472                                                $this->db_functions->write_log("alterado sambaacctflags do usuario $dn",'','','',''); 
    456473                                        } 
    457474                                        if ($diff['sambalogonscript']) 
    458475                                        { 
    459476                                                $ldap_mod_replace['sambalogonscript'] = $new_values['sambalogonscript']; 
    460                                                 $this->db_functions->write_log("alterado sambalogonscript do usuario",'',$dn,'',''); 
     477                                                $this->db_functions->write_log("alterado sambalogonscript do usuario $dn",'','','',''); 
    461478                                        } 
    462479                                        if ($diff['sambahomedirectory']) 
    463480                                        { 
    464481                                                $ldap_mod_replace['homedirectory'] = $new_values['sambahomedirectory']; 
    465                                                 $this->db_functions->write_log("alterado homedirectory do usuario",'',$dn,'',''); 
     482                                                $this->db_functions->write_log("alterado homedirectory do usuario $dn",'','','',''); 
    466483                                        } 
    467484                                        if ($diff['sambadomain']) 
     
    469486                                                $ldap_mod_replace['sambaSID']                           = $diff['sambadomain'] . '-' . ((2 * $old_values['uidnumber'])+1000); 
    470487                                                $ldap_mod_replace['sambaPrimaryGroupSID']       = $diff['sambadomain'] . '-' . ((2 * $old_values['gidnumber'])+1001); 
    471                                                 $this->db_functions->write_log("alterado dominio samba do usuario $dn para " . $params['sambadomain'],'',$dn,'',''); 
     488                                                $this->db_functions->write_log("alterado dominio samba do usuario $dn para " . $params['sambadomain'],'','','',''); 
    472489                                        } 
    473490                                } 
     
    485502                                { 
    486503                                        $this->ldap_functions->ldap_remove_photo($dn); 
    487                                         $this->db_functions->write_log("removido jpegphoto do usuario",'',$dn,'',''); 
     504                                        $this->db_functions->write_log("removido jpegphoto do usuario $dn",'','','',''); 
    488505                                } 
    489506                                elseif ($_FILES['photo']['name'] != '') 
     
    500517                                                { 
    501518                                                        $photo_exist = true; 
    502                                                         $this->db_functions->write_log("substituido jpegphoto do usuario",'',$dn,'',''); 
     519                                                        $this->db_functions->write_log("substituido jpegphoto do usuario $dn",'','','',''); 
    503520                                                } 
    504521                                                else 
    505522                                                { 
    506523                                                        $photo_exist = false; 
    507                                                         $this->db_functions->write_log("adicionado jpegphoto ao usuario",'',$dn,'',''); 
     524                                                        $this->db_functions->write_log("adicionado jpegphoto ao usuario $dn",'','','',''); 
    508525                                                }                                
    509526                                                $this->ldap_functions->ldap_save_photo($dn, $_FILES['photo']['tmp_name'], $new_values['photo_exist'], $photo_exist); 
     
    520537                                { 
    521538                                        $ldap_add['telephonenumber'] = $new_values['telephonenumber']; 
    522                                         $this->db_functions->write_log("adicionado telephonenumber ao usuario",'',$dn,'',''); 
     539                                        $this->db_functions->write_log("adicionado telephonenumber ao usuario $dn",'','','',''); 
    523540                                } 
    524541                                if (($old_values['telephonenumber'] != '') && ($new_values['telephonenumber'] == '')) 
    525542                                { 
    526543                                        $ldap_remove['telephonenumber'] = array(); 
    527                                         $this->db_functions->write_log("removido telephonenumber do usuario",'',$dn,'',''); 
     544                                        $this->db_functions->write_log("removido telephonenumber do usuario $dn",'','','',''); 
    528545                                } 
    529546                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    532549                                { 
    533550                                        $ldap_add['phpgwlastpasswdchange'] = '0'; 
    534                                         $this->db_functions->write_log("Expirado senha do usuário",'',$dn,'',''); 
     551                                        $this->db_functions->write_log("Expirado senha do usuário $dn",'','','',''); 
    535552                                } 
    536553                                if (($old_values['passwd_expired'] == '0') && ($new_values['passwd_expired'] == '')) 
    537554                                { 
    538555                                        $ldap_remove['phpgwlastpasswdchange'] = array(); 
    539                                         $this->db_functions->write_log("Removido expiração da senha do usuário",'',$dn,'',''); 
     556                                        $this->db_functions->write_log("Removido expiração da senha do usuário $dn",'','','',''); 
    540557                                } 
    541558                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    544561                                { 
    545562                                        $this->db_functions->add_pref_changepassword($new_values['uidnumber']); 
    546                                         $this->db_functions->write_log("adicionado changepassword ao usuario",'',$dn,'',''); 
     563                                        $this->db_functions->write_log("adicionado changepassword ao usuario $dn",'','','',''); 
    547564                                } 
    548565                                if (($old_values['changepassword'] != '') && ($new_values['changepassword'] == '')) 
    549566                                { 
    550567                                        $this->db_functions->remove_pref_changepassword($new_values['uidnumber']); 
    551                                         $this->db_functions->write_log("removido changepassword do usuario",'',$dn,'',''); 
     568                                        $this->db_functions->write_log("removido changepassword do usuario $dn",'','','',''); 
    552569                                } 
    553570                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    556573                                { 
    557574                                        $ldap_add['phpgwaccountstatus'] = 'A'; 
    558                                         $this->db_functions->write_log("ativado conta do usuario",'',$dn,'',''); 
     575                                        $this->db_functions->write_log("ativado conta do usuario $dn",'','','',''); 
    559576                                } 
    560577                                if (($old_values['phpgwaccountstatus'] != '') && ($new_values['phpgwaccountstatus'] == '')) 
    561578                                { 
    562579                                        $ldap_remove['phpgwaccountstatus'] = array(); 
    563                                         $this->db_functions->write_log("desativado conta do usuario",'',$dn,'',''); 
     580                                        $this->db_functions->write_log("desativado conta do usuario $dn",'','','',''); 
    564581                                } 
    565582                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    568585                                { 
    569586                                        $ldap_add['phpgwaccountvisible'] = '-1'; 
    570                                         $this->db_functions->write_log("adicionado phpgwaccountvisible ao usuario",'',$dn,'',''); 
     587                                        $this->db_functions->write_log("adicionado phpgwaccountvisible ao usuario $dn",'','','',''); 
    571588                                } 
    572589                                if (($old_values['phpgwaccountvisible'] != '') && ($new_values['phpgwaccountvisible'] == '')) 
    573590                                { 
    574591                                        $ldap_remove['phpgwaccountvisible'] = array(); 
    575                                         $this->db_functions->write_log("removido phpgwaccountvisible ao usuario",'',$dn,'',''); 
     592                                        $this->db_functions->write_log("removido phpgwaccountvisible ao usuario $dn",'','','',''); 
    576593                                } 
    577594                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    580597                                { 
    581598                                        $ldap_add['accountstatus'] = 'active'; 
    582                                         $this->db_functions->write_log("ativado conta de email do usuario",'',$dn,'',''); 
     599                                        $this->db_functions->write_log("ativado conta de email do usuario $dn",'','','',''); 
    583600                                } 
    584601                                if (($old_values['accountstatus'] != '') && ($new_values['accountstatus'] == '')) 
    585602                                { 
    586603                                        $ldap_remove['accountstatus'] = array(); 
    587                                         $this->db_functions->write_log("desativado conta de email do usuario",'',$dn,'',''); 
     604                                        $this->db_functions->write_log("desativado conta de email do usuario $dn",'','','',''); 
    588605                                } 
    589606                                /* 
     
    675692                                { 
    676693                                        $ldap_add['deliverymode'] = 'forwardOnly'; 
    677                                         $this->db_functions->write_log("adicionado forwardOnly ao usuario",'',$dn,'',''); 
     694                                        $this->db_functions->write_log("adicionado forwardOnly ao usuario $dn",'','','',''); 
    678695                                } 
    679696                                if (($old_values['deliverymode'] != '') && ($new_values['deliverymode'] == '')) 
    680697                                { 
    681698                                        $ldap_remove['deliverymode'] = array(); 
    682                                         $this->db_functions->write_log("removido forwardOnly ao usuario",'',$dn,'',''); 
     699                                        $this->db_functions->write_log("removido forwardOnly ao usuario $dn",'','','',''); 
    683700                                } 
    684701                        } 
     
    692709                                { 
    693710                                        $this->imap_functions->change_user_quota($new_values['uid'], $new_values['mailquota']); 
    694                                         $this->db_functions->write_log("alterado cota do usuario",'',$dn,'',''); 
     711                                        $this->db_functions->write_log("alterado cota do usuario $dn",'','','',''); 
    695712                                } 
    696713                        } 
     
    715732                                        $ldap_remove['sambaPwdLastSet']                 = array(); 
    716733                                        $ldap_remove['sambaPwdMustChange']              = array(); 
    717                                         $this->db_functions->write_log("removido atributos samba do usuario.",'',$dn,'',''); 
     734                                        $this->db_functions->write_log("removido atributos samba do usuario $dn.",'','','',''); 
    718735                                } 
    719736                                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    742759                                                $ldap_add['sambaPwdLastSet']            = strtotime("now"); 
    743760                                                $ldap_add['sambaPwdMustChange'] = '2147483647'; 
    744                                                 $this->db_functions->write_log("adicionado atributos samba do usuario.",'',$dn,'',''); 
     761                                                $this->db_functions->write_log("adicionado atributos samba ao usuario $dn.",'','','',''); 
    745762                                        } 
    746763                                } 
     
    765782                                                $this->db_functions->add_user2group($gidnumber, $new_values['uidnumber']); 
    766783                                                $this->ldap_functions->add_user2group($gidnumber, $new_values['uid']); 
    767                                                 $this->db_functions->write_log("adicionado usuario ao grupo $gidnumber.",'',$dn,'',''); 
     784                                                $this->db_functions->write_log("adicionado usuario $dn ao grupo $gidnumber.",'','','',''); 
    768785                                        } 
    769786                                } 
     
    779796                                                                $this->db_functions->remove_user2group($gidnumber, $new_values['uidnumber']); 
    780797                                                                $this->ldap_functions->remove_user2group($gidnumber, $new_values['uid']); 
    781                                                                 $this->db_functions->write_log("removido usuario do grupo $gidnumber.",'',$dn,'',''); 
     798                                                                $this->db_functions->write_log("removido usuario $dn do grupo $gidnumber.",'','','',''); 
    782799                                                        } 
    783800                                                } 
    784801                                        } 
    785802                                } 
    786  
     803                                /* GIDNUMBER agora é um atributo samba e pode ser alterado por gerentes com este perfil 
     804                                /* 
    787805                                if ($diff['gidnumber']) 
    788806                                { 
     
    794812                                        $this->db_functions->write_log("alterado gidnumber do usuario.",'',$dn,'',''); 
    795813                                } 
     814                                */ 
    796815                        } 
    797816                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    854873                                        { 
    855874                                                $this->ldap_functions->add_user2maillist($uid, $new_values['mail']); 
    856                                                 $this->db_functions->write_log("adicionado usuario a maillist $uid.",'',$dn,'',''); 
     875                                                $this->db_functions->write_log("adicionado usuario $dn a maillist $uid.",'','','',''); 
    857876                                        } 
    858877                                } 
     
    868887                                        { 
    869888                                                $this->ldap_functions->remove_user2maillist($uid, $new_values['mail']); 
    870                                                 $this->db_functions->write_log("removido usuario da maillist $uid.",'',$dn,'',''); 
     889                                                $this->db_functions->write_log("removido usuario $dn da maillist $uid.",'','','',''); 
    871890                                        } 
    872891                                } 
     
    947966                        } 
    948967                         
    949                         $this->db_functions->write_log('Setado senha default','',$uid,'',''); 
     968                        $this->db_functions->write_log("Setado senha default para $uid",'','','',''); 
    950969                         
    951970                        return $return; 
     
    968987                        } 
    969988                         
    970                         $this->db_functions->write_log('Retornado senha default','',$uid,'',''); 
     989                        $this->db_functions->write_log("Retornado senha default de $uid",'','','',''); 
    971990                         
    972991                        return $return; 
     
    10071026                                                $return['msg'] .= $result_ldap['msg']; 
    10081027                                        } 
    1009                                         $this->db_functions->write_log('deletado usuario','',$user_info['uid'],'',''); 
     1028                                        $this->db_functions->write_log('deletado usuario ' . $user_info['uid'],'','','',''); 
    10101029                                } 
    10111030                        } 
     
    11221141                                        $this->ldap_functions->set_user_password($new_uid, $user_password); 
    11231142                         
    1124                                         $this->db_functions->write_log('renomeado usuario',$new_uid,$uid,'',''); 
     1143                                        $this->db_functions->write_log("renomeado login do usuario $uid para $new_uid.",'','','',''); 
    11251144 
    11261145                                        $return['exec_return'] = ""; 
  • trunk/expressoAdmin1_2/js/jscode/users.js

    r309 r355  
    5656        } 
    5757 
     58        /* Validation cpf is in php now. 
     59        /* 
    5860        if (document.forms[0].corporative_information_cpf.value != "") 
    5961        { 
     
    7375                        return; 
    7476                } 
    75         } 
     77        }*/ 
    7678         
    7779        //MAIL 
     
    150152        } 
    151153 
    152         // Uid & Mail exist? 
     154        // Uid, Mail and CPF exist? 
    153155        var attrs_array = new Array(); 
    154156        attrs_array['type'] = type; 
    155157        attrs_array['uid'] = document.forms[0].uid.value; 
    156158        attrs_array['mail'] = document.forms[0].mail.value; 
     159        attrs_array['cpf'] = document.forms[0].corporative_information_cpf.value; 
     160         
    157161        if (document.forms[0].mailalternateaddress.value != '') 
    158162                attrs_array['mailalternateaddress'] = document.forms[0].mailalternateaddress.value; 
     
    165169                else 
    166170                { 
     171                        if ( (data.question) && (!confirm(data.question)) ) 
     172                        { 
     173                                return false; 
     174                        } 
     175 
    167176                        if (type == 'create_user') 
    168177                        { 
  • trunk/expressoAdmin1_2/templates/default/accounts_form.tpl

    r317 r355  
    250250                        <td colspan="4" align="left"> 
    251251                                {lang_primary_group}: 
    252                                 <select id="ea_combo_primary_user_group" name="gidnumber" {disabled}>{ea_combo_primary_user_group_options}</select> 
     252                                <select id="ea_combo_primary_user_group" name="gidnumber" {disabled_samba}>{ea_combo_primary_user_group_options}</select> 
    253253                        </td> 
    254254                </tr> 
  • trunk/expressoAdmin1_2/templates/default/config.tpl

    r283 r355  
    125125                </td> 
    126126        </tr> 
     127        <tr class="row_off"> 
     128                <td>{lang_Does_CPF_field_must_be_completed}?</td> 
     129                <td> 
     130                        <select name="newsettings[expressoAdmin_cpf_obligation]"> 
     131                                <option value="0" {selected_expressoAdmin_cpf_obligation_0}>{lang_no}</option> 
     132                                <option value="1" {selected_expressoAdmin_cpf_obligation_1}>{lang_yes}</option> 
     133                        </select>                        
     134                </td> 
     135        </tr> 
    127136 
    128137        <tr class="th"> 
Note: See TracChangeset for help on using the changeset viewer.