зеркало из 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 {
|
class MozillaTreeAdapter extends TreeAdapter {
|
||||||
public $conf = array(
|
public $conf = array(
|
||||||
"ldap_search_base" => "o=com, dc=mozilla",
|
array( // Corporation
|
||||||
"ldap_search_filter" => "mail=*",
|
"ldap_search_base" => "o=com,dc=mozilla",
|
||||||
"ldap_search_attributes" => array(
|
"ldap_search_filter" => "mail=*",
|
||||||
"sn", "cn", "manager", "title", "mail", "employeeType"
|
"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(
|
public $roots = array(
|
||||||
"mitchell@mozilla.com", "gkovacs@mozilla.com"
|
"mitchell@mozilla.com", "gkovacs@mozilla.com", "mark@mozillafoundation.org"
|
||||||
);
|
);
|
||||||
|
|
||||||
public function process_entry($person) {
|
public function process_entry($person) {
|
||||||
|
|
26
tree.php
26
tree.php
|
@ -8,13 +8,16 @@ $everyone = array();
|
||||||
$tree = new MozillaTreeAdapter($everyone);
|
$tree = new MozillaTreeAdapter($everyone);
|
||||||
$auth = new MozillaAuthAdapter();
|
$auth = new MozillaAuthAdapter();
|
||||||
|
|
||||||
$search = ldap_search(
|
$data = array();
|
||||||
$ldapconn,
|
foreach ($tree->conf as $conf) {
|
||||||
$tree->conf["ldap_search_base"],
|
$search = ldap_search(
|
||||||
$tree->conf["ldap_search_filter"],
|
$ldapconn,
|
||||||
$tree->conf["ldap_search_attributes"]
|
$conf["ldap_search_base"],
|
||||||
);
|
$conf["ldap_search_filter"],
|
||||||
$data = ldap_get_entries($ldapconn, $search);
|
$conf["ldap_search_attributes"]
|
||||||
|
);
|
||||||
|
$data = array_merge($data, ldap_get_entries($ldapconn, $search));
|
||||||
|
}
|
||||||
|
|
||||||
$tree_view_roots = $tree->roots;
|
$tree_view_roots = $tree->roots;
|
||||||
foreach ($data as $person) {
|
foreach ($data as $person) {
|
||||||
|
@ -22,7 +25,8 @@ foreach ($data as $person) {
|
||||||
$everyone[$mail] = $tree->process_entry($person);
|
$everyone[$mail] = $tree->process_entry($person);
|
||||||
|
|
||||||
// If a user has a manager, try to find their place in the tree.
|
// 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]);
|
$manager = $auth->dn_to_email($person["manager"][0]);
|
||||||
if (empty($people[$manager])) {
|
if (empty($people[$manager])) {
|
||||||
$people[$manager] = array($mail);
|
$people[$manager] = array($mail);
|
||||||
|
@ -86,11 +90,11 @@ require_once "templates/header.php";
|
||||||
<br />
|
<br />
|
||||||
<div id="orphans" class="tree">
|
<div id="orphans" class="tree">
|
||||||
<ul>
|
<ul>
|
||||||
<li>People who need to set their manager</li>
|
<li class="hr-node collapsed">People who need to set their manager</li>
|
||||||
<ul>
|
<ul style="display:none">
|
||||||
<?php
|
<?php
|
||||||
foreach ($orphans as $orphan) {
|
foreach ($orphans as $orphan) {
|
||||||
print "\n". $tree->format_item($everyone, $orphan, TRUE);
|
print "\n". $tree->format_item($everyone, $orphan, true);
|
||||||
}
|
}
|
||||||
$invisible_people = array();
|
$invisible_people = array();
|
||||||
foreach ($invisible_managers as $invisible_manager) {
|
foreach ($invisible_managers as $invisible_manager) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче