Exemplo n.º 1
0
function ldap_mnr2login($mnr = FALSE)
{
    // trim leading "0" to increase convenience using Barcode Scanners
    // entering points
    $mnr = ltrim($mnr, '0');
    try {
        $lms_ldap = new lms_ldap();
        $lms_ldap->bind(LDAP_LOGIN, LDAP_PASSWORD);
    } catch (Exception $e) {
        throw new Exception($e->getMessage(), E_LDAP_SERVICE_ERROR);
    }
    $ldap_login = $lms_ldap->studentid2uid($mnr);
    return $ldap_login;
}
Exemplo n.º 2
0
                // $new_bookings gegenueber steht und die
                // somit aus der Datenbank geloescht werden
                // muessen.
                unset($old_bookings[$booking["r_beleg.tabpk"]]);
            }
        }
        // Alle uebrig gebliebenen sind nicht mehr in der LSF
        // zulassungeliste und wurden also zwischenzeitlich
        // aus dem LSF geloescht.
        foreach ($old_bookings as $old_booking) {
            $bookings_for_deletion[] = $old_booking;
        }
    }
}
try {
    $lms_ldap = new lms_ldap();
    $lms_ldap->bind(LDAP_LOGIN, LDAP_PASSWORD);
} catch (Exception $e) {
    error_log("HISLSF_SYNC\t" . $e->getMessage());
    exit;
}
// Zaehler fuer erfolgreich durchgefuehrte Buchungen
$counter_new_bookings = 0;
foreach ($new_bookings as $booking) {
    $booking["uid"] = $lms_ldap->studentid2uid($booking["matrnr"]);
    if (empty($booking["uid"])) {
        logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\tWARNING " . $booking["matrnr"] . " NOT FOUND IN LDAP");
        continue;
    }
    $result = $GLOBALS["STEAM"]->predefined_command($user_module, "lookup_login", array($booking["uid"], TRUE), 0);
    if (is_object($result[0])) {
Exemplo n.º 3
0
<?php

require_once "../etc/koala.conf.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_ALLOWED);
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["uid"] == $_SESSION["LDAP_LOGIN"]) {
    // ERSTMAL NOCH EINMAL LDAP UEBERPRUEFEN
    $ldap_client = new lms_ldap();
    $dn = "uid=" . $_SESSION["LDAP_LOGIN"] . ", " . LDAP_OU . ", " . LDAP_O . ", " . LDAP_C;
    if (!$ldap_client->bind($dn, decrypt($_SESSION["LDAP_PASSWORD_ENCR"], ENCRYPTION_KEY))) {
        // TODO
        throw new Exception();
    }
    $client = new SoapClient(NULL, array("location" => LDAP_SERVICE_LOCATION, "uri" => LDAP_SERVICE_URL, "local_cert" => LDAP_SERVICE_CERT));
    $parameter = array(new SoapParam($_SESSION["LDAP_LOGIN"], "uid"));
    try {
        $result = $client->__soapCall("getState", $parameter);
    } catch (Exception $e) {
        $portal->set_problem_description("SOAP SERVICE NICHT ERREICHBAR");
    }
    // SERVICE FREISCHALTEN
    // UND EINLOGGE
    // 2 FAELLE: ENTWEDER SERVICE IST BEANTRAGT => FREISCHALTEN
    // SERVICE IST NICHT BEANTRAGT, DANN BEANTRAGEN UND DANN FREISCHALTEN
    echo "Antragsstatus: " . $result . "\n";
    if (!strcmp($result, "NONE") || !strcmp($result, "WANTED")) {
        if (!strcmp($result, "NONE")) {
            // Antrag stellen
            $result = $client->__soapCall('request', $parameter);
            echo "Antragsstatus: " . $result . "\n";
        }
 private function getLdapDataForMatriculationNumbers($arrayOfMatriculationNumbers = TRUE)
 {
     if ($arrayOfMatriculationNumbers == FALSE) {
         return FALSE;
     }
     $filterString = "";
     $filterStringFirst = TRUE;
     //build a filter string
     foreach ($arrayOfMatriculationNumbers as $matriculationNumber) {
         if ($filterStringFirst) {
             $filterString = "(upbStudentID=" . $matriculationNumber . ")";
         } else {
             $filterString = "(|" . $filterString . "(upbStudentID=" . $matriculationNumber . "))";
         }
         $filterStringFirst = FALSE;
     }
     //$filter = "(|(upbStudentID=6105319)(uid=birger))"; //sample filter string
     require_once PATH_CLASSES . "lms_ldap.class.php";
     try {
         $lms_ldap = new lms_ldap();
         $lms_ldap->bind(LDAP_LOGIN, LDAP_PASSWORD);
     } catch (Exception $e) {
         return FALSE;
     }
     $ldap_attributes = $lms_ldap->get_ldap_attribute_for_various_data(array("sn", "givenName", "upbStudentID", "uid", "upbMailPreferredAddress"), $filterString);
     return $ldap_attributes;
 }
Exemplo n.º 5
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $problem = "";
         $hint = "";
         $values = $_POST["values"];
         if (empty($values["login"])) {
             $problem = gettext("The login name is missing.") . "&nbsp;";
             $hint = gettext("Please enter your login name.") . "&nbsp;";
         }
         if (empty($values["password"])) {
             $problem .= gettext("Your password is missing.");
             $hint .= gettext("Please enter your password.");
         }
         if ($values["login"] == "guest") {
             $problem = gettext("Invalid username or wrong password.");
             $hint = gettext("Please verify your credentials and try again.");
         }
         // Check if user is locked by usermanagement
         if (defined("USERMANAGEMENT") && USERMANAGEMENT) {
             $dataAccess = new sTeamServerDataAccess();
             $userID = $dataAccess->login2ID($values["login"]);
             if ($userID != "-1" && $dataAccess->isLocked($userID)) {
                 $problem .= "Dieser Benutzer wurde gesperrt und kann sich vorl&auml;ufig nicht am System anmelden";
                 $hint .= "";
             } else {
                 if ($userID != "-1" && $dataAccess->isTrashed($userID)) {
                     $problem .= "Dieser Benutzer wurde gelöscht und kann sich nicht mehr am System anmelden";
                     $hint .= "";
                 }
             }
         }
         if (empty($problem)) {
             if (CHECK_LDAP_ACCESS) {
                 $client = new \SoapClient(NULL, array("location" => LDAP_SERVICE_LOCATION, "uri" => LDAP_SERVICE_URL, "local_cert" => LDAP_SERVICE_CERT));
                 $parameter = array(new \SoapParam(trim($values["login"]), "uid"));
                 try {
                     $result = $client->__soapCall("getState", $parameter);
                 } catch (\Exception $e) {
                     // $problem = "SOAP-SERVICE NICHT ERREICHBAR!";
                     $hint = "";
                 }
                 if (empty($problem)) {
                     $ldap_client = new \lms_ldap();
                     $dn = "uid=" . utf8_encode(trim($values["login"])) . ", " . LDAP_OU . ", " . LDAP_O . ", " . LDAP_C;
                     if (!$ldap_client->bind($dn, utf8_encode($values["password"]))) {
                         $problem = gettext("Invalid username or wrong password.");
                         $hint = gettext("Please verify your credentials and try again.");
                     } else {
                         $_SESSION["LDAP_PASSWORD_ENCR"] = encrypt($values["password"], ENCRYPTION_KEY);
                         $_SESSION["LDAP_LOGIN"] = utf8_encode(trim($values["login"]));
                         ob_end_clean();
                         header("Location: " . PATH_URL . "disclaimer.php");
                         exit;
                     }
                 }
             }
         }
         if (empty($problem) && !$portal->login(trim($values["login"]), $values["password"], isset($values["req"]) ? $values["req"] : NULL)) {
             $problem = gettext("Invalid username or wrong password.");
             $hint = gettext("Please verify your credentials and try again.");
         }
     }
     if (!empty($problem)) {
         $portal->set_problem_description($problem, $hint);
     }
     $content = \SignIn::getInstance()->loadTemplate("signin.template.html");
     $content->setVariable("REQUEST_URI", isset($_GET["req"]) ? $_GET["req"] : "");
     $content->setVariable("LOGIN_INFO", gettext("Use your IMT credentials to log in into koaLA knowledge network. Here, you can get and discuss course materials online, extend your personal and academic network, and cooperate with fellow students and colleagues.") . "<br>(" . gettext("Hinweis: Bitte beachten Sie, dass Sie in Ihren Browsereinstellungen dieser Seite das Speichern von Cookies erlauben. Das ist für die Anmeldung notwendig.") . ")");
     $content->setVariable("LOGIN_NAME_TEXT", gettext("Login"));
     $content->setVariable("PASSWORD_NAME_TEXT", gettext("Password"));
     $content->setVariable("SIGNIN_BUTTON_TEXT", gettext("Sign in"));
     $content->setVariable("RETURN_TEXT", gettext("return to the home page"));
     $content->setVariable("REQUEST_URI", isset($this->request) ? $this->request : "");
     if (isset($values) && is_array($values)) {
         $content->setVariable("VALUE_LOGIN", trim($values["login"]));
     }
     if (isset($values["login"]) && !empty($values["login"])) {
         $portal->add_javascript_onload("SignIn", "document.getElementById('second_field').focus();");
     } else {
         $portal->add_javascript_onload("SignIn", "document.getElementById('first_field').focus();");
     }
     $frameResponseObject->setTitle(gettext("Sign in"));
     $frameResponseObject->setHeadline("Anmeldung");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }