Subversion Repositories eFlore/Applications.cel

Rev

Rev 532 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 532 Rev 536
Line 230... Line 230...
230
	}
230
	}
Line 231... Line 231...
231
	
231
	
232
	//+----------------------------------------------------------------------------------------------------------------+
232
	//+----------------------------------------------------------------------------------------------------------------+
Line 233... Line 233...
233
	// GESTION DE L'IDENTIFICATION
233
	// GESTION DE L'IDENTIFICATION
234
	
234
	
235
	public function authentifier() { 
235
	public function authentifierAdmin() { 
236
		$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
236
		$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
237
		$message_echec = "Accès limité aux administrateurs du CEL.\n".
237
		$message_echec = "Accès limité aux administrateurs du CEL.\n".
-
 
238
			"Votre tentative d'identification a échoué.\n".
-
 
239
			"Actualiser la page pour essayer à nouveau si vous êtes bien inscrit comme administrateur.";
-
 
240
		return $this->authentifier($message_accueil, $message_echec);
-
 
241
	}
-
 
242
	
-
 
243
	public function authentifierUtilisateur() { 
-
 
244
		$message_accueil = "Veuillez vous identifier avec votre compte Tela Botanica.";
-
 
245
		$message_echec = "Accès limité aux utilisateur du CEL.\n".
-
 
246
			"Inscrivez vous http://www.tela-botanica.org/page:inscription pour le devenir.\n".
-
 
247
			"Votre tentative d'identification a échoué.\n".
-
 
248
			"Actualiser la page pour essayer à nouveau si vous êtes déjà inscrit ou contacter 'accueil@tela-botanica.org'.";
-
 
249
		return $this->authentifier($message_accueil, $message_echec);
-
 
250
	}
238
			"Votre tentative d'identification a échouée.\n".
251
	
239
			"Actualiser la page pour essayer à nouveau.";
252
	private function authentifier($message_accueil, $message_echec) {
240
		if (!isset($_SERVER['PHP_AUTH_USER'])) {
253
		if (!isset($_SERVER['PHP_AUTH_USER'])) {
241
			$this->envoyerAuth($message_accueil, $message_echec);
254
			$this->envoyerAuth($message_accueil, $message_echec);
242
		} else {
255
		} else {
243
			if ($this->etreAutorise($_SERVER['PHP_AUTH_USER']) == false) {
256
			if ($this->etreAdminAutorise($_SERVER['PHP_AUTH_USER']) == false) {
244
				$this->envoyerAuth($message_accueil, $message_echec);
257
				$this->envoyerAuth($message_accueil, $message_echec);
245
			}
258
			}
246
		}
259
		}
Line 247... Line 260...
247
		return true;
260
		return true;
248
	}
261
	} 
249
    
262
    
250
	public function etreAutorise($identifiant) {
263
	public function etreUtilisateurAutorise($identifiant) {
251
		$this->initialiserDao('http://www.tela-botanica.org/client/annuaire_nouveau/actuelle/jrest/');
264
		$this->initialiserDao('http://www.tela-botanica.org/client/annuaire_nouveau/actuelle/jrest/');
252
		$mdp = md5($_SERVER['PHP_AUTH_PW']);
265
		$mdp = md5($_SERVER['PHP_AUTH_PW']);
253
		$url = $this->getDao()->url_jrest."TestLoginMdp/$identifiant/$mdp";
-
 
-
 
266
		$url = $this->getDao()->url_jrest."TestLoginMdp/$identifiant/$mdp";
254
		$json = $this->getDao()->envoyerRequeteConsultation($url);
267
		$json = $this->getDao()->envoyerRequeteConsultation($url);
255
		$existe = json_decode($json);
268
		$existe = json_decode($json);
256
		$autorisation = false; 
269
		
-
 
270
		$autorisation = (isset($existe) && $existe) ? true :false;
-
 
271
		return $autorisation;
-
 
272
	}
257
		if ($existe == true && $this->etreAdminCel($identifiant)) {
273
	
258
			$autorisation = true;
274
	public function etreAdminAutorise($identifiant) {
Line 259... Line 275...
259
		}
275
		$autorisation = ($this->etreUtilisateurAutorise($identifiant) && $this->etreAdminCel($identifiant)) ? true : false;
260
		return $autorisation;
276
		return $autorisation;