Subversion Repositories Applications.annuaire

Compare Revisions

No changes between revisions

Ignore whitespace Rev 564 → Rev 565

/trunk/jrest/bibliotheque/JRestService.php
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,16 → 373,24
}
}
 
/**
* 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'].' '.
'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;
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'];
/trunk/.
Property changes:
Modified: svn:mergeinfo
Merged /branches/v1.4-baleine:r564