extranet/includes/user/override.php

146 lines
3.9 KiB
PHP
Raw Normal View History

<?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)
*/
/*
* 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);
}
/*
* Authorise l'acc<EFBFBD>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<EFBFBD>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);
2009-07-09 17:10:47 +00:00
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<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),
);
$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;
2009-07-09 15:07:38 +00:00
//idClient non autoris<69>
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 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>
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 15:07:38 +00:00
//Seul ces logins sont autoris<69>s
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; }
else{ $return = TRUE; }
}
}
return $return;
}
function overridePrefByidClient(){}
function overridePrefByLogin(){}