From 3617ef8da3de92d9ecd9abc7595c625012c05acd Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@git-test.afi-sa.fr> Date: Mon, 19 Nov 2012 10:52:29 +0000 Subject: [PATCH] =?UTF-8?q?Correction=20redirection=20authentification=20s?= =?UTF-8?q?ur=20les=20acc=C3=A8s=20pages=20abonn=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opac/controllers/AbonneController.php | 8 +++----- categories.org | 4 ++++ .../ZendAfi/Controller/Plugin/AdminAuth.php | 6 ++++++ .../controllers/AbonneControllerTest.php | 18 ++++++++++++++++++ 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index 905a08cd568..3acaff4e9c4 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -25,13 +25,11 @@ class AbonneController extends ZendAfi_Controller_Action { public function init() { parent::init(); + if ("authenticate" == $this->getRequest()->getActionName()) return; - - if (!$this->_user = Class_Users::getLoader()->getIdentity()) { - $this->_redirect('auth/login'); - return; - } + + $this->_user = Class_Users::getLoader()->getIdentity(); $this->clearEmprunteurCache(); } diff --git a/categories.org b/categories.org index 20767c444aa..a5d72cfef0d 100644 --- a/categories.org +++ b/categories.org @@ -232,3 +232,7 @@ var openDialogExemplaires = function() { [[file:library/Class/Moderer.php::'count'%20%3D>%20Class_SuggestionAchat::count()%5D][moderation]] [[file:library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php::$nb_moderations%20%3D%20$modstats%5B'avis_notices'%5D%5B'count'%5D][affichage menu gauche]] + + +* Clear identity + ZendAfi_Auth::getInstance()->clearIdentity(); diff --git a/library/ZendAfi/Controller/Plugin/AdminAuth.php b/library/ZendAfi/Controller/Plugin/AdminAuth.php index c2661509bcd..ff937309d24 100644 --- a/library/ZendAfi/Controller/Plugin/AdminAuth.php +++ b/library/ZendAfi/Controller/Plugin/AdminAuth.php @@ -89,6 +89,12 @@ class ZendAfi_Controller_Plugin_AdminAuth extends Zend_Controller_Plugin_Abstrac $controller = 'index'; $action = 'sitedown'; } + + if ((!$user = Class_Users::getIdentity()) && $controller = "abonne") { + $controller = 'auth'; + $action = 'login'; + } + } // Parametres du controller diff --git a/tests/application/modules/telephone/controllers/AbonneControllerTest.php b/tests/application/modules/telephone/controllers/AbonneControllerTest.php index 5069d99ed9a..9da3ee24080 100644 --- a/tests/application/modules/telephone/controllers/AbonneControllerTest.php +++ b/tests/application/modules/telephone/controllers/AbonneControllerTest.php @@ -64,6 +64,24 @@ abstract class AbonneControllerTelephoneTestCase extends TelephoneAbstractContro +class AbonneControllerTelephoneIndexNotConnectedTest extends AbonneControllerTelephoneTestCase { + public function setUp() { + parent::setUp(); + ZendAfi_Auth::getInstance()->clearIdentity(); + $this->dispatch('abonne', true); + } + + + + /** @test */ + public function controllerShouldBeAuth() { + $this->assertController('auth'); + $this->assertAction('login'); + } +} + + + class AbonneControllerTelephoneFicheTest extends AbonneControllerTelephoneTestCase { public function setUp() { -- GitLab