351,7 → 351,6 |
} |
|
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"'); |
373,24 → 372,16 |
} |
} |
|
/** |
* 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) { |
$basicAuth = false; |
if ($id == null && $mdp == null) { |
if (JRest::$cgi === false) { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
$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'].' '. |
'WHERE '.$this->config['database_ident']['ann_id'].' = '.$this->bdd->quote($id).' '. |
' AND '.$this->config['database_ident']['ann_pwd'].' = '.$this->config['database_ident']['pass_crypt_funct'].'('.$this->bdd->quote($mdp).')' ; |
|
|
$resultat = $this->bdd->query($requete)->fetch(); |
|
$identifie = false; |
398,7 → 389,7 |
$identifie = true; |
} |
return $identifie; |
} else { // si on est en CGI, accès libre pour tous (pas trouvé mieux) |
} else { |
return true; // ça fait un peu mal... |
} |
} |
412,7 → 403,7 |
*/ |
protected function authentificationHttpSimple() { |
$autorise = true; |
// contrôle d'accès @TODO @WARNING @ACHTUNG @ ALARM enlever le patch CGI quand on aura mis à jour Apache/PHP !! |
// contrôle d'accès |
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']; |