зеркало из https://github.com/mozilla/phonebook.git
Show foundation employees as well. Bug 720629.
git-svn-id: http://svn.mozilla.org/projects/phonebook/trunk@104459 4eb1ac78-321c-0410-a911-ec516a8615a5
This commit is contained in:
Родитель
5e48df8e64
Коммит
9a006b6159
19
config.php
19
config.php
|
@ -198,14 +198,23 @@ class MozillaSearchAdapter extends SearchAdapter {
|
|||
|
||||
class MozillaTreeAdapter extends TreeAdapter {
|
||||
public $conf = array(
|
||||
"ldap_search_base" => "o=com, dc=mozilla",
|
||||
"ldap_search_filter" => "mail=*",
|
||||
"ldap_search_attributes" => array(
|
||||
"sn", "cn", "manager", "title", "mail", "employeeType"
|
||||
array( // Corporation
|
||||
"ldap_search_base" => "o=com,dc=mozilla",
|
||||
"ldap_search_filter" => "mail=*",
|
||||
"ldap_search_attributes" => array(
|
||||
"sn", "cn", "manager", "title", "mail", "employeeType"
|
||||
)
|
||||
),
|
||||
array( // Foundation
|
||||
"ldap_search_base" => "o=org,dc=mozilla",
|
||||
"ldap_search_filter" => "mail=*",
|
||||
"ldap_search_attributes" => array(
|
||||
"sn", "cn", "manager", "title", "mail", "employeeType"
|
||||
)
|
||||
)
|
||||
);
|
||||
public $roots = array(
|
||||
"mitchell@mozilla.com", "gkovacs@mozilla.com"
|
||||
"mitchell@mozilla.com", "gkovacs@mozilla.com", "mark@mozillafoundation.org"
|
||||
);
|
||||
|
||||
public function process_entry($person) {
|
||||
|
|
26
tree.php
26
tree.php
|
@ -8,13 +8,16 @@ $everyone = array();
|
|||
$tree = new MozillaTreeAdapter($everyone);
|
||||
$auth = new MozillaAuthAdapter();
|
||||
|
||||
$search = ldap_search(
|
||||
$ldapconn,
|
||||
$tree->conf["ldap_search_base"],
|
||||
$tree->conf["ldap_search_filter"],
|
||||
$tree->conf["ldap_search_attributes"]
|
||||
);
|
||||
$data = ldap_get_entries($ldapconn, $search);
|
||||
$data = array();
|
||||
foreach ($tree->conf as $conf) {
|
||||
$search = ldap_search(
|
||||
$ldapconn,
|
||||
$conf["ldap_search_base"],
|
||||
$conf["ldap_search_filter"],
|
||||
$conf["ldap_search_attributes"]
|
||||
);
|
||||
$data = array_merge($data, ldap_get_entries($ldapconn, $search));
|
||||
}
|
||||
|
||||
$tree_view_roots = $tree->roots;
|
||||
foreach ($data as $person) {
|
||||
|
@ -22,7 +25,8 @@ foreach ($data as $person) {
|
|||
$everyone[$mail] = $tree->process_entry($person);
|
||||
|
||||
// If a user has a manager, try to find their place in the tree.
|
||||
if (!empty($person["manager"][0])) {
|
||||
// Unless they're a root themselves.
|
||||
if (!in_array($mail, $tree_view_roots) && !empty($person["manager"][0])) {
|
||||
$manager = $auth->dn_to_email($person["manager"][0]);
|
||||
if (empty($people[$manager])) {
|
||||
$people[$manager] = array($mail);
|
||||
|
@ -86,11 +90,11 @@ require_once "templates/header.php";
|
|||
<br />
|
||||
<div id="orphans" class="tree">
|
||||
<ul>
|
||||
<li>People who need to set their manager</li>
|
||||
<ul>
|
||||
<li class="hr-node collapsed">People who need to set their manager</li>
|
||||
<ul style="display:none">
|
||||
<?php
|
||||
foreach ($orphans as $orphan) {
|
||||
print "\n". $tree->format_item($everyone, $orphan, TRUE);
|
||||
print "\n". $tree->format_item($everyone, $orphan, true);
|
||||
}
|
||||
$invisible_people = array();
|
||||
foreach ($invisible_managers as $invisible_manager) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче