2009-07-01 14:55:52 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
* D<EFBFBD>finition en dur des sp<EFBFBD>cificit<EFBFBD>es des clients
|
|
|
|
|
* Surcharge des droits et des pr<EFBFBD>f<EFBFBD>rences (util en mode d<EFBFBD>veloppement)
|
|
|
|
|
*/
|
|
|
|
|
|
2009-07-02 15:50:46 +00:00
|
|
|
|
/*
|
|
|
|
|
* Authorise l'acc<EFBFBD>s au droit
|
|
|
|
|
* @param string $perm
|
|
|
|
|
* Nom du droit
|
|
|
|
|
* @param string login
|
|
|
|
|
* login de l'utilisateur
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
function overridePerm($perm, $login = ''){
|
2009-07-09 15:07:38 +00:00
|
|
|
|
return overridePermByidClient($perm) && overridePermByLogin($perm, $login);
|
2009-07-02 15:50:46 +00:00
|
|
|
|
}
|
2009-07-01 14:55:52 +00:00
|
|
|
|
|
2009-07-02 15:50:46 +00:00
|
|
|
|
/*
|
|
|
|
|
* Authorise l'acc<EFBFBD>s au droit par idClient
|
|
|
|
|
* @param string $perm
|
|
|
|
|
* Nom du droit
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
2009-07-01 14:55:52 +00:00
|
|
|
|
function overridePermByidClient($perm){
|
|
|
|
|
$perm = strtoupper($perm);
|
|
|
|
|
$idClient = $_SESSION['tabInfo']['idClient'];
|
|
|
|
|
$onlyAuthorizedPerm = array();
|
|
|
|
|
$notAuthorizedPerm = array(
|
|
|
|
|
'ACTES' => array(18),
|
|
|
|
|
'IPARI' => array(18),
|
|
|
|
|
'MARQUES' => array(18),
|
|
|
|
|
'SCORECSF' => array(18),
|
|
|
|
|
);
|
2009-07-09 13:46:43 +00:00
|
|
|
|
$return = TRUE;
|
2009-07-01 14:55:52 +00:00
|
|
|
|
if( isset($onlyAuthorizedPerm[$perm]) ){
|
|
|
|
|
foreach($onlyAuthorizedPerm[$perm] as $id){
|
|
|
|
|
if($idClient == $id){ $return = TRUE; break; }
|
|
|
|
|
else{ $return = FALSE; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( isset($notAuthorizedPerm[$perm]) && !isset($return) ){
|
|
|
|
|
foreach($notAuthorizedPerm[$perm] as $id){
|
|
|
|
|
if($idClient == $id){ $return = FALSE; break; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-02 15:50:46 +00:00
|
|
|
|
/*
|
|
|
|
|
* Authorise l'acc<EFBFBD>s au droit par login
|
|
|
|
|
* @param string $perm
|
|
|
|
|
* Nom du droit
|
|
|
|
|
* @param string login
|
|
|
|
|
* login de l'utilisateur
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
2009-07-01 14:55:52 +00:00
|
|
|
|
function overridePermByLogin($perm, $login = ''){
|
|
|
|
|
$perm = strtoupper($perm);
|
2009-07-09 17:10:47 +00:00
|
|
|
|
if($login == ''){ $login = $_SESSION['tabInfo']['login']; }
|
2010-01-04 08:29:20 +00:00
|
|
|
|
$onlyAuthorizedPerm = array();
|
2009-07-01 14:55:52 +00:00
|
|
|
|
$notAuthorizedPerm = array();
|
2009-07-09 13:46:43 +00:00
|
|
|
|
$return = TRUE;
|
2009-07-01 14:55:52 +00:00
|
|
|
|
if( isset($onlyAuthorizedPerm[$perm]) ){
|
|
|
|
|
foreach($onlyAuthorizedPerm[$perm] as $user){
|
|
|
|
|
if($login == $user){ $return = TRUE; break; }
|
|
|
|
|
else{ $return = FALSE; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( isset($notAuthorizedPerm[$perm]) && !isset($return) ){
|
|
|
|
|
foreach($notAuthorizedPerm[$perm] as $user){
|
|
|
|
|
if($login == $user){ $return = FALSE; break; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-09 13:46:43 +00:00
|
|
|
|
/*
|
|
|
|
|
* Authorise l'acc<EFBFBD>s <EFBFBD> la page
|
|
|
|
|
* @param string $page
|
|
|
|
|
* Nom de la page
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
function overridePermPage($page){
|
|
|
|
|
$idClient = $_SESSION['tabInfo']['idClient'];
|
|
|
|
|
$login = $_SESSION['tabInfo']['login'];
|
|
|
|
|
$idClientAllow = array();
|
2009-07-09 15:07:38 +00:00
|
|
|
|
$idClientAllowAfterPage = array(
|
|
|
|
|
'identite' => array(34),
|
|
|
|
|
);
|
2009-07-09 13:46:43 +00:00
|
|
|
|
$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),
|
|
|
|
|
);
|
2009-10-16 12:30:19 +00:00
|
|
|
|
$loginAllowOnly = array();
|
2009-07-09 13:46:43 +00:00
|
|
|
|
$loginDeny = array();
|
|
|
|
|
$return = TRUE;
|
2009-07-09 15:07:38 +00:00
|
|
|
|
//idClient non autoris<69>
|
2009-07-09 13:46:43 +00:00
|
|
|
|
if(isset($idClientDeny[$page]) && count($idClientDeny[$page])>0){
|
|
|
|
|
foreach($idClientDeny[$page] as $id){
|
2009-07-09 15:07:38 +00:00
|
|
|
|
if($id == $idClient) { $return = FALSE; break; }
|
2009-07-09 13:46:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-09 15:07:38 +00:00
|
|
|
|
//idClient autoris<69> apr<70>s le passage sur la fiche identit<69>, la page recherche
|
|
|
|
|
if(in_array($idClient, $idClientAllowAfterPage[$page], TRUE)){ $_SESSION['nowAuthorized'] = TRUE; }
|
|
|
|
|
if($page=='recherche'){ $_SESSION['nowAuthorized'] = FALSE; }
|
|
|
|
|
//login non autoris<69>
|
2009-07-09 13:46:43 +00:00
|
|
|
|
if(isset($loginDeny[$page]) && count($loginDeny[$page])>0){
|
|
|
|
|
foreach($loginDeny[$page] as $user){
|
2009-07-09 15:07:38 +00:00
|
|
|
|
if($user == $login) { $return = FALSE; break; }
|
2009-07-09 13:46:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-09 15:07:38 +00:00
|
|
|
|
//Seul ces logins sont autoris<69>s
|
2009-07-09 13:46:43 +00:00
|
|
|
|
if(isset($loginAllowOnly[$page]) && count($loginAllowOnly[$page])>0){
|
|
|
|
|
foreach($loginAllowOnly[$page] as $user){
|
2009-07-09 15:07:38 +00:00
|
|
|
|
if($user != $login) { $return = FALSE; }
|
2009-07-09 13:46:43 +00:00
|
|
|
|
else{ $return = TRUE; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-07-01 14:55:52 +00:00
|
|
|
|
function overridePrefByidClient(){}
|
|
|
|
|
function overridePrefByLogin(){}
|