diff --git a/README b/README index 4b38774..61d7efb 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ Install LDAP assumptions - 'manager' field contains a dn pointing to manager's record - everyone has a 'manager' (not true for mitchell and lilly) -- everyone's 'mail' field ends with "@mozilla.com" +- *@mozilla* can be used to glob everyone's email address TODO - diff --git a/auth.php b/auth.php index 34e5afc..4765717 100644 --- a/auth.php +++ b/auth.php @@ -16,8 +16,13 @@ if (!isset($_SERVER["PHP_AUTH_USER"])) { wail_and_bail(); } else { // Check for validity of login - if (preg_match("/[a-z]+@mozilla\\.com/", $_SERVER["PHP_AUTH_USER"])) { - $dn = "mail=". $_SERVER["PHP_AUTH_USER"] .",o=com,dc=mozilla"; + $user = $_SERVER["PHP_AUTH_USER"]; + if (preg_match('/[a-z]+@(mozilla.*)\.(.{3})/', $user, $m)) { + if ($m[1] == "mozillamessaging" && $m[2] == "com") { + $m[1] = "mozilla"; + $m[2] = "net"; + } + $dn = "mail=$user,o={$m[2]},dc={$m[1]}"; $password = $_SERVER["PHP_AUTH_PW"]; } else { wail_and_bail(); diff --git a/export.php b/export.php index 26aba2d..57569a0 100644 --- a/export.php +++ b/export.php @@ -16,7 +16,7 @@ $notifier_name = $data[0]["cn"][0]; $manager_dn = $data[0]["manager"][0]; // "OMG, not querying LDAP for the real email? That's cheating!" -preg_match("/mail=([a-z]+@mozilla\\.com),/", $manager_dn, $matches); +preg_match("/mail=([a-z]+@mozilla.*),o=/", $manager_dn, $matches); $manager_email = $matches[1]; $is_hr = in_array($manager_email, $hr_managers); // Exclude details from non-HR personnel @@ -48,7 +48,7 @@ if (function_exists($output_function)){ require_once "./templates/header.php"; ?>

PTO Notifications

-

Herro thar, .

+

Herro thar, .