2011-04-11 14:20:26 +00:00
|
|
|
<?php
|
|
|
|
class Utilisateur
|
|
|
|
{
|
|
|
|
protected $identity = null;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$this->identity = $auth->getIdentity();
|
|
|
|
}
|
|
|
|
|
2011-04-11 15:50:39 +00:00
|
|
|
/**
|
|
|
|
* Retourne l'email de l'utilisateur
|
|
|
|
*/
|
|
|
|
public function getEmail()
|
|
|
|
{
|
|
|
|
return $this->identity->email;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-11 14:20:26 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Vérifie que l'utilisateur possède bien un droits
|
|
|
|
* @param string $perm
|
|
|
|
* Le code de la permission
|
|
|
|
*/
|
|
|
|
public function checkPerm($perm)
|
|
|
|
{
|
|
|
|
$hasPerm = false;
|
|
|
|
if (preg_match('/\b'.$perm.'\b/i', $this->identity->droits)){
|
|
|
|
$hasPerm = true;
|
|
|
|
}
|
|
|
|
return $hasPerm;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function checkPref($pref)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|