Loading module/Application/config/others/doctorant.config.php +2 −3 Changes for module/Application/config/others/doctorant.config.php: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ use Application\Controller\Factory\DoctorantControllerFactory; use Application\Provider\Privilege\DoctorantPrivileges; use Application\Service\Doctorant\DoctorantService; use Application\Service\Doctorant\DoctorantServiceFactory; use UnicaenAuth\Guard\PrivilegeController; use UnicaenAuth\Provider\Rule\PrivilegeRuleProvider; return [ 'bjyauthorize' => [ Loading Loading @@ -93,10 +93,9 @@ return [ ), 'service_manager' => [ 'invokables' => array( 'DoctorantService' => DoctorantService::class, ), 'factories' => [ 'DoctorantService' => DoctorantServiceFactory::class, ], 'aliases' => [ DoctorantService::class => 'DoctorantService', Loading module/Application/config/others/etablissement.config.php +3 Changes for module/Application/config/others/etablissement.config.php: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ return [ ], 'factories' => [ ], 'aliases' => [ EtablissementService::class => 'EtablissementService', ] ], 'controllers' => [ 'invokables' => [ Loading module/Application/src/Application/Authentication/Storage/AppStorage.php +1 −11 Changes for module/Application/src/Application/Authentication/Storage/AppStorage.php: 1 added line, 11 removed lines. Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ use Application\Entity\UserWrapper; use Application\Service\Doctorant\DoctorantServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Utilisateur\UtilisateurServiceAwareTrait; use Doctrine\ORM\NonUniqueResultException; use UnicaenApp\Exception\RuntimeException; use UnicaenAuth\Authentication\Storage\ChainableStorage; use UnicaenAuth\Authentication\Storage\ChainEvent; Loading Loading @@ -106,16 +105,7 @@ class AppStorage implements ChainableStorage return $this->doctorant; } $id = $this->userWrapper->getSupannId(); $domaineEtab = $this->userWrapper->getDomainFromEppn(); $etablissement = $this->getEtablissementService()->getRepository()->findOneByDomaine($domaineEtab); $sourceCode = $etablissement->prependPrefixTo($id); try { $this->doctorant = $this->doctorantService->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } $this->doctorant = $this->doctorantService->findOneByUserWrapper($this->userWrapper); return $this->doctorant; } Loading module/Application/src/Application/Provider/IdentityProvider.php +1 −12 Changes for module/Application/src/Application/Provider/IdentityProvider.php: 1 added line, 12 removed lines. Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ use Application\Service\Role\RoleServiceAwareTrait; use Application\Service\UniteRecherche\UniteRechercheServiceAwareTrait; use Application\Service\Utilisateur\UtilisateurServiceAwareTrait; use BjyAuthorize\Provider\Identity\ProviderInterface; use Doctrine\ORM\NonUniqueResultException; use UnicaenApp\Exception\RuntimeException; use UnicaenAuth\Provider\Identity\ChainableProvider; use UnicaenAuth\Provider\Identity\ChainEvent; use Zend\Authentication\AuthenticationService; Loading Loading @@ -159,16 +157,7 @@ class IdentityProvider implements ProviderInterface, ChainableProvider, ServiceL */ private function getRolesFromDoctorant() { $id = $this->userWrapper->getSupannId(); $domaineEtab = $this->userWrapper->getDomainFromEppn(); $etablissement = $this->getEtablissementService()->getRepository()->findOneByDomaine($domaineEtab); $sourceCode = $etablissement->prependPrefixTo($id); try { $doctorant = $this->doctorantService->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } $doctorant = $this->doctorantService->findOneByUserWrapper($this->userWrapper); if (! $doctorant) { return []; Loading module/Application/src/Application/Service/Doctorant/DoctorantService.php +38 Changes for module/Application/src/Application/Service/Doctorant/DoctorantService.php: 38 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,10 +5,16 @@ namespace Application\Service\Doctorant; use Application\Entity\Db\Doctorant; use Application\Entity\Db\DoctorantCompl; use Application\Entity\Db\Repository\DoctorantRepository; use Application\Entity\UserWrapper; use Application\Service\BaseService; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Doctrine\ORM\NonUniqueResultException; use UnicaenApp\Exception\RuntimeException; class DoctorantService extends BaseService { use EtablissementServiceAwareTrait; /** * @return DoctorantRepository */ Loading Loading @@ -47,4 +53,36 @@ class DoctorantService extends BaseService return $complement; } /** * @param UserWrapper $user * @return Doctorant|null */ public function findOneByUserWrapper(UserWrapper $user) { $id = $user->getSupannId(); if (! $id) { throw new RuntimeException("Aucun id supann disponible."); } $domaineEtab = $user->getDomainFromEppn(); if (! $domaineEtab) { return null; } $etablissement = $this->getEtablissementService()->getRepository()->findOneByDomaine($domaineEtab); if (! $etablissement) { throw new RuntimeException("Aucun établissement trouvé avec ce domaine: " . $domaineEtab); } $sourceCode = $etablissement->prependPrefixTo($id); try { $doctorant = $this->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Anomalie: plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } return $doctorant; } } No newline at end of file Loading
module/Application/config/others/doctorant.config.php +2 −3 Changes for module/Application/config/others/doctorant.config.php: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ use Application\Controller\Factory\DoctorantControllerFactory; use Application\Provider\Privilege\DoctorantPrivileges; use Application\Service\Doctorant\DoctorantService; use Application\Service\Doctorant\DoctorantServiceFactory; use UnicaenAuth\Guard\PrivilegeController; use UnicaenAuth\Provider\Rule\PrivilegeRuleProvider; return [ 'bjyauthorize' => [ Loading Loading @@ -93,10 +93,9 @@ return [ ), 'service_manager' => [ 'invokables' => array( 'DoctorantService' => DoctorantService::class, ), 'factories' => [ 'DoctorantService' => DoctorantServiceFactory::class, ], 'aliases' => [ DoctorantService::class => 'DoctorantService', Loading
module/Application/config/others/etablissement.config.php +3 Changes for module/Application/config/others/etablissement.config.php: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ return [ ], 'factories' => [ ], 'aliases' => [ EtablissementService::class => 'EtablissementService', ] ], 'controllers' => [ 'invokables' => [ Loading
module/Application/src/Application/Authentication/Storage/AppStorage.php +1 −11 Changes for module/Application/src/Application/Authentication/Storage/AppStorage.php: 1 added line, 11 removed lines. Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ use Application\Entity\UserWrapper; use Application\Service\Doctorant\DoctorantServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Utilisateur\UtilisateurServiceAwareTrait; use Doctrine\ORM\NonUniqueResultException; use UnicaenApp\Exception\RuntimeException; use UnicaenAuth\Authentication\Storage\ChainableStorage; use UnicaenAuth\Authentication\Storage\ChainEvent; Loading Loading @@ -106,16 +105,7 @@ class AppStorage implements ChainableStorage return $this->doctorant; } $id = $this->userWrapper->getSupannId(); $domaineEtab = $this->userWrapper->getDomainFromEppn(); $etablissement = $this->getEtablissementService()->getRepository()->findOneByDomaine($domaineEtab); $sourceCode = $etablissement->prependPrefixTo($id); try { $this->doctorant = $this->doctorantService->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } $this->doctorant = $this->doctorantService->findOneByUserWrapper($this->userWrapper); return $this->doctorant; } Loading
module/Application/src/Application/Provider/IdentityProvider.php +1 −12 Changes for module/Application/src/Application/Provider/IdentityProvider.php: 1 added line, 12 removed lines. Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ use Application\Service\Role\RoleServiceAwareTrait; use Application\Service\UniteRecherche\UniteRechercheServiceAwareTrait; use Application\Service\Utilisateur\UtilisateurServiceAwareTrait; use BjyAuthorize\Provider\Identity\ProviderInterface; use Doctrine\ORM\NonUniqueResultException; use UnicaenApp\Exception\RuntimeException; use UnicaenAuth\Provider\Identity\ChainableProvider; use UnicaenAuth\Provider\Identity\ChainEvent; use Zend\Authentication\AuthenticationService; Loading Loading @@ -159,16 +157,7 @@ class IdentityProvider implements ProviderInterface, ChainableProvider, ServiceL */ private function getRolesFromDoctorant() { $id = $this->userWrapper->getSupannId(); $domaineEtab = $this->userWrapper->getDomainFromEppn(); $etablissement = $this->getEtablissementService()->getRepository()->findOneByDomaine($domaineEtab); $sourceCode = $etablissement->prependPrefixTo($id); try { $doctorant = $this->doctorantService->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } $doctorant = $this->doctorantService->findOneByUserWrapper($this->userWrapper); if (! $doctorant) { return []; Loading
module/Application/src/Application/Service/Doctorant/DoctorantService.php +38 Changes for module/Application/src/Application/Service/Doctorant/DoctorantService.php: 38 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,10 +5,16 @@ namespace Application\Service\Doctorant; use Application\Entity\Db\Doctorant; use Application\Entity\Db\DoctorantCompl; use Application\Entity\Db\Repository\DoctorantRepository; use Application\Entity\UserWrapper; use Application\Service\BaseService; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Doctrine\ORM\NonUniqueResultException; use UnicaenApp\Exception\RuntimeException; class DoctorantService extends BaseService { use EtablissementServiceAwareTrait; /** * @return DoctorantRepository */ Loading Loading @@ -47,4 +53,36 @@ class DoctorantService extends BaseService return $complement; } /** * @param UserWrapper $user * @return Doctorant|null */ public function findOneByUserWrapper(UserWrapper $user) { $id = $user->getSupannId(); if (! $id) { throw new RuntimeException("Aucun id supann disponible."); } $domaineEtab = $user->getDomainFromEppn(); if (! $domaineEtab) { return null; } $etablissement = $this->getEtablissementService()->getRepository()->findOneByDomaine($domaineEtab); if (! $etablissement) { throw new RuntimeException("Aucun établissement trouvé avec ce domaine: " . $domaineEtab); } $sourceCode = $etablissement->prependPrefixTo($id); try { $doctorant = $this->getRepository()->findOneBySourceCode($sourceCode); } catch (NonUniqueResultException $e) { throw new RuntimeException("Anomalie: plusieurs doctorants ont été trouvés avec le même source code: " . $sourceCode); } return $doctorant; } } No newline at end of file