Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 917 Rev 975
Line 193... Line 193...
193
 
193
 
194
		$autorisation = (in_array($courriel, $courriels_autorises)) ? true : false ;
194
		$autorisation = (in_array($courriel, $courriels_autorises)) ? true : false ;
195
		return $autorisation;
195
		return $autorisation;
Line 196... Line -...
196
	}
-
 
197
	
-
 
198
	/**
-
 
199
	 * Prend en paramêtre un tableau de courriels et retourne après avoir intérogé un service de l'annuaire
-
 
200
	 * une tableau avec en clé le courriel et en valeur, un tableau associatif :
-
 
201
	 *  - nom
-
 
202
	 *  - prenom
-
 
203
	 *  - pseudo
-
 
204
	 *  - pseudoUtilise : si true, nous devons afficher le pseudo à la place de Prénom NOM.
-
 
205
	 *  - intitule : directement la valeur à afficher (pseudo ou Prénom NOM en fonction du champ pseudoUtilise) 
-
 
206
	 * @param array $courriels un tableau de courriels pour lesquels il faut rechercher les infos d'identité
196
	}
207
	 */
197
	
208
	protected function recupererUtilisateursIdentite(Array $courriels) {
198
	protected function recupererUtilisateursIdentite(Array $courriels) {
209
		// Récupération des données au format Json
199
		// Récupération des données au format Json
210
		$service = "utilisateur/identite-par-courriel/".implode(',', $courriels);
200
		$service = "utilisateur/identite-par-courriel/".implode(',', $courriels);
211
		$url = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service);
201
		$url = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service);
-
 
202
		$json = $this->getDao()->consulter($url);
-
 
203
		$utilisateurs = json_decode($json);
-
 
204
		foreach ($courriels as $courriel) {
-
 
205
			$info = array('id' => null, 'intitule' => '');
-
 
206
			if (isset($utilisateurs->$courriel)) {
-
 
207
				$info['intitule'] = $utilisateurs->$courriel->intitule;
-
 
208
				$info['id'] = $utilisateurs->$courriel->id;
-
 
209
			} else {
-
 
210
				$info['intitule'] = $this->tronquerCourriel($courriel);
-
 
211
			}
-
 
212
			$noms[$courriel] = $info;
212
		$json = $this->getDao()->consulter($url);
213
		}	
Line 213... Line 214...
213
		return (array) json_decode($json);
214
		return $noms;
214
	}
215
	}