Ajout fonction permission par page
This commit is contained in:
parent
c9f0024a43
commit
91cf4fe1db
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
//Définition du tableau des permissions
|
||||
|
||||
$definePerms = array(
|
||||
'KBIS' => array( 'init' => '', 'txt' => 'Extrait RCS'),
|
||||
'IPARI' => array( 'init' => '', 'txt' => 'Pièces officielles'),
|
||||
@ -19,15 +21,83 @@ $definePerms = array(
|
||||
'MONPROFIL' => array( 'init' => '', 'txt' => 'Mon profil'),
|
||||
);
|
||||
|
||||
/*
|
||||
* Attribut si l'utilisateur possède le droit d'accèder au service
|
||||
* @param string $name
|
||||
* Nom du droit
|
||||
* @param array $userInfo
|
||||
* Tableau d'informations de l'utilisateur, facultatif, si pas défini alors on regarde dans la session
|
||||
* @return boolean
|
||||
*/
|
||||
function hasPerm($name, $userInfo = ''){
|
||||
$return == FALSE;
|
||||
if($userInfo == ''){ $userInfo = $_SESSION['tabInfo']; }
|
||||
if ( preg_match('/'.$name.'/i', $userInfo['droits'])) $return = TRUE;
|
||||
//Surcharger les droits
|
||||
if(overridePermByLogin($perm) && overridePermByidClient($perm)){ $return == TRUE; }else{ $return = FALSE; }
|
||||
if(overridePerm($perm)){
|
||||
$return == TRUE;
|
||||
}else{
|
||||
$return = FALSE;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attribut si l'utilisateur accès à la page
|
||||
* @param string $name
|
||||
* Nom du droit
|
||||
* @param array $userInfo
|
||||
* Tableau d'informations de l'utilisateur, facultatif, si pas défini alors on regarde dans la session
|
||||
* @return boolean
|
||||
*/
|
||||
function hasPermPage($page){
|
||||
$idClient = $_SESSION['tabInfo']['idClient'];
|
||||
$login = $_SESSION['tabInfo']['login'];
|
||||
$idClientAllow = array();
|
||||
$idClientDeny = array(
|
||||
'etablissements' => array(34),
|
||||
'liens' => array(34),
|
||||
'evenements' => array(34),
|
||||
'dirigeants' => array(34),
|
||||
'synthese' => array(34),
|
||||
'bilans' => array(34),
|
||||
'ratios' => array(34),
|
||||
'liasse' => array(34),
|
||||
'bourse' => array(34),
|
||||
'annonces' => array(34),
|
||||
'infosreg' => array(34),
|
||||
'competences' => array(34),
|
||||
'conventions' => array(34),
|
||||
'marques' => array(34),
|
||||
'indiscore' => array(34),
|
||||
'scorecsf' => array(34),
|
||||
'enquetec' => array(34),
|
||||
);
|
||||
$loginAllowOnly = array(
|
||||
'international_recherche' => array( 'mricois', 'mheitz' ,'jmartory' ,'ylenaour' ,'fzicaro' ,'mcochet' ,'olecce'),
|
||||
);
|
||||
$loginDeny = array();
|
||||
$return = TRUE;
|
||||
if(isset($idClientDeny[$page]) && count($idClientDeny[$page])>0){
|
||||
foreach($idClientDeny[$page] as $id){
|
||||
if($id == $idClient) { $return = $return && FALSE; break; }
|
||||
}
|
||||
}
|
||||
if(isset($loginDeny[$page]) && count($loginDeny[$page])>0){
|
||||
foreach($loginDeny[$page] as $user){
|
||||
if($user == $login) { $return = $return && FALSE; break; }
|
||||
}
|
||||
}
|
||||
if(isset($loginAllowOnly[$page]) && count($loginAllowOnly[$page])>0){
|
||||
foreach($loginAllowOnly[$page] as $user){
|
||||
if($user != $login) { $return = FALSE;}
|
||||
else{ $return = TRUE; }
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Retourne le code HTML pour le formulaire de modification du compte
|
||||
* @param string $name
|
||||
|
Loading…
x
Reference in New Issue
Block a user