Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 535 → Rev 536

/trunk/jrest/services/CelSyndicationImage.php
31,7 → 31,7
$info = array();
$contenu = '';
if (! $this->etreFluxAdmin() || $this->authentifier()) {
if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
// Pré traitement des paramêtres
$pour_bdd = false;
$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);
/trunk/jrest/services/Cel.php
232,34 → 232,50
//+----------------------------------------------------------------------------------------------------------------+
// GESTION DE L'IDENTIFICATION
public function authentifier() {
public function authentifierAdmin() {
$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
$message_echec = "Accès limité aux administrateurs du CEL.\n".
"Votre tentative d'identification a échouée.\n".
"Actualiser la page pour essayer à nouveau.";
"Votre tentative d'identification a échoué.\n".
"Actualiser la page pour essayer à nouveau si vous êtes bien inscrit comme administrateur.";
return $this->authentifier($message_accueil, $message_echec);
}
public function authentifierUtilisateur() {
$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
$message_echec = "Accès limité aux utilisateur du CEL.\n".
"Inscrivez vous http://www.tela-botanica.org/page:inscription pour le devenir.\n".
"Votre tentative d'identification a échoué.\n".
"Actualiser la page pour essayer à nouveau si vous êtes déjà inscrit ou contacter 'accueil@tela-botanica.org'.";
return $this->authentifier($message_accueil, $message_echec);
}
private function authentifier($message_accueil, $message_echec) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
$this->envoyerAuth($message_accueil, $message_echec);
} else {
if ($this->etreAutorise($_SERVER['PHP_AUTH_USER']) == false) {
if ($this->etreAdminAutorise($_SERVER['PHP_AUTH_USER']) == false) {
$this->envoyerAuth($message_accueil, $message_echec);
}
}
return true;
}
}
public function etreAutorise($identifiant) {
public function etreUtilisateurAutorise($identifiant) {
$this->initialiserDao('http://www.tela-botanica.org/client/annuaire_nouveau/actuelle/jrest/');
$mdp = md5($_SERVER['PHP_AUTH_PW']);
$url = $this->getDao()->url_jrest."TestLoginMdp/$identifiant/$mdp";
$json = $this->getDao()->envoyerRequeteConsultation($url);
$existe = json_decode($json);
$autorisation = false;
if ($existe == true && $this->etreAdminCel($identifiant)) {
$autorisation = true;
}
$autorisation = (isset($existe) && $existe) ? true :false;
return $autorisation;
}
public function etreAdminAutorise($identifiant) {
$autorisation = ($this->etreUtilisateurAutorise($identifiant) && $this->etreAdminCel($identifiant)) ? true : false;
return $autorisation;
}
public function etreAdminCel($courriel) {
$admins = $this->config['jrest_admin']['admin'];
$courriels_autorises = explode(',', $admins);
/trunk/jrest/services/CelSyndicationObservation.php
39,7 → 39,7
$info = array();
$contenu = '';
if (! $this->etreFluxAdmin() || $this->authentifier()) {
if (! $this->etreFluxAdmin() || $this->authentifierAdmin()) {
// Pré traitement des paramêtres
$pour_bdd = false;
$p = $this->traiterParametres(array('service', 'format'), $params, $pour_bdd);