diff --git a/VERSIONS_HOTLINE/155169 b/VERSIONS_HOTLINE/155169 new file mode 100644 index 0000000000000000000000000000000000000000..80b54c87bede751c318a02cb5d9d1e21e4a8b434 --- /dev/null +++ b/VERSIONS_HOTLINE/155169 @@ -0,0 +1 @@ + - correctif #155169 : Compte lecteur : correction de l'affichage des cartes liées. \ No newline at end of file diff --git a/library/Class/Users.php b/library/Class/Users.php index cb32fee471ba49df1f2e3ec75fa07f2cd56af8a9..b872b378f14feb5d9c972b53aefa194e5238d831 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -2046,8 +2046,12 @@ class Class_Users extends Storm_Model_Abstract { if ('1' !== (string) $this->getOrdreabon()) return []; + if ( ! $this->isAbonne()) + return []; + /* findAllBy(['… not' => '…']) is not compatible with volatile fixtures */ - return (new Storm_Model_Collection($this->getLoader()->findAllBy(['idabon' => $this->getIdabon()]))) + return (new Storm_Model_Collection($this->getLoader()->findAllBy(['idabon' => $this->getIdabon(), + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]))) ->select((fn($user) => '1' !== (string) $user->getOrdreabon() && $user->getId() !== $this->getId())) ->getArrayCopy(); diff --git a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php index 05e52709157ebe78499222f3f36945aad90d93a7..25c6ff8d3c7fa2ced22290a84d71c0e39bf63532 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php @@ -1221,7 +1221,9 @@ class AbonneControllerPretsListWithILSChildCardLinkTest extends AbonneController 'password' => 123456, 'nom' => 'Lemérovingien', 'prenom' => 'Romain', - 'ordreabon' => 155 + 'ordreabon' => 155, + 'role_level' => 2, + 'id_site' => 1, ]); $item = $this->fixture(Class_Exemplaire::class, diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index 965eef3c89a667faef99947acbf0d7770ffc96d0..812e585f9a981bb3e16b5a8e6dbdb23c1e02cae5 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -503,6 +503,7 @@ abstract class TemplatesDispatchAbonneWithILSChildCardTestCase extends Templates $user = $this->fixture(Class_Users::class, ['id' => 42, + 'role_level' => 2, 'idabon' => 123456, 'id_sigb' => 12738917239, 'login' => 123456, @@ -597,6 +598,24 @@ class TemplatesDispatchAbonnesWithILSChildCardFailuresTest extends TemplatesDisp $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', utf8_encode('Béart en public')); } + + + /** @test */ + public function withWrongRoleShouldNotContainsBeartEnPublic() { + Class_Users::find(42)->setRoleLevel(1)->save(); + $this->dispatch('/opac/abonne/ajax-loans/id_profil/72'); + $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', + utf8_encode('Béart en public')); + } + + + /** @test */ + public function withWrongRoleOnCurrentUserShouldNotContainsBeartEnPublic() { + Class_Users::getIdentity()->setRoleLevel(1)->save(); + $this->dispatch('/opac/abonne/ajax-loans/id_profil/72'); + $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', + utf8_encode('Béart en public')); + } }