diff --git a/application/modules/opac/views/scripts/panier/edit.phtml b/application/modules/opac/views/scripts/panier/edit.phtml index f3df68f499333aa6bcd841a78d0169ec858068bb..be12f92a27fb9221e2ae85a4c1221cb444266678 100644 --- a/application/modules/opac/views/scripts/panier/edit.phtml +++ b/application/modules/opac/views/scripts/panier/edit.phtml @@ -4,7 +4,7 @@ 'id_panier'=>$this->panier->getId()],null,true) ?>"> <?php $domaine_select = ''; - if(Class_Users::getIdentity()->canAccessBackend()) { + if(Class_Users::getIdentity()->hasRightAccessDomaines()) { $domaine_select = '<fieldset><legend>'.$this->_('Ranger le panier dans des domaines').'</legend>' .$this->domaineSelect($this->panier) .'</fieldset>'; diff --git a/tests/application/modules/opac/controllers/PanierControllerTest.php b/tests/application/modules/opac/controllers/PanierControllerTest.php index 121f04f5d5f107ace74684162f9e4a337564badd..16a2cd8754733bbf1d5fda9baad15a75a541b1d4 100644 --- a/tests/application/modules/opac/controllers/PanierControllerTest.php +++ b/tests/application/modules/opac/controllers/PanierControllerTest.php @@ -1361,6 +1361,58 @@ class PanierControllerEditActionAsAdminTest extends AbstractControllerTestCase { +class PanierControllerEditActionAsContributeurWithOutRightForAccessDomaineTest extends AbstractControllerTestCase { + public function setup() { + parent::setup(); + + Class_Users::beVolatile(); + Class_PanierNotice::beVolatile(); + Class_UserGroup::beVolatile(); + + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_PanierNotice') + ->whenCalled('findAllWithCatalogue') + ->answers([]); + + $roger = Class_Users::newInstanceWithId(23, ['pseudo' => 'RogerL', + 'nom' => 'plou', + 'login' => 'man', + 'password' => '123']); + + $roger->changeRoleTo(ZendAfi_Acl_AdminControllerRoles::MODO_BIB); + $roger->setUserGroups([]); + $roger->save(); + + $mes_livres = Class_PanierNotice::newInstanceWithId(465,['libelle' => 'Mes Livres', + 'date_maj' => '10/02/2011', + 'user' => $roger]); + $mes_livres->save(); + + ZendAfi_Auth::getInstance()->logUser($roger); + + $this->dispatch('/panier/edit/id_panier/465'); + } + + /** @test **/ + public function editLibelleShouldBeFillWithMesLivresWhenLogAsModoBib() { + $this->assertXPath('//input[@name="new_libelle"][@value="Mes Livres"]',$this->_response->getBody()); + } + + + /** @test **/ + public function inputIdItemsShouldNotBeDisplayWithOutRightForAccessDomaine() { + $this->assertNotXPath('//input[@type="hidden"][@name="id_items"]',$this->_response->getBody()); + } + + + /** @test **/ + public function inputIdDomaineShouldBeDisplayWithOutRightForAccessDomaine() { + $this->assertNotXPath('//input[@type="hidden"][@name="domaine_ids"]',$this->_response->getBody()); + } + +} + + + class PanierControllerCreerPanierAjaxActionTest extends AbstractControllerTestCase { public function setUp() { parent::setUp();