2009-07-01 14:55:52 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
2009-07-02 15:50:12 +00:00
|
|
|
|
//D<>finition du tableau des permissions
|
|
|
|
|
|
2009-07-01 14:55:52 +00:00
|
|
|
|
$definePerms = array(
|
|
|
|
|
'KBIS' => array( 'init' => '', 'txt' => 'Extrait RCS'),
|
2009-07-16 15:38:47 +00:00
|
|
|
|
'ACTES' => array( 'init' => '', 'txt' => 'Pi<50>ces officielles'),
|
2009-12-23 10:19:11 +00:00
|
|
|
|
'PRIVILEGES' => array( 'init' => '', 'txt' => 'Privil<69>ges'),
|
2009-07-16 15:38:47 +00:00
|
|
|
|
'IPARI' => array( 'init' => '', 'txt' => 'Investigation par l\'image IparI©'),
|
2009-07-01 14:55:52 +00:00
|
|
|
|
'MARQUES' => array( 'init' => '', 'txt' => 'Marques d<>pos<6F>es'),
|
|
|
|
|
'INDISCORE' => array( 'init' => '', 'txt' => 'indiScore©'),
|
2009-10-15 15:09:54 +00:00
|
|
|
|
'INDISCORE2' => array( 'init' => '', 'txt' => 'Rapport synthetique'),
|
|
|
|
|
'INDISCORE3' => array( 'init' => '', 'txt' => 'Rapport complet'),
|
2009-07-01 14:55:52 +00:00
|
|
|
|
'SCORECSF' => array( 'init' => '', 'txt' => 'Score CSF'),
|
|
|
|
|
'EVENINSEE' => array( 'init' => '', 'txt' => 'Év<>nements INSEE'),
|
|
|
|
|
'AVISINSEE' => array( 'init' => '', 'txt' => 'Avis de situation INSEE'),
|
2009-07-16 15:38:47 +00:00
|
|
|
|
'SURVANNONCE' => array( 'init' => '', 'txt' => 'Surveillance des annonces l<>gales'),
|
|
|
|
|
'SURVINSEE' => array( 'init' => '', 'txt' => 'Surveillance des <20>v<EFBFBD>nements INSEE'),
|
2009-07-01 14:55:52 +00:00
|
|
|
|
'SURVBILAN' => array( 'init' => '', 'txt' => 'Surveillance des bilans'),
|
|
|
|
|
'SURVSCORE' => array( 'init' => '', 'txt' => 'Surveillance des <20>v<EFBFBD>nements sur le score'),
|
2009-09-18 17:09:22 +00:00
|
|
|
|
'SURVACTES' => array( 'init' => '', 'txt' => 'Surveillance des actes'),
|
|
|
|
|
'SURVDIRIGEANTS'=> array( 'init' => '', 'txt' => 'Surveillance des dirigeants'),
|
2009-07-01 14:55:52 +00:00
|
|
|
|
'SURVLISTE' => array( 'init' => '', 'txt' => 'Liste des surveillances'),
|
|
|
|
|
'INVESTIG' => array( 'init' => '', 'txt' => 'Investigation'),
|
2009-07-23 08:48:24 +00:00
|
|
|
|
'ENQUETEC' => array( 'init' => '', 'txt' => 'Enqu<71>te commerciale'),
|
2009-07-01 14:55:52 +00:00
|
|
|
|
'INTERNATIONAL' => array( 'init' => '', 'txt' => 'Recherche Internationale'),
|
|
|
|
|
'MONPROFIL' => array( 'init' => '', 'txt' => 'Mon profil'),
|
|
|
|
|
);
|
|
|
|
|
|
2009-07-02 15:50:12 +00:00
|
|
|
|
/*
|
|
|
|
|
* Attribut si l'utilisateur poss<73>de le droit d'acc<EFBFBD>der au service
|
|
|
|
|
* @param string $name
|
|
|
|
|
* Nom du droit
|
|
|
|
|
* @param array $userInfo
|
|
|
|
|
* Tableau d'informations de l'utilisateur, facultatif, si pas d<EFBFBD>fini alors on regarde dans la session
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
2010-01-04 08:29:20 +00:00
|
|
|
|
function hasPerm($perm, $userInfos = '')
|
|
|
|
|
{
|
2009-07-09 15:07:38 +00:00
|
|
|
|
$return = TRUE;
|
2009-07-09 13:46:43 +00:00
|
|
|
|
if($userInfos == ''){ $userInfos = $_SESSION['tabInfo']; }
|
2009-12-10 09:54:47 +00:00
|
|
|
|
if ( !preg_match('/\b'.$perm.'\b/i', $userInfos['droits'])) $return = FALSE;
|
2009-07-01 14:55:52 +00:00
|
|
|
|
//Surcharger les droits
|
2009-07-09 15:07:38 +00:00
|
|
|
|
if(!overridePerm($perm)){ $return = FALSE; }
|
2009-07-01 14:55:52 +00:00
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-09 15:07:38 +00:00
|
|
|
|
/*
|
|
|
|
|
* V<EFBFBD>rifie les permissions sur chaque page
|
|
|
|
|
* @param string $page
|
|
|
|
|
* Nom de la page
|
|
|
|
|
* @param string $perm
|
|
|
|
|
* Nom du droit
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
2010-01-04 08:29:20 +00:00
|
|
|
|
function checkPerm($page, $perm = '')
|
|
|
|
|
{
|
2009-07-09 15:07:38 +00:00
|
|
|
|
$return = TRUE;
|
|
|
|
|
if($page != 'recherche') $return = hasPerm($perm);
|
|
|
|
|
$return = $return && overridePermPage($page);
|
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-07-01 14:55:52 +00:00
|
|
|
|
/*
|
|
|
|
|
* Retourne le code HTML pour le formulaire de modification du compte
|
|
|
|
|
* @param string $name
|
|
|
|
|
* Nom du droits
|
|
|
|
|
* @param array $perms
|
|
|
|
|
* Tableau d'informations du droits
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2010-01-04 08:29:20 +00:00
|
|
|
|
function formElementPerm($userInfos)
|
|
|
|
|
{
|
2009-09-18 17:09:22 +00:00
|
|
|
|
global $definePerms, $firephp;
|
2009-07-09 13:46:43 +00:00
|
|
|
|
$return = '';
|
2010-01-04 08:29:20 +00:00
|
|
|
|
foreach($definePerms as $perm => $infos)
|
|
|
|
|
{
|
|
|
|
|
if(overridePerm($perm))
|
|
|
|
|
{
|
|
|
|
|
$firephp->log(hasPerm($perm, $userInfos), 'hasPerm '.$perm);
|
2009-07-09 13:46:43 +00:00
|
|
|
|
(hasPerm($perm, $userInfos)==TRUE) ? $checked = 'checked' : $checked = $infos['init'];
|
2009-09-10 15:31:37 +00:00
|
|
|
|
($_SESSION['tabInfo']['profil']=='Administrateur' || $_SESSION['tabInfo']['profil']=='SuperAdministrateur') ? $disabled = '' : $disabled = 'disabled' ;
|
2009-07-17 14:57:42 +00:00
|
|
|
|
$return.= '<input type="checkbox" name="frmOptions[droits][]" value="'.strtolower($perm).'" '.$checked.' '.$disabled.' class="noborder"/>'.$infos['txt'].'<br/>'."\n";
|
2009-07-01 14:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* V<EFBFBD>rifie le login de l'utilisateur pour le mode edition
|
|
|
|
|
* @param string $loginVu
|
|
|
|
|
* Login
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
function checkModeEdition($loginVu){
|
|
|
|
|
$isAuthorized = FALSE;
|
2010-01-06 08:33:02 +00:00
|
|
|
|
$authorizedUsers = array('ylenaour', 'jmartory', 'mheitz', 'mpurcarin', 'mcochet', 'aegasse', 'mricois', 'mfuret', 'sbeaugrand');
|
2009-07-01 14:55:52 +00:00
|
|
|
|
$isUserAuthorized = FALSE;
|
|
|
|
|
foreach($authorizedUsers as $login){
|
|
|
|
|
if($_SESSION['tabInfo']['login']==$login){
|
|
|
|
|
$isUserAuthorized = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-09-10 15:31:37 +00:00
|
|
|
|
if($loginVu==$_SESSION['tabInfo']['login'] && $isUserAuthorized || ($_SESSION['tabInfo']['idClient']==1 && ($_SESSION['tabInfo']['profil']=='Administrateur' || $_SESSION['tabInfo']['profil']=='SuperAdministrateur') ) ){
|
2009-07-01 14:55:52 +00:00
|
|
|
|
$isAuthorized = TRUE;
|
|
|
|
|
}
|
|
|
|
|
return $isAuthorized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Retourne le code HTML pour le formulaire de modification du compte
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function formElementModeEdition(){
|
|
|
|
|
if ($_SESSION['tabInfo']['mode_edition']==1) $strMode='checked'; else $strMode='';
|
2009-07-17 14:57:42 +00:00
|
|
|
|
return '<input type="checkbox" name="frmOptions[mode_edition]" value="1" '.$strMode.' class="noborder"/>Edition';
|
2009-07-01 14:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|