351,6 → 351,7 |
} |
|
protected function authentifier() { |
// @TODO @WARNING @ACHTUNG @ ALARM enlever le patch CGI quand on aura mis à jour Apache/PHP !! |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
if (!isset($_SERVER['PHP_AUTH_USER'])) { |
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"'); |
372,10 → 373,18 |
} |
} |
|
/** |
* Vérifie l'accès en se basant sur $id et $mdp si ceux-ci sont fournis; sinon, |
* lit les valeurs transmises par l'authentification HTTP BASIC AUTH |
*/ |
protected function verifierAcces($id = null, $mdp = null) { |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
$basicAuth = false; |
if ($id == null && $mdp == null) { |
$id = is_null($id) ? $_SERVER['PHP_AUTH_USER'] : $id; |
$mdp = is_null($mdp) ? $_SERVER['PHP_AUTH_PW'] : $mdp; |
$basicAuth = true; |
} |
if ($basicAuth === false || JRest::$cgi === false) { // en mode non-CGI ou pour une identification $id / $mdp |
|
$requete = 'SELECT '.$this->config['database_ident']['ann_id'].' AS courriel '. |
'FROM '.$this->config['database_ident']['database'].'.'.$this->config['database_ident']['annuaire'].' '. |
389,7 → 398,7 |
$identifie = true; |
} |
return $identifie; |
} else { |
} else { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
return true; // ça fait un peu mal... |
} |
} |
403,7 → 412,7 |
*/ |
protected function authentificationHttpSimple() { |
$autorise = true; |
// contrôle d'accès |
// contrôle d'accès @TODO @WARNING @ACHTUNG @ ALARM enlever le patch CGI quand on aura mis à jour Apache/PHP !! |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
$nomUtil = $_SERVER['PHP_AUTH_USER']; |
$mdp = $_SERVER['PHP_AUTH_PW']; |