Changeset 46 for trunk/expressoAdmin1_2/inc/class.functions.inc.php
- Timestamp:
- 08/06/07 08:54:16 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.functions.inc.php
r33 r46 103 103 return true; 104 104 break; 105 case edit_email_groups: 106 if ($array_acl[edit_email_groups]) 107 return true; 108 break; 105 109 106 110 case list_maillists: … … 175 179 function read_acl($account_lid) 176 180 { 177 /*178 $query = "SELECT * FROM phpgw_expressoadmin WHERE manager_lid = '" . $account_lid . "'";179 $GLOBALS['phpgw']->db->query($query);180 while($GLOBALS['phpgw']->db->next_record())181 {182 $result[] = $GLOBALS['phpgw']->db->row();183 }184 */185 181 $result = $this->db_functions->read_acl($account_lid); 186 182 $context_array = ldap_explode_dn($result[0]['context'], 1); 187 $tmp = array_shift($context_array); 188 $result[0]['context_display'] = implode(".", $context_array); 183 $result[0]['context_display'] = ldap_dn2ufn ( $result[0]['context'] ); 189 184 return $result; 190 185 } 191 186 192 187 // Make a array read humam 193 // Last acl: 33.554.432 188 // Last acl: 33.554.432, 67.108.864 194 189 function make_array_acl($acl) 195 190 { … … 202 197 $array_acl['edit_groups'] = $acl & 32; 203 198 $array_acl['delete_groups'] = $acl & 64; 199 $array_acl['edit_email_groups'] = $acl & 67108864; 204 200 $array_acl['change_users_password'] = $acl & 128; 205 201 $array_acl['change_users_quote'] = $acl & 262144; … … 234 230 235 231 $justthese = array("uidnumber", "uid", "cn", "mail"); 236 $filter="(&(phpgwAccountType=u)(|(uid =*".$query."*)(sn=*".$query."*)(cn=*".$query."*)(givenName=*".$query."*)(mail=$query*)))";232 $filter="(&(phpgwAccountType=u)(|(uid~=".$query.")(sn~=".$query.")(cn~=".$query.")(givenName~=".$query.")(mail~=$query)(mailAlternateAddress~=$query)))"; 237 233 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 238 234 ldap_sort($ldap_conn, $search, "uid"); … … 470 466 471 467 // Get list of all levels, this function is used for sectors module. 468 /* 472 469 function get_sectors_list($context) 473 470 { … … 477 474 478 475 if ($connection) 479 { 476 { 480 477 $bind=ldap_bind($connection); 481 478 $filter="ou=*"; 482 479 $justthese = array("ou"); 483 480 $search=ldap_list($connection, $context, $filter, $justthese); 484 ldap_sort($connection ,$search, "ou");481 ldap_sort($connection, $search, "ou"); 485 482 $info = ldap_get_entries($connection, $search); 486 483 for ($i=0; $i<$info["count"]; $i++) … … 496 493 $this->level--; 497 494 return $this->sectors_list; 495 } 496 */ 497 498 // Get list of all levels, this function is used for sectors module. 499 function get_sectors_list($context, $selected='', $referral=false ,$show_invisible_ou=false) 500 { 501 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 502 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 503 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 504 505 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 506 507 if ($referral) 508 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 1); 509 else 510 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 511 512 ldap_bind($ldap_conn,$dn,$passwd); 513 514 $justthese = array("dn"); 515 $filter = "(ou=*)"; 516 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 517 518 ldap_sort($ldap_conn, $search, "ou"); 519 $info = ldap_get_entries($ldap_conn, $search); 520 ldap_close($ldap_conn); 521 522 // Retiro o count do array info e inverto o array para ordenação. 523 for ($i=0; $i<$info["count"]; $i++) 524 { 525 $dn = $info[$i]["dn"]; 526 527 // Necessário, pq em uma busca com ldapsearch ou=*, traz tb o próprio ou. 528 if (strtolower($dn) == $context) 529 continue; 530 531 $array_dn = ldap_explode_dn ( $dn, 1 ); 532 533 $array_dn_reverse = array_reverse ( $array_dn, true ); 534 535 // Retirar o indice count do array. 536 array_pop ( $array_dn_reverse ); 537 538 $inverted_dn[$dn] = implode ( "#", $array_dn_reverse ); 539 } 540 541 // Ordenação 542 natcasesort($inverted_dn); 543 544 // Construção do select 545 $level = 0; 546 $options = array(); 547 foreach ($inverted_dn as $dn=>$invert_ufn) 548 { 549 $display = ''; 550 551 $array_dn_reverse = explode ( "#", $invert_ufn ); 552 $array_dn = array_reverse ( $array_dn_reverse, true ); 553 554 $level = count( $array_dn ) - (int)(count(explode(",", $GLOBALS['phpgw_info']['server']['ldap_context'])) + 1); 555 556 if ($level == 0) 557 $display .= '+'; 558 else 559 { 560 for ($i=0; $i<$level; $i++) 561 $display .= '---'; 562 } 563 564 reset ( $array_dn ); 565 $display .= ' ' . (current ( $array_dn ) ); 566 567 $dn = trim(strtolower($dn)); 568 $options[$dn] = $display; 569 } 570 return $options; 498 571 } 499 572
Note: See TracChangeset
for help on using the changeset viewer.