Пример #1
0
function checkAuthentication($noCache, $haveTicket)
{
    list($isAuthenticated, $noCookies) = checkAuthentication_raw($noCache, $haveTicket);
    $before_all = getAndUnset($_SESSION, 'time_before_redirecting_to_CAS');
    $before_verif = getAndUnset($_SESSION, 'time_before_verifying_CAS_ticket');
    if ($before_verif) {
        debug_msg("CAS ticket verification time: " . formattedElapsedTime($before_verif));
    }
    if ($before_all) {
        debug_msg("total CAS authentication time: " . formattedElapsedTime($before_all));
    }
    $wasPreviouslyAuthenticated = $before_verif === null;
    return array($isAuthenticated, $noCookies, $wasPreviouslyAuthenticated);
}
function searchPeopleRaw($filter, $allowListeRouge, $wanted_attrs, $KEY_FIELD, $maxRows)
{
    global $PEOPLE_DN, $SEARCH_TIMELIMIT;
    if (!$allowListeRouge) {
        // we need the attr to anonymize people having supannListeRouge=TRUE
        $wanted_attrs['supannListeRouge'] = 'supannListeRouge';
    }
    $r = getLdapInfoMultiFilters($PEOPLE_DN, $filter, $wanted_attrs, $KEY_FIELD, $maxRows, $SEARCH_TIMELIMIT);
    if (!$allowListeRouge) {
        foreach ($r as &$e) {
            if (!isset($e["supannListeRouge"])) {
                continue;
            }
            $supannListeRouge = getAndUnset($e, "supannListeRouge");
            if ($supannListeRouge == "TRUE") {
                if (sizeof($r) == 1) {
                    // hum, the search is precise enough to return only one result.
                    // if we return the anonymized result, someone can know a user exists, even if anonymized
                    // better return nothing!
                    $r = array();
                } else {
                    anonymizeUser($e, $wanted_attrs);
                }
            }
        }
    }
    return $r;
}