Loading composer.lock +13 −13 Changes for composer.lock: 13 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -880,16 +880,16 @@ }, { "name": "guzzlehttp/guzzle", "version": "6.3.0", "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90", "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90", "shasum": "" }, "require": { Loading @@ -899,7 +899,7 @@ }, "require-dev": { "ext-curl": "*", "phpunit/phpunit": "^4.0 || ^5.0", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4", "psr/log": "^1.0" }, "suggest": { Loading @@ -908,7 +908,7 @@ "type": "library", "extra": { "branch-alias": { "dev-master": "6.2-dev" "dev-master": "6.3-dev" } }, "autoload": { Loading Loading @@ -941,7 +941,7 @@ "rest", "web service" ], "time": "2017-06-22T18:50:49+00:00" "time": "2018-03-26T16:33:04+00:00" }, { "name": "guzzlehttp/promises", Loading Loading @@ -1807,11 +1807,11 @@ }, { "name": "unicaen/app", "version": "1.3.9", "version": "1.3.10", "source": { "type": "git", "url": "https://git.unicaen.fr/lib/unicaen/app.git", "reference": "fb1e326800b7810fd32b3e289b376aef2b75e67e" "reference": "845dd41da189fdd5e39f6d2d882e05b77a16c5dc" }, "require": { "doctrine/doctrine-orm-module": ">=0.7", Loading Loading @@ -1854,15 +1854,15 @@ ] }, "description": "Module de base des applications unicaen", "time": "2018-03-21T08:44:30+00:00" "time": "2018-03-28T08:06:13+00:00" }, { "name": "unicaen/auth", "version": "1.2.3", "version": "1.2.5", "source": { "type": "git", "url": "https://git.unicaen.fr/lib/unicaen/auth.git", "reference": "9ed3d15cc199db526c144a0d954e63c81344eafd" "reference": "4f1a531c08b1474340e9d90e92a1ad7b18dda620" }, "require": { "bjyoungblood/bjy-authorize": ">=1.4", Loading @@ -1884,7 +1884,7 @@ ] }, "description": "Module d'authentification pour les applications Unicaen", "time": "2018-03-26T13:11:52+00:00" "time": "2018-03-28T08:19:16+00:00" }, { "name": "unicaen/code", Loading module/Application/src/Application/Authentication/Storage/AppStorage.php +10 −26 Changes for module/Application/src/Application/Authentication/Storage/AppStorage.php: 10 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -2,10 +2,9 @@ namespace Application\Authentication\Storage; use Application\Entity\UserWrapper; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Etablissement; use Application\Entity\Db\Utilisateur; use Application\Entity\UserWrapper; use Application\Service\Doctorant\DoctorantServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Utilisateur\UtilisateurServiceAwareTrait; Loading @@ -30,14 +29,9 @@ class AppStorage implements ChainableStorage use DoctorantServiceAwareTrait; use EtablissementServiceAwareTrait; const KEY_DB_UTILSATEUR = 'db'; const KEY_DB_UTILISATEUR = 'db'; const KEY_DOCTORANT = 'doctorant'; /** * @var array */ private $contents; /** * @var UserWrapper */ Loading @@ -50,20 +44,16 @@ class AppStorage implements ChainableStorage /** * @param ChainEvent $e * @throws \Zend\Authentication\Exception\ExceptionInterface */ public function read(ChainEvent $e) { $this->contents = $e->getContents(); if (null === $this->contents['ldap'] && null === $this->contents['shib']) { $this->userWrapper = UserWrapper::instFromStorageChainEvent($e); if ($this->userWrapper === null) { return; } $this->userWrapper = UserWrapper::inst($this->contents['ldap'] ?: $this->contents['shib']); /** * Recherche de l'utilisateur connecté dans la table Utilisateur. * Collecte des données issues de la table Utilisateur. */ $this->addDbUtilisateurContents($e); Loading @@ -79,7 +69,7 @@ class AppStorage implements ChainableStorage protected function addDbUtilisateurContents(ChainEvent $e) { try { $e->addContents(self::KEY_DB_UTILSATEUR, $this->fetchUtilisateur()); $e->addContents(self::KEY_DB_UTILISATEUR, $this->fetchUtilisateur()); } catch (ExceptionInterface $e) { throw new RuntimeException("Erreur imprévue rencontrée.", 0, $e); } Loading Loading @@ -116,21 +106,15 @@ class AppStorage implements ChainableStorage return $this->doctorant; } /** * NB: Un doctorant a la possibilité de s'authentifier : * - avec son numéro étudiant (Doctorant::sourceCode), * - avec son persopass (DoctorantCompl::persopass), seulement après qu'il l'a saisi sur la page d'identité de la thèse. */ $username = $this->userWrapper->getUsername(); $id = $this->userWrapper->getSupannId(); $domaineEtab = $this->userWrapper->getDomainFromEppn(); /** @var Etablissement $etablissement */ $etablissement = $this->etablissementService->getRepository()->findOneByDomaine($domaineEtab); $sourceCode = $etablissement->prependPrefixTo($id); try { $this->doctorant = $this->doctorantService->getRepository()->findOneByUsernameAndEtab($username, $etablissement); $this->doctorant = $this->doctorantService->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même username: " . $username); throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } return $this->doctorant; Loading module/Application/src/Application/Entity/Db/Individu.php +3 −3 Changes for module/Application/src/Application/Entity/Db/Individu.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -284,11 +284,11 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface /** * Set civilite * * @param string $civilite * @param string|null $civilite * * @return self */ public function setCivilite($civilite) public function setCivilite($civilite = null) { $this->civilite = $civilite; Loading @@ -298,7 +298,7 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface /** * Get civilite * * @return string * @return string|null */ public function getCivilite() { Loading module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Individu.dcm.xml +1 −1 Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Individu.dcm.xml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ <generator strategy="SEQUENCE"/> </id> <field name="civilite" type="string" column="CIVILITE" length="5" nullable="false"/> <field name="civilite" type="string" column="CIVILITE" length="5" nullable="true"/> <field name="dateNaissance" type="datetime" column="DATE_NAISSANCE" nullable="false"/> <field name="nationalite" type="string" column="NATIONALITE" nullable="true"/> <field name="email" type="string" column="EMAIL" length="255" nullable="true"/> Loading module/Application/src/Application/Entity/Db/Repository/DoctorantRepository.php +6 −9 Changes for module/Application/src/Application/Entity/Db/Repository/DoctorantRepository.php: 6 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -3,27 +3,24 @@ namespace Application\Entity\Db\Repository; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Etablissement; use Doctrine\ORM\NonUniqueResultException; class DoctorantRepository extends DefaultEntityRepository { /** * @param string $username * @param Etablissement $etablissement * @param string $sourceCode * @return Doctorant * @throws NonUniqueResultException */ public function findOneByUsernameAndEtab($username, Etablissement $etablissement) public function findOneBySourceCode($sourceCode) { $qb = $this->createQueryBuilder('t'); $qb ->leftJoin('t.complements', 'c') ->addSelect('i') ->join('t.individu', 'i') ->where('t.sourceCode = :sourceCode') ->andWhere('1 = pasHistorise(t)') // todo: ajouter le code étab au persopass enregistré dans la table DOCTORANT_COMPL ->andWhere('t.sourceCode = :sourceCode OR c.persopass = :persopass') ->setParameter('sourceCode', $etablissement->getCode() . '::' . $username) ->setParameter('persopass', $username); ->setParameter('sourceCode', $sourceCode); return $qb->getQuery()->getOneOrNullResult(); } Loading Loading
composer.lock +13 −13 Changes for composer.lock: 13 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -880,16 +880,16 @@ }, { "name": "guzzlehttp/guzzle", "version": "6.3.0", "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90", "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90", "shasum": "" }, "require": { Loading @@ -899,7 +899,7 @@ }, "require-dev": { "ext-curl": "*", "phpunit/phpunit": "^4.0 || ^5.0", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4", "psr/log": "^1.0" }, "suggest": { Loading @@ -908,7 +908,7 @@ "type": "library", "extra": { "branch-alias": { "dev-master": "6.2-dev" "dev-master": "6.3-dev" } }, "autoload": { Loading Loading @@ -941,7 +941,7 @@ "rest", "web service" ], "time": "2017-06-22T18:50:49+00:00" "time": "2018-03-26T16:33:04+00:00" }, { "name": "guzzlehttp/promises", Loading Loading @@ -1807,11 +1807,11 @@ }, { "name": "unicaen/app", "version": "1.3.9", "version": "1.3.10", "source": { "type": "git", "url": "https://git.unicaen.fr/lib/unicaen/app.git", "reference": "fb1e326800b7810fd32b3e289b376aef2b75e67e" "reference": "845dd41da189fdd5e39f6d2d882e05b77a16c5dc" }, "require": { "doctrine/doctrine-orm-module": ">=0.7", Loading Loading @@ -1854,15 +1854,15 @@ ] }, "description": "Module de base des applications unicaen", "time": "2018-03-21T08:44:30+00:00" "time": "2018-03-28T08:06:13+00:00" }, { "name": "unicaen/auth", "version": "1.2.3", "version": "1.2.5", "source": { "type": "git", "url": "https://git.unicaen.fr/lib/unicaen/auth.git", "reference": "9ed3d15cc199db526c144a0d954e63c81344eafd" "reference": "4f1a531c08b1474340e9d90e92a1ad7b18dda620" }, "require": { "bjyoungblood/bjy-authorize": ">=1.4", Loading @@ -1884,7 +1884,7 @@ ] }, "description": "Module d'authentification pour les applications Unicaen", "time": "2018-03-26T13:11:52+00:00" "time": "2018-03-28T08:19:16+00:00" }, { "name": "unicaen/code", Loading
module/Application/src/Application/Authentication/Storage/AppStorage.php +10 −26 Changes for module/Application/src/Application/Authentication/Storage/AppStorage.php: 10 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -2,10 +2,9 @@ namespace Application\Authentication\Storage; use Application\Entity\UserWrapper; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Etablissement; use Application\Entity\Db\Utilisateur; use Application\Entity\UserWrapper; use Application\Service\Doctorant\DoctorantServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Utilisateur\UtilisateurServiceAwareTrait; Loading @@ -30,14 +29,9 @@ class AppStorage implements ChainableStorage use DoctorantServiceAwareTrait; use EtablissementServiceAwareTrait; const KEY_DB_UTILSATEUR = 'db'; const KEY_DB_UTILISATEUR = 'db'; const KEY_DOCTORANT = 'doctorant'; /** * @var array */ private $contents; /** * @var UserWrapper */ Loading @@ -50,20 +44,16 @@ class AppStorage implements ChainableStorage /** * @param ChainEvent $e * @throws \Zend\Authentication\Exception\ExceptionInterface */ public function read(ChainEvent $e) { $this->contents = $e->getContents(); if (null === $this->contents['ldap'] && null === $this->contents['shib']) { $this->userWrapper = UserWrapper::instFromStorageChainEvent($e); if ($this->userWrapper === null) { return; } $this->userWrapper = UserWrapper::inst($this->contents['ldap'] ?: $this->contents['shib']); /** * Recherche de l'utilisateur connecté dans la table Utilisateur. * Collecte des données issues de la table Utilisateur. */ $this->addDbUtilisateurContents($e); Loading @@ -79,7 +69,7 @@ class AppStorage implements ChainableStorage protected function addDbUtilisateurContents(ChainEvent $e) { try { $e->addContents(self::KEY_DB_UTILSATEUR, $this->fetchUtilisateur()); $e->addContents(self::KEY_DB_UTILISATEUR, $this->fetchUtilisateur()); } catch (ExceptionInterface $e) { throw new RuntimeException("Erreur imprévue rencontrée.", 0, $e); } Loading Loading @@ -116,21 +106,15 @@ class AppStorage implements ChainableStorage return $this->doctorant; } /** * NB: Un doctorant a la possibilité de s'authentifier : * - avec son numéro étudiant (Doctorant::sourceCode), * - avec son persopass (DoctorantCompl::persopass), seulement après qu'il l'a saisi sur la page d'identité de la thèse. */ $username = $this->userWrapper->getUsername(); $id = $this->userWrapper->getSupannId(); $domaineEtab = $this->userWrapper->getDomainFromEppn(); /** @var Etablissement $etablissement */ $etablissement = $this->etablissementService->getRepository()->findOneByDomaine($domaineEtab); $sourceCode = $etablissement->prependPrefixTo($id); try { $this->doctorant = $this->doctorantService->getRepository()->findOneByUsernameAndEtab($username, $etablissement); $this->doctorant = $this->doctorantService->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même username: " . $username); throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } return $this->doctorant; Loading
module/Application/src/Application/Entity/Db/Individu.php +3 −3 Changes for module/Application/src/Application/Entity/Db/Individu.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -284,11 +284,11 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface /** * Set civilite * * @param string $civilite * @param string|null $civilite * * @return self */ public function setCivilite($civilite) public function setCivilite($civilite = null) { $this->civilite = $civilite; Loading @@ -298,7 +298,7 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface /** * Get civilite * * @return string * @return string|null */ public function getCivilite() { Loading
module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Individu.dcm.xml +1 −1 Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Individu.dcm.xml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ <generator strategy="SEQUENCE"/> </id> <field name="civilite" type="string" column="CIVILITE" length="5" nullable="false"/> <field name="civilite" type="string" column="CIVILITE" length="5" nullable="true"/> <field name="dateNaissance" type="datetime" column="DATE_NAISSANCE" nullable="false"/> <field name="nationalite" type="string" column="NATIONALITE" nullable="true"/> <field name="email" type="string" column="EMAIL" length="255" nullable="true"/> Loading
module/Application/src/Application/Entity/Db/Repository/DoctorantRepository.php +6 −9 Changes for module/Application/src/Application/Entity/Db/Repository/DoctorantRepository.php: 6 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -3,27 +3,24 @@ namespace Application\Entity\Db\Repository; use Application\Entity\Db\Doctorant; use Application\Entity\Db\Etablissement; use Doctrine\ORM\NonUniqueResultException; class DoctorantRepository extends DefaultEntityRepository { /** * @param string $username * @param Etablissement $etablissement * @param string $sourceCode * @return Doctorant * @throws NonUniqueResultException */ public function findOneByUsernameAndEtab($username, Etablissement $etablissement) public function findOneBySourceCode($sourceCode) { $qb = $this->createQueryBuilder('t'); $qb ->leftJoin('t.complements', 'c') ->addSelect('i') ->join('t.individu', 'i') ->where('t.sourceCode = :sourceCode') ->andWhere('1 = pasHistorise(t)') // todo: ajouter le code étab au persopass enregistré dans la table DOCTORANT_COMPL ->andWhere('t.sourceCode = :sourceCode OR c.persopass = :persopass') ->setParameter('sourceCode', $etablissement->getCode() . '::' . $username) ->setParameter('persopass', $username); ->setParameter('sourceCode', $sourceCode); return $qb->getQuery()->getOneOrNullResult(); } Loading