144 lines
3.8 KiB
PHP
144 lines
3.8 KiB
PHP
<?php
|
|
/*
|
|
* Définition en dur des spécificitées des clients
|
|
* Surcharge des droits et des préférences (util en mode développement)
|
|
*/
|
|
|
|
/*
|
|
* Authorise l'accès au droit
|
|
* @param string $perm
|
|
* Nom du droit
|
|
* @param string login
|
|
* login de l'utilisateur
|
|
* @return boolean
|
|
*/
|
|
function overridePerm($perm, $login = ''){
|
|
return overridePermByidClient($perm) && overridePermByLogin($perm, $login);
|
|
}
|
|
|
|
/*
|
|
* Authorise l'accès au droit par idClient
|
|
* @param string $perm
|
|
* Nom du droit
|
|
* @return boolean
|
|
*/
|
|
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),
|
|
);
|
|
$return = TRUE;
|
|
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;
|
|
}
|
|
|
|
/*
|
|
* Authorise l'accès au droit par login
|
|
* @param string $perm
|
|
* Nom du droit
|
|
* @param string login
|
|
* login de l'utilisateur
|
|
* @return boolean
|
|
*/
|
|
function overridePermByLogin($perm, $login = ''){
|
|
$perm = strtoupper($perm);
|
|
if($login == ''){ $login = $_SESSION['tabInfo']['login']; }
|
|
$onlyAuthorizedPerm = array(
|
|
'KBIS' => array('ylenaour', 'jmartory', 'mheitz', 'mricois'),
|
|
);
|
|
$notAuthorizedPerm = array();
|
|
$return = TRUE;
|
|
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;
|
|
}
|
|
|
|
/*
|
|
* Authorise l'accès à la page
|
|
* @param string $page
|
|
* Nom de la page
|
|
* @return boolean
|
|
*/
|
|
function overridePermPage($page){
|
|
$idClient = $_SESSION['tabInfo']['idClient'];
|
|
$login = $_SESSION['tabInfo']['login'];
|
|
$idClientAllow = array();
|
|
$idClientAllowAfterPage = array(
|
|
'identite' => array(34),
|
|
);
|
|
$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();
|
|
$loginDeny = array();
|
|
$return = TRUE;
|
|
//idClient non autorisé
|
|
if(isset($idClientDeny[$page]) && count($idClientDeny[$page])>0){
|
|
foreach($idClientDeny[$page] as $id){
|
|
if($id == $idClient) { $return = FALSE; break; }
|
|
}
|
|
}
|
|
//idClient autorisé après le passage sur la fiche identité, la page recherche
|
|
if(in_array($idClient, $idClientAllowAfterPage[$page], TRUE)){ $_SESSION['nowAuthorized'] = TRUE; }
|
|
if($page=='recherche'){ $_SESSION['nowAuthorized'] = FALSE; }
|
|
//login non autorisé
|
|
if(isset($loginDeny[$page]) && count($loginDeny[$page])>0){
|
|
foreach($loginDeny[$page] as $user){
|
|
if($user == $login) { $return = FALSE; break; }
|
|
}
|
|
}
|
|
//Seul ces logins sont autorisés
|
|
if(isset($loginAllowOnly[$page]) && count($loginAllowOnly[$page])>0){
|
|
foreach($loginAllowOnly[$page] as $user){
|
|
if($user != $login) { $return = FALSE; }
|
|
else{ $return = TRUE; }
|
|
}
|
|
}
|
|
return $return;
|
|
}
|
|
|
|
|
|
function overridePrefByidClient(){}
|
|
function overridePrefByLogin(){} |