diff --git a/VERSIONS_HOTLINE/181223 b/VERSIONS_HOTLINE/181223 new file mode 100644 index 0000000000000000000000000000000000000000..443189ee52900935c060c30e567bbd7676442b26 --- /dev/null +++ b/VERSIONS_HOTLINE/181223 @@ -0,0 +1 @@ + - correctif #181223 : Administration: correction de la connexion via les fournisseur d'identité en CAS3 \ No newline at end of file diff --git a/library/Class/WebService/Cas3.php b/library/Class/WebService/Cas3.php index bfa69648b3055afea0299f36c7f9da3cbd6dfee4..b464bb3c90844dadbbd3f36d9702977a21a4bf96 100644 --- a/library/Class/WebService/Cas3.php +++ b/library/Class/WebService/Cas3.php @@ -33,6 +33,11 @@ class Class_WebService_Cas3 extends Class_WebService_Cas2 { ? $this->_getValueForIdSite($body, $key) : $this->_getMappingValue($body, $key); + $valid_params = array_keys((new Class_Users)->getRawAttributes()); + $this->_user_attributes = array_filter($this->_user_attributes, + fn($key) => in_array($key, $valid_params), + ARRAY_FILTER_USE_KEY); + return $this; } diff --git a/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationCas3Test.php b/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationCas3Test.php index c56a98053a5980c5d1960cd0566622dc5210db53..f3f12aaa004f2a0e68740049924c1c8ed1467b98 100644 --- a/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationCas3Test.php +++ b/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationCas3Test.php @@ -87,6 +87,7 @@ abstract class IdentityProviderAuthenticationCas3BokehToBokehTestCase return ['nom' => 'lastname', 'prenom' => 'firstname', 'mail' => 'mail', + 'libelle_bib' => 'site_label', 'id_site' => 'site_code']; } @@ -99,7 +100,7 @@ abstract class IdentityProviderAuthenticationCas3BokehToBokehTestCase 'prenom' => 'P.D.', 'password' => '1234', 'civilite' => "1", - 'date_naissance' => '2022-12-08', + 'naissance' => '2022-12-08', 'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE, 'id_site' => 1]); } @@ -140,6 +141,7 @@ class IdentityProviderAuthenticationCas3WrongMappingTest protected function _getMapping() { return ['nom' => 'badlastname', + 'libelle_bib' => 'site_label', 'prenom' => 'firstname']; } @@ -160,6 +162,12 @@ class IdentityProviderAuthenticationCas3WrongMappingTest public function userShouldBeRemotelyLoggedAsModoPortail() { $this->assertEquals('modo_portail', Class_Users::getIdentity()->getNomRole()); } + + + /** @test */ + public function userShouldNotHaveLibelleBibSet(){ + $this->assertTrue(!array_key_exists('libelle_bib',Class_Users::getIdentity()->getRawAttributes())); + } } @@ -378,7 +386,7 @@ class IdentityProviderAuthenticationCas3Bokeh2BokehWithAutoUpdateUsersTest return ['nom' => 'lastname', 'prenom' => 'firstname', 'mail' => 'mail', - 'date_naissance' => 'birth_date', + 'naissance' => 'birth_date', 'idabon' => 'card_number', 'id_sigb' => 'ils_number', 'mail' => 'mail']; @@ -390,7 +398,7 @@ class IdentityProviderAuthenticationCas3Bokeh2BokehWithAutoUpdateUsersTest ['Id', '98134'], ['Nom', 'Pouce'], ['Prenom', 'Tom'], - ['DateNaissance', '1978-08-02'], + ['Naissance', '1978-08-02'], ['Idabon', '123XPE'], ['IdSigb', '22345'], ['Mail', 'tom@pouce.fr'], diff --git a/tests/scenarios/IdentityProvider/cas3ticket.xml b/tests/scenarios/IdentityProvider/cas3ticket.xml index 2be1f805c68b135632e10e86ade7379aa3bbf791..bf9b67d964b15403db990ad69e98ce7dfbeabcf8 100644 --- a/tests/scenarios/IdentityProvider/cas3ticket.xml +++ b/tests/scenarios/IdentityProvider/cas3ticket.xml @@ -11,6 +11,7 @@ <cas:ils_number>22345</cas:ils_number> <cas:birth_date>1978-08-02</cas:birth_date> <cas:postal_code>38123</cas:postal_code> + <cas:site_label>NY Public Library</cas:site_label> <cas:city>Laval</cas:city> <cas:affiliation>supremes</cas:affiliation> <cas:affiliation>temptations</cas:affiliation>