Loading config/merged/utilisateur.config.php +20 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,6 @@ return [ 'controller' => UtilisateurController::class, 'action' => [ 'index', 'rechercher', 'lister', 'exporter' ], Loading Loading @@ -87,6 +86,16 @@ return [ UtilisateurPrivileges::UTILISATEUR_MODIFIERROLE, ], ], [ 'controller' => UtilisateurController::class, 'action' => [ 'rechercher', 'rechercher-with-role', ], 'privileges' => [ UtilisateurPrivileges::UTILISATEUR_RECHERCHER, ], ], ], ], ], Loading Loading @@ -154,6 +163,16 @@ return [ ], ], ], 'rechercher-with-role' => [ 'type' => Segment::class, 'options' => [ 'route' => '/rechercher-with-role[/:role]', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'rechercher-with-role', ], ], ], 'add-role' => [ 'type' => Segment::class, 'options' => [ Loading data/sql/data.sql +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ WITH d(code, lib, ordre) AS ( SELECT 'utilisateur_ajouter', 'Ajouter un utilisateur', 2 UNION SELECT 'utilisateur_changerstatus', 'Changer le statut d''un utilisateur', 3 UNION SELECT 'utilisateur_modifierrole', 'Modifier les rôles attribués à un utilisateur', 4 SELECT 'utilisateur_rechercher', 'Recherche d''un utilisateur', 10 ) INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE) SELECT cp.id, d.code, d.lib, d.ordre Loading src/UnicaenUtilisateur/Controller/UtilisateurController.php +23 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,29 @@ class UtilisateurController extends AbstractActionController return new JsonModel($result); } public function rechercherWithRoleAction() : JsonModel { $term = $this->params()->fromQuery('term'); $roleCode = $this->params()->fromRoute('role'); //recherche en interne seulement// $users = $this->getUserService()->getUtilisateursByTermAndRoleId($term, $roleCode); $result = []; foreach ($users as $user) { $result[] = [ 'id' => 'app' . '||' . $user->getId(), 'label' => $user->getDisplayName(), 'extra' => sprintf(' <span class="text-highlight">/</span> %s <span class="text-highlight">/</span> %s %s', $user->getUsername($this->usernamefield), $user->getEmail() ?: "aucun email", '<i title="Utilisateur existant" class="fas fa-check-circle text-success"></i>') ]; } usort($result, function ($a, $b) { return $a['label'] > $b['label']; }); return new JsonModel($result); } public function listerAction() : ViewModel { $users = $this->userService->findAll(); Loading src/UnicaenUtilisateur/Entity/Db/HistoriqueAwareTrait.php +5 −0 Original line number Diff line number Diff line Loading @@ -280,4 +280,9 @@ trait HistoriqueAwareTrait } return "Aucune donnée d'historisation"; } public function getDate(): string { return $this->getHistoCreation()->format('d/m/Y à H:i'); } } No newline at end of file src/UnicaenUtilisateur/ORM/Event/Listeners/HistoriqueListener.php +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ class HistoriqueListener implements EventSubscriber * @param LifecycleEventArgs $args * @throws RuntimeException Aucun utilisateur disponible pour en faire l'auteur de la création/modification */ protected function updateHistorique(LifecycleEventArgs $args) protected function updateHistorique(LifecycleEventArgs $args): void { $entity = $args->getEntity(); Loading Loading
config/merged/utilisateur.config.php +20 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,6 @@ return [ 'controller' => UtilisateurController::class, 'action' => [ 'index', 'rechercher', 'lister', 'exporter' ], Loading Loading @@ -87,6 +86,16 @@ return [ UtilisateurPrivileges::UTILISATEUR_MODIFIERROLE, ], ], [ 'controller' => UtilisateurController::class, 'action' => [ 'rechercher', 'rechercher-with-role', ], 'privileges' => [ UtilisateurPrivileges::UTILISATEUR_RECHERCHER, ], ], ], ], ], Loading Loading @@ -154,6 +163,16 @@ return [ ], ], ], 'rechercher-with-role' => [ 'type' => Segment::class, 'options' => [ 'route' => '/rechercher-with-role[/:role]', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'rechercher-with-role', ], ], ], 'add-role' => [ 'type' => Segment::class, 'options' => [ Loading
data/sql/data.sql +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ WITH d(code, lib, ordre) AS ( SELECT 'utilisateur_ajouter', 'Ajouter un utilisateur', 2 UNION SELECT 'utilisateur_changerstatus', 'Changer le statut d''un utilisateur', 3 UNION SELECT 'utilisateur_modifierrole', 'Modifier les rôles attribués à un utilisateur', 4 SELECT 'utilisateur_rechercher', 'Recherche d''un utilisateur', 10 ) INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE) SELECT cp.id, d.code, d.lib, d.ordre Loading
src/UnicaenUtilisateur/Controller/UtilisateurController.php +23 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,29 @@ class UtilisateurController extends AbstractActionController return new JsonModel($result); } public function rechercherWithRoleAction() : JsonModel { $term = $this->params()->fromQuery('term'); $roleCode = $this->params()->fromRoute('role'); //recherche en interne seulement// $users = $this->getUserService()->getUtilisateursByTermAndRoleId($term, $roleCode); $result = []; foreach ($users as $user) { $result[] = [ 'id' => 'app' . '||' . $user->getId(), 'label' => $user->getDisplayName(), 'extra' => sprintf(' <span class="text-highlight">/</span> %s <span class="text-highlight">/</span> %s %s', $user->getUsername($this->usernamefield), $user->getEmail() ?: "aucun email", '<i title="Utilisateur existant" class="fas fa-check-circle text-success"></i>') ]; } usort($result, function ($a, $b) { return $a['label'] > $b['label']; }); return new JsonModel($result); } public function listerAction() : ViewModel { $users = $this->userService->findAll(); Loading
src/UnicaenUtilisateur/Entity/Db/HistoriqueAwareTrait.php +5 −0 Original line number Diff line number Diff line Loading @@ -280,4 +280,9 @@ trait HistoriqueAwareTrait } return "Aucune donnée d'historisation"; } public function getDate(): string { return $this->getHistoCreation()->format('d/m/Y à H:i'); } } No newline at end of file
src/UnicaenUtilisateur/ORM/Event/Listeners/HistoriqueListener.php +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ class HistoriqueListener implements EventSubscriber * @param LifecycleEventArgs $args * @throws RuntimeException Aucun utilisateur disponible pour en faire l'auteur de la création/modification */ protected function updateHistorique(LifecycleEventArgs $args) protected function updateHistorique(LifecycleEventArgs $args): void { $entity = $args->getEntity(); Loading