Limitation des plugins

This commit is contained in:
Michael RICOIS 2016-04-29 17:09:04 +02:00
parent 75f1327771
commit d1065a927d
5 changed files with 43 additions and 38 deletions

View File

@ -3,6 +3,14 @@ class Application_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if ($module == 'default' && $controller == 'index' && $action = 'index') {
return;
}
// --- initialisation
$menu = null;

View File

@ -5,20 +5,16 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{
Zend_Registry::get('firebug')->info('PLUGIN AUTH - START');
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$checkAuth = true;
if ($request->getControllerName()=='user' && $request->getActionName()=='login') {
$checkAuth = false;
}
if ($request->getControllerName()=='user' && $request->getActionName()=='motpasse') {
$checkAuth = false;
}
if ($request->getControllerName()=='auth') {
if ($module == 'auth') {
$checkAuth = false;
}
if ($request->getModuleName()=='file' && $request->getClientIp(false)=='78.31.45.206') {
if ($module == 'file' && $request->getClientIp(false) == '78.31.45.206') {
$checkAuth = false;
}
@ -70,10 +66,8 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
foreach ($result->getMessages() as $message) {
$messageF.= $message."<br/>";
}
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
->setParam('message', $messageF);
$request->setModuleName('default')->setControllerName('user')
->setActionName('logout')->setParam('message', $messageF);
}
// --- Sinon on reste sur le standard
@ -94,12 +88,9 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
}
// --- Check CGU
if ( $request->getControllerName()!='aide' && $request->getActionName()!='cgu'
|| $request->getControllerName()!='user' && $request->getActionName()!='logout') {
if ( $controller!='aide' && $action!='cgu' || $controller!='user' && $action!='logout') {
if ( empty($identity->acceptationCGU) || $identity->acceptationCGU=='0000-00-00 00:00:00' ) {
$request->setModuleName('default')
->setControllerName('aide')
->setActionName('cgu');
$request->setModuleName('default')->setControllerName('aide')->setActionName('cgu');
}
}
@ -115,14 +106,10 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$session->url = $_SERVER['REQUEST_URI'];
}
if ( $request->getControllerName()=='index' && $request->getActionName()=='index' ) {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('login');
if ($module=='default' && $controller=='index' && $action=='index') {
$request->setModuleName('auth')->setControllerName('user')->setActionName('login');
} else {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
$request->setModuleName('auth')->setControllerName('user')->setActionName('logout')
->setParam('ajax', $request->isXmlHttpRequest());
}
}
@ -132,21 +119,13 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
else {
if ( $request->isXmlHttpRequest() ) {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
$request->setModuleName('auth')->setControllerName('user')->setActionName('logout')
->setParam('ajax', 1);
} else {
$session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI'];
$request->setModuleName('default')
->setControllerName('user')
->setActionName('login');
$request->setModuleName('auth')->setControllerName('user')->setActionName('login');
}
}

View File

@ -11,6 +11,14 @@ class Application_Controller_Plugin_Cgu extends Zend_Controller_Plugin_Abstract
{
Zend_Registry::get('firebug')->info('PLUGIN CGU - START');
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if ($module == 'default' && $controller == 'index' && $action = 'index') {
return;
}
$layout = Zend_Layout::getMVCInstance();
if ($layout->isEnabled()) {
$tabCgu = array(

View File

@ -11,6 +11,14 @@ class Application_Controller_Plugin_Lang extends Zend_Controller_Plugin_Abstract
{
Zend_Registry::get('firebug')->info('PLUGIN LANG - START');
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if ($module == 'default' && $controller == 'index' && $action = 'index') {
return;
}
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
$identity = $auth->getIdentity();

View File

@ -10,11 +10,13 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
/**
* Définition du menu à afficher par module
* admin => Administration : Liste des utilisateurs, etc
* file => Distribution des fichier + print, pas de navbar
* auth => authentification
* default
* file => Distribution des fichiers + print, pas de navbar
* help => Aide, Faq, Nouveautés
* input => Element de saisie, pas de navbar
* legal => Identite, Dirigeants, Finance, Juridique, Evaluation, Pieces Officielles, BDF !!!!!
* order => Commandes
* input => Element de saisie, pas de navbar
* search => Formulaire de recherche
* user => Paramètres, Portefeuille, Surveillances
*/