Changeset 379 for trunk/expressoAdmin1_2/inc
- Timestamp:
- 07/28/08 17:02:28 (16 years ago)
- Location:
- trunk/expressoAdmin1_2/inc
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.functions.inc.php
r355 r379 755 755 "88888888888","99999999999","00000000000"); 756 756 757 /* formato do CPF */ 758 if (!(ereg("^[0-9]{3}[.][0-9]{3}[.][0-9]{3}[-][0-9]{2}$",$cpf))) 759 return false; 760 757 761 /* Retira todos os caracteres que nao sejam 0-9 */ 758 762 $cpf = ereg_replace("[^0-9]", "", $cpf); -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r355 r379 308 308 } 309 309 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) 310 //Begin: Check CPF, only if the manager has access to this field. 311 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 312 { 313 if (!empty($cpf)) 314 { 315 if (!$this->functions->checkCPF($cpf)) 323 316 { 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']);317 $result['status'] = false; 318 $result['msg'] = $this->functions->lang('Field CPF is invalid') . '.'; 319 return $result; 327 320 } 328 321 else 329 322 { 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) 323 //retira caracteres que não são números. 324 $cpf = ereg_replace("[^0-9]", "", $cpf); 325 326 $local_ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 327 if ($ldap_connection) 345 328 { 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") . "?"; 329 ldap_set_option($local_ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 330 ldap_set_option($local_ldap_connection, LDAP_OPT_REFERRALS, false); 331 ldap_bind($local_ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw']); 332 } 333 else 334 { 335 $result['status'] = false; 336 $result['msg'] = 'Falha na conexao com o ldap.'; 353 337 return $result; 354 338 } 339 340 $filter = "(&(phpgwAccountType=u)(cpf=$cpf))"; 341 $justthese = array("cn","uid"); 342 $search = ldap_search($local_ldap_connection, $context, $filter, $justthese); 343 $entries = ldap_get_entries($local_ldap_connection,$search); 344 345 if ( ($entries['count'] != 1) && (strcasecmp($uid, $entries[0]['uid'][0]) != 0) ) 346 { 347 if ($entries['count'] > 0) 348 { 349 $result['question'] = $this->functions->lang('Field CPF used by') . ":\n"; 350 for ($i=0; $i<$entries['count']; $i++) 351 { 352 if (strcasecmp($uid, $entries[$i]['uid'][0]) != 0) 353 $result['question'] .= "- " . $entries[$i]['cn'][0] . "\n"; 354 } 355 $result['question'] .= $this->functions->lang("Do you want to continue anyway") . "?"; 356 return $result; 357 } 358 } 359 ldap_close($local_ldap_connection); 355 360 } 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; 361 } 362 else if ($this->current_config['expressoAdmin_cpf_obligation']) 363 { 364 $result['status'] = false; 365 $result['msg'] = $this->functions->lang('Field CPF must be completed') . '.'; 366 return $result; 367 } 364 368 } 365 369 //End: Check CPF … … 1528 1532 if (ldap_errno($ldapMasterConnect) == '50') 1529 1533 { 1530 $result['msg'] = "Erro na funcao ldap_functions-> add_user2maillist.\n" .1534 $result['msg'] = "Erro na funcao ldap_functions->delete_user.\n" . 1531 1535 "O usuário utilizado para gravação no LDAP, DEVE ter direito de escrita.\n". 1532 1536 "O usuário " . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . " não tem este direito.\n". 1533 "Edite \"Configuração Global do Catálogo\", no módulo Administrador, Catálogo de Endereços e adicione um usuário com direitos de escrita.";1537 "Edite \"Configuração Global do Catálogo\", no módulo Administrador, Catálogo de Endereços e adicione um usuário com direitos de escrita."; 1534 1538 } 1535 1539 else -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r369 r379 365 365 $disabled_edit_photo = 'disabled'; 366 366 $disabled_phonenumber = 'disabled'; 367 $disabled_group = 'disabled'; 367 368 368 369 $display_picture = 'none'; … … 395 396 $disabled_phonenumber = ''; 396 397 } 398 // SOMENTE GRUPOS 399 if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && ($this->functions->check_acl($manager_account_lid,'edit_groups'))) 400 { 401 $disabled = 'disabled'; 402 $disabled_group = ''; 403 } 397 404 // TOTAIS MENOS O SAMBA 398 405 if (($this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes'))) … … 401 408 $disabled_password = ''; 402 409 $disabled_samba = 'disabled'; 410 $disabled_group = ''; 403 411 } 404 412 // TOTAIS … … 408 416 $disabled_password = ''; 409 417 $disabled_samba = ''; 418 $disabled_group = ''; 410 419 } 411 420 … … 421 430 $user_info = $this->user->get_user_info($_GET['account_id']); 422 431 432 // Formata o CPF 433 if ($user_info['corporative_information_cpf'] != '') 434 { 435 if (strlen($user_info['corporative_information_cpf']) < 11) 436 { 437 while (strlen($user_info['corporative_information_cpf']) < 11) 438 { 439 $user_info['corporative_information_cpf'] = '0' . $user_info['corporative_information_cpf']; 440 } 441 } 442 if (strlen($user_info['corporative_information_cpf']) == 11) 443 { 444 $cpf_tmp = str_split($user_info['corporative_information_cpf'], 3); 445 $user_info['corporative_information_cpf'] = $cpf_tmp[0] . '.' . $cpf_tmp[1] . '.' . $cpf_tmp[2] . '-' . $cpf_tmp[3]; 446 } 447 } 423 448 // JavaScript 424 449 $GLOBALS['phpgw']->js->validate_file("jscode","users","expressoAdmin1_2"); … … 606 631 'changequote_disabled' => $disabled_quote, 607 632 'disable_phonenumber' => $disabled_phonenumber, 633 'disable_group' => $disabled_group, 608 634 609 635 // Display ABAS -
trunk/expressoAdmin1_2/inc/class.user.inc.php
r355 r379 170 170 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 171 171 { 172 //retira caracteres que não são números. 173 $params['corporative_information_cpf'] = ereg_replace("[^0-9]", "", $params['corporative_information_cpf']); 174 172 175 foreach ($params as $atribute=>$value) 173 176 { … … 279 282 280 283 $dn = 'uid=' . $old_values['uid'] . ',' . strtolower($old_values['context']); 284 285 //retira caracteres que não são números. 286 $new_values['corporative_information_cpf'] = ereg_replace("[^0-9]", "", $new_values['corporative_information_cpf']); 287 281 288 $diff = array_diff($new_values, $old_values); 282 289 … … 288 295 print_r($new_values); 289 296 echo '<br>'; 290 exit; 291 */297 exit;*/ 298 292 299 293 300 $manager_account_lid = $_SESSION['phpgw_session']['session_lid']; … … 766 773 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 767 774 // GROUPS 768 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) 769 { 775 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_groups')) 776 { 777 // If the manager does not have the suficient access, the new_values.uid is empty. 778 if (empty($new_values['uid'])) 779 $user_uid = $old_values['uid']; 780 else 781 $user_uid = $new_values['uid']; 782 770 783 if (!$new_values['groups']) 771 784 $new_values['groups'] = array(); … … 781 794 { 782 795 $this->db_functions->add_user2group($gidnumber, $new_values['uidnumber']); 783 $this->ldap_functions->add_user2group($gidnumber, $ new_values['uid']);796 $this->ldap_functions->add_user2group($gidnumber, $user_uid); 784 797 $this->db_functions->write_log("adicionado usuario $dn ao grupo $gidnumber.",'','','',''); 785 798 } … … 795 808 { 796 809 $this->db_functions->remove_user2group($gidnumber, $new_values['uidnumber']); 797 $this->ldap_functions->remove_user2group($gidnumber, $ new_values['uid']);810 $this->ldap_functions->remove_user2group($gidnumber, $user_uid); 798 811 $this->db_functions->write_log("removido usuario $dn do grupo $gidnumber.",'','','',''); 799 812 }
Note: See TracChangeset
for help on using the changeset viewer.