diff --git a/config/autoload/unicaen-app.global.php b/config/autoload/unicaen-app.global.php index 7220bc23d863d57a1bd08f47f47b2336fe63715a..8050d9a65a17baffb3e55b86082dee5180614882 100644 --- a/config/autoload/unicaen-app.global.php +++ b/config/autoload/unicaen-app.global.php @@ -34,8 +34,8 @@ return [ 'app_infos' => [ 'nom' => "EMC2", 'desc' => "Emploi Mobilité Carrière Compétences", - 'version' => "3.1.1", - 'date' => "08/12/2022", + 'version' => "3.1.2", + 'date' => "16/12/2022", // 'liens' => [ // 'COMUE' => [ diff --git a/documentation/release/3.1.2.md b/documentation/release/3.1.2.md index 40d5d8193abf7a40a97e329b69ab004d2cbcc081..24e87bcde0cb4f61e8df619de9278c56288de58f 100644 --- a/documentation/release/3.1.2.md +++ b/documentation/release/3.1.2.md @@ -1,10 +1,11 @@ -**CHANGES version 3.1.1** +**CHANGES version 3.1.2** ----------- **Changements** * Ajout d'un parametre indiquant le chamin d'installation pour la partie Vérification +* Ajout d'une interface pour visualiser le lien User/Agent (/agent/verifier-lien) * [FIX] correction du choix de l'échelon (si plusieurs échelons actifs alors selection du plus récent "en terme de date de passage") * [FIX] propagation d'un renommage de variable sur l'interface des supérieurs hiérarchique diff --git a/module/Application/config/merged/agent.config.php b/module/Application/config/merged/agent.config.php index d263dc896573954cd956a011a1caeeb87968084f..b1758b2d0e2185916bb196770f85e9f86b1b7dcc 100644 --- a/module/Application/config/merged/agent.config.php +++ b/module/Application/config/merged/agent.config.php @@ -141,6 +141,17 @@ return [ AgentPrivileges::AGENT_GESTION_CCC, ], ], + + /** VERIF */ + [ + 'controller' => AgentController::class, + 'action' => [ + 'verifier-lien', + ], + 'privileges' => [ + AgentPrivileges::AGENT_AFFICHER, + ], + ], ], ], ], @@ -158,6 +169,16 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ + 'verifier-lien' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/verifier-lien[/:utilisateur]', + 'defaults' => [ + 'controller' => AgentController::class, + 'action' => 'verifier-lien', + ], + ], + ], /** Fonctions de recherche ************************************************************************/ 'rechercher' => [ 'type' => Literal::class, diff --git a/module/Application/src/Application/Controller/AgentController.php b/module/Application/src/Application/Controller/AgentController.php index a108c2574ddf8ce277c4e76162d41f95de1290c6..eac4bbc68c3e5dd529e4fb5d4a01a5b66b747eec 100644 --- a/module/Application/src/Application/Controller/AgentController.php +++ b/module/Application/src/Application/Controller/AgentController.php @@ -379,6 +379,23 @@ class AgentController extends AbstractActionController return $vm; } + /** Vérification lien Utilisateur <=> Agent **/ + + public function verifierLienAction() : ViewModel + { + $user = $this->getUserService()->getRequestedUser($this); + if ($user === null) $user = $this->getUserService()->getConnectedUser(); + + $agentByUser = $this->getAgentService()->getAgentByUser($user); + $agentByLogin = $this->getAgentService()->getAgentByLogin($user->getUsername()); + + return new ViewModel([ + 'utilisateur' => $user, + 'agentByUser' => $agentByUser, + 'agentByLogin' => $agentByLogin, + ]); + } + /** Recherche d'agent ********************************************************************************************/ public function rechercherLargeAction() : JsonModel diff --git a/module/Application/src/Application/Service/Agent/AgentService.php b/module/Application/src/Application/Service/Agent/AgentService.php index 2fdee58e40c9a22718e752b0e1309ca94fa4e61f..47fc404e3254cdfa3a96269295966dd43ac53a1e 100644 --- a/module/Application/src/Application/Service/Agent/AgentService.php +++ b/module/Application/src/Application/Service/Agent/AgentService.php @@ -681,4 +681,15 @@ class AgentService { return $fiches; } + public function getAgentByLogin(string $login) : ?Agent + { + $qb = $this->createQueryBuilder() + ->andWhere('agent.login = :login')->setParameter('login', $login); + try { + $result = $qb->getQuery()->getOneOrNullResult(); + } catch (NonUniqueResultException $e) { + throw new RuntimeException("Plusieurs Agent partagent le même login [".$login."]",0, $e); + } + return $result; + } } \ No newline at end of file diff --git a/module/Application/view/application/agent/verifier-lien.phtml b/module/Application/view/application/agent/verifier-lien.phtml new file mode 100644 index 0000000000000000000000000000000000000000..925e6512baedf1758924f3973f364c25fe259cc2 --- /dev/null +++ b/module/Application/view/application/agent/verifier-lien.phtml @@ -0,0 +1,80 @@ +<?php + +use Application\Entity\Db\Agent; +use UnicaenUtilisateur\Entity\Db\User; + +/** @see \Application\Controller\AgentController::verifierLienAction() + * @var User|null $utilisateur + * @var Agent|null $agentByLogin + * @var Agent|null $agentByUser + */ + +?> + +<h1 class="page-header"> + Vérification du lien +</h1> + +<div class="card card-default"> + <div class="card-header"> + Information sur l'utilisateur·trice + </div> + <div class="card-body"> + <?php if ($utilisateur === null) : ?> + Aucun·e utilisateur·trice + <?php else : ?> + <dl class="row"> + <dt class="col-md-4">Id </dt> + <dd class="col-md-8"><?php echo $utilisateur->getId(); ?></dd> + <dt class="col-md-4">Username </dt> + <dd class="col-md-8"><?php echo $utilisateur->getUsername(); ?></dd> + <dt class="col-md-4">DisplayName </dt> + <dd class="col-md-8"><?php echo $utilisateur->getDisplayName(); ?></dd> + <dt class="col-md-4">Email </dt> + <dd class="col-md-8"><?php echo $utilisateur->getEmail(); ?></dd> + </dl> + <?php endif; ?> + </div> +</div> + + +<div class="card card-default"> + <div class="card-header"> + Agent (récupérer by User [exploité pour la récupération des dossiers]) + </div> + <div class="card-body"> + <?php if ($agentByUser === null) : ?> + Aucun agent + <?php else : ?> + <dl class="row"> + <dt class="col-md-4">Id </dt> + <dd class="col-md-8"><?php echo $agentByUser->getId(); ?></dd> + <dt class="col-md-4">Dénomination </dt> + <dd class="col-md-8"><?php echo $agentByUser->getDenomination(); ?></dd> + <dt class="col-md-4">Email </dt> + <dd class="col-md-8"><?php echo $agentByUser->getEmail(); ?></dd> + </dl> + <?php endif; ?> + </div> +</div> + +<div class="card card-default"> + <div class="card-header"> + Agent (récupéré by login [pas exploiter pour la récupération des dossiers]) + </div> + <div class="card-body"> + <?php if ($agentByLogin === null) : ?> + Aucun agent + <?php else : ?> + <dl class="row"> + <dt class="col-md-4">Id </dt> + <dd class="col-md-8"><?php echo $agentByLogin->getId(); ?></dd> + <dt class="col-md-4">Dénomination </dt> + <dd class="col-md-8"><?php echo $agentByLogin->getDenomination(); ?></dd> + <dt class="col-md-4">Email </dt> + <dd class="col-md-8"><?php echo $agentByLogin->getEmail(); ?></dd> + </dl> + <?php endif; ?> + </div> +</div> +