Loading module/Application/src/Application/Assertion/AgentAssertion.php +6 −14 Changes for module/Application/src/Application/Assertion/AgentAssertion.php: 6 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ use Application\Provider\Privilege\AgentPrivileges; use Application\Provider\Role\RoleProvider as AppRoleProvider; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\AgentAffectation\AgentAffectationServiceAwareTrait; use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait; use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait; use Structure\Provider\Role\RoleProvider as StructureRoleProvider; use Structure\Service\Structure\StructureServiceAwareTrait; use UnicaenPrivilege\Assertion\AbstractAssertion; Loading @@ -17,6 +19,8 @@ use Laminas\Permissions\Acl\Resource\ResourceInterface; class AgentAssertion extends AbstractAssertion { use AgentServiceAwareTrait; use AgentAutoriteServiceAwareTrait; use AgentSuperieurServiceAwareTrait; use AgentAffectationServiceAwareTrait; use StructureServiceAwareTrait; use UserServiceAwareTrait; Loading @@ -42,13 +46,11 @@ class AgentAssertion extends AbstractAssertion } $isResponsable = false; $isGestionnaire = false; $isSuperieur = false; $isAutorite = false; if ($role->getRoleId() === StructureRoleProvider::RESPONSABLE) $isResponsable = $this->getStructureService()->isResponsableS($structures, $agent); if ($role->getRoleId() === StructureRoleProvider::GESTIONNAIRE) $isGestionnaire = $this->getStructureService()->isGestionnaireS($structures, $agent); if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $entity->hasSuperieurHierarchique($agent); if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $entity->hasAutoriteHierarchique($agent); if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $this->getAgentSuperieurService()->isSuperieur($entity,$agent); if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $this->getAgentAutoriteService()->isAutorite($entity,$agent); switch ($privilege) { case AgentPrivileges::AGENT_AFFICHER : Loading @@ -59,8 +61,6 @@ class AgentAssertion extends AbstractAssertion return true; case StructureRoleProvider::RESPONSABLE: return $isResponsable; case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case Agent::ROLE_SUPERIEURE: return $isSuperieur; case Agent::ROLE_AUTORITE: Loading @@ -81,8 +81,6 @@ class AgentAssertion extends AbstractAssertion return true; // case RoleConstant::PERSONNEL: // return ($entity->getUtilisateur() === $user) AND $entity->hasEntretienEnCours(); case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case StructureRoleProvider::RESPONSABLE: return $isResponsable; case Agent::ROLE_SUPERIEURE; Loading @@ -104,8 +102,6 @@ class AgentAssertion extends AbstractAssertion case AppRoleProvider::ADMIN_FONC: case AppRoleProvider::ADMIN_TECH: return true; case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case StructureRoleProvider::RESPONSABLE: return $isResponsable; } Loading Loading @@ -141,11 +137,9 @@ class AgentAssertion extends AbstractAssertion } $isResponsable = false; $isGestionnaire = false; $isSuperieur = false; $isAutorite = false; if ($role->getRoleId() === StructureRoleProvider::RESPONSABLE) $isResponsable = $this->getStructureService()->isResponsableS($structures, $agent); if ($role->getRoleId() === StructureRoleProvider::GESTIONNAIRE) $isGestionnaire = $this->getStructureService()->isGestionnaireS($structures, $agent); if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $entity->hasSuperieurHierarchique($agent); if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $entity->hasAutoriteHierarchique($agent); Loading @@ -159,8 +153,6 @@ class AgentAssertion extends AbstractAssertion return true; case StructureRoleProvider::RESPONSABLE: return $isResponsable; case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case Agent::ROLE_SUPERIEURE: return $isSuperieur; case Agent::ROLE_AUTORITE: Loading module/Application/src/Application/Assertion/AgentAssertionFactory.php +8 Changes for module/Application/src/Application/Assertion/AgentAssertionFactory.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ namespace Application\Assertion; use Application\Service\Agent\AgentService; use Application\Service\AgentAffectation\AgentAffectationService; use Application\Service\AgentAutorite\AgentAutoriteService; use Application\Service\AgentSuperieur\AgentSuperieurService; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; Loading @@ -23,11 +25,15 @@ class AgentAssertionFactory { { /** * @var AgentService $agentService * @var AgentAutoriteService $agentAutoriteService * @var AgentSuperieurService $agentSuperieurService * @var AgentAffectationService $agentAffectationService * @var StructureService $structureService * @var UserService $userService */ $agentService = $container->get(AgentService::class); $agentAutoriteService = $container->get(AgentAutoriteService::class); $agentSuperieurService = $container->get(AgentSuperieurService::class); $agentAffectationService = $container->get(AgentAffectationService::class); $structureService = $container->get(StructureService::class); $userService = $container->get(UserService::class); Loading @@ -35,6 +41,8 @@ class AgentAssertionFactory { /** @var AgentAssertion $assertion */ $assertion = new AgentAssertion(); $assertion->setAgentService($agentService); $assertion->setAgentAutoriteService($agentAutoriteService); $assertion->setAgentSuperieurService($agentSuperieurService); $assertion->setAgentAffectationService($agentAffectationService); $assertion->setStructureService($structureService); $assertion->setUserService($userService); Loading module/Application/src/Application/Controller/IndexController.php +22 −21 Changes for module/Application/src/Application/Controller/IndexController.php: 22 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -2,11 +2,15 @@ namespace Application\Controller; use Application\Entity\Db\AgentSuperieur; use Application\Provider\Role\RoleProvider as AppRoleProvider; use Application\Entity\Db\Agent; use Application\Provider\Template\TexteTemplate; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait; use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait; use Application\Service\FichePoste\FichePosteServiceAwareTrait; use EntretienProfessionnel\Entity\Db\Campagne; use EntretienProfessionnel\Service\Campagne\CampagneServiceAwareTrait; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceAwareTrait; use Formation\Service\DemandeExterne\DemandeExterneServiceAwareTrait; Loading @@ -25,6 +29,8 @@ use Laminas\View\Model\ViewModel; class IndexController extends AbstractActionController { use AgentServiceAwareTrait; use AgentAutoriteServiceAwareTrait; use AgentSuperieurServiceAwareTrait; use CampagneServiceAwareTrait; use RenduServiceAwareTrait; use RoleServiceAwareTrait; Loading Loading @@ -106,32 +112,27 @@ class IndexController extends AbstractActionController public function indexSuperieurAction() : ViewModel { $user = $this->getUserService()->getConnectedUser(); $complements = $this->getAgentService()->getSuperieurByUser($user); $agents = []; if ($complements) { foreach ($complements as $complement) { $agent = $this->getAgentService()->getAgent($complement->getAttachmentId()); if ($agent !== null) $agents[$agent->getId()] = $agent; $agent = $this->getAgentService()->getAgentByUser($user); $agents = array_map(function (AgentSuperieur $a) { return $a->getAgent(); },$this->getAgentSuperieurService()->getAgentsSuperieursBySuperieur($agent)); usort($agents, function (Agent $a, Agent $b) { return $a->getNomUsuel()." ".$a->getPrenom() > $b->getNomUsuel()." ".$b->getPrenom();}); /** Campagne d'entretien professionnel ************************************************************************/ $last = $this->getCampagneService()->getLastCampagne(); $campagnes = $this->getCampagneService()->getCampagnesActives(); $campagnes[] = $last; usort($campagnes, function (Campagne $a, Campagne $b) { return $a->getDateDebut() > $b->getDateDebut();}); /** récuperation des eps **************************************************************************************/ $entretiens = []; foreach ($campagnes as $campagne) { $entretiens[$campagne->getId()] = $this->getEntretienProfessionnelService()->getEntretienProfessionnelByCampagneAndAgents($campagne, $agents); } } $fiches = []; // $fichesRAW = $this->getFichePosteService()->getFichesPostesbyAgents($agents); // foreach ($fichesRAW as $fiche) { // $fiches[$fiche->getAgent()->getId()][] = $fiche; // } return new ViewModel([ 'agents' => $agents, 'connectedAgent' => $this->getAgentService()->getAgentByUser($user), 'campagnePrevious' => $this->getCampagneService()->getLastCampagne(), 'campagnesCurrents' => $this->getCampagneService()->getCampagnesActives(), 'fiches' => $fiches, 'demandesInternes' => $this->getFormationInstanceInscritService()->getInscrpitionsByAgentsAndAnnee($agents), 'demandesExternes' => $this->getDemandeExterneService()->getDemandesExternesByAgentsAndAnnee($agents), 'campagnes' => $campagnes, 'entretiens' => $entretiens, ]); } Loading module/Application/src/Application/Controller/IndexControllerFactory.php +10 Changes for module/Application/src/Application/Controller/IndexControllerFactory.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Service\Agent\AgentService; use Application\Service\AgentAutorite\AgentAutoriteService; use Application\Service\AgentSuperieur\AgentSuperieurService; use Application\Service\FichePoste\FichePosteService; use EntretienProfessionnel\Service\Campagne\CampagneService; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelService; Loading @@ -28,6 +30,9 @@ class IndexControllerFactory { public function __invoke(ContainerInterface $container) : IndexController { /** * @var AgentService $agentService * @var AgentAutoriteService $agentAutoriteService * @var AgentSuperieurService $agentSuperieurService * @var AgentService $agentService * @var CampagneService $campagneService * @var RenduService $renduService Loading @@ -43,6 +48,8 @@ class IndexControllerFactory { * */ $agentService = $container->get(AgentService::class); $agentAutoriteService = $container->get(AgentAutoriteService::class); $agentSuperieurService = $container->get(AgentSuperieurService::class); $campagneService = $container->get(CampagneService::class); $renduService = $container->get(RenduService::class); $roleService = $container->get(RoleService::class); Loading @@ -58,6 +65,9 @@ class IndexControllerFactory { /** @var IndexController $controller */ $controller = new IndexController(); $controller->setAgentService($agentService); $controller->setAgentAutoriteService($agentAutoriteService); $controller->setAgentSuperieurService($agentSuperieurService); $controller->setAgentService($agentService); $controller->setCampagneService($campagneService); $controller->setRenduService($renduService); $controller->setRoleService($roleService); Loading module/Application/src/Application/Service/AgentAutorite/AgentAutoriteService.php +12 Changes for module/Application/src/Application/Service/AgentAutorite/AgentAutoriteService.php: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -201,4 +201,16 @@ class AgentAutoriteService } return $users; } public function isAutorite(Agent $agent, Agent $autorite) : bool { $qb = $this->createQueryBuilder() ->andWhere('agentsuperieur.agent = :agent')->setParameter('agent',$agent) ->andWhere('agentsuperieur.autorite = :autorite')->setParameter('autorite', $autorite) ->andWhere('agentsuperieur.histoDestruction IS NULL') ; $result = $qb->getQuery()->getResult(); return !empty($result); } } No newline at end of file Loading
module/Application/src/Application/Assertion/AgentAssertion.php +6 −14 Changes for module/Application/src/Application/Assertion/AgentAssertion.php: 6 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ use Application\Provider\Privilege\AgentPrivileges; use Application\Provider\Role\RoleProvider as AppRoleProvider; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\AgentAffectation\AgentAffectationServiceAwareTrait; use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait; use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait; use Structure\Provider\Role\RoleProvider as StructureRoleProvider; use Structure\Service\Structure\StructureServiceAwareTrait; use UnicaenPrivilege\Assertion\AbstractAssertion; Loading @@ -17,6 +19,8 @@ use Laminas\Permissions\Acl\Resource\ResourceInterface; class AgentAssertion extends AbstractAssertion { use AgentServiceAwareTrait; use AgentAutoriteServiceAwareTrait; use AgentSuperieurServiceAwareTrait; use AgentAffectationServiceAwareTrait; use StructureServiceAwareTrait; use UserServiceAwareTrait; Loading @@ -42,13 +46,11 @@ class AgentAssertion extends AbstractAssertion } $isResponsable = false; $isGestionnaire = false; $isSuperieur = false; $isAutorite = false; if ($role->getRoleId() === StructureRoleProvider::RESPONSABLE) $isResponsable = $this->getStructureService()->isResponsableS($structures, $agent); if ($role->getRoleId() === StructureRoleProvider::GESTIONNAIRE) $isGestionnaire = $this->getStructureService()->isGestionnaireS($structures, $agent); if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $entity->hasSuperieurHierarchique($agent); if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $entity->hasAutoriteHierarchique($agent); if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $this->getAgentSuperieurService()->isSuperieur($entity,$agent); if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $this->getAgentAutoriteService()->isAutorite($entity,$agent); switch ($privilege) { case AgentPrivileges::AGENT_AFFICHER : Loading @@ -59,8 +61,6 @@ class AgentAssertion extends AbstractAssertion return true; case StructureRoleProvider::RESPONSABLE: return $isResponsable; case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case Agent::ROLE_SUPERIEURE: return $isSuperieur; case Agent::ROLE_AUTORITE: Loading @@ -81,8 +81,6 @@ class AgentAssertion extends AbstractAssertion return true; // case RoleConstant::PERSONNEL: // return ($entity->getUtilisateur() === $user) AND $entity->hasEntretienEnCours(); case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case StructureRoleProvider::RESPONSABLE: return $isResponsable; case Agent::ROLE_SUPERIEURE; Loading @@ -104,8 +102,6 @@ class AgentAssertion extends AbstractAssertion case AppRoleProvider::ADMIN_FONC: case AppRoleProvider::ADMIN_TECH: return true; case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case StructureRoleProvider::RESPONSABLE: return $isResponsable; } Loading Loading @@ -141,11 +137,9 @@ class AgentAssertion extends AbstractAssertion } $isResponsable = false; $isGestionnaire = false; $isSuperieur = false; $isAutorite = false; if ($role->getRoleId() === StructureRoleProvider::RESPONSABLE) $isResponsable = $this->getStructureService()->isResponsableS($structures, $agent); if ($role->getRoleId() === StructureRoleProvider::GESTIONNAIRE) $isGestionnaire = $this->getStructureService()->isGestionnaireS($structures, $agent); if ($role->getRoleId() === Agent::ROLE_SUPERIEURE) $isSuperieur = $entity->hasSuperieurHierarchique($agent); if ($role->getRoleId() === Agent::ROLE_AUTORITE) $isAutorite = $entity->hasAutoriteHierarchique($agent); Loading @@ -159,8 +153,6 @@ class AgentAssertion extends AbstractAssertion return true; case StructureRoleProvider::RESPONSABLE: return $isResponsable; case StructureRoleProvider::GESTIONNAIRE: return $isGestionnaire; case Agent::ROLE_SUPERIEURE: return $isSuperieur; case Agent::ROLE_AUTORITE: Loading
module/Application/src/Application/Assertion/AgentAssertionFactory.php +8 Changes for module/Application/src/Application/Assertion/AgentAssertionFactory.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ namespace Application\Assertion; use Application\Service\Agent\AgentService; use Application\Service\AgentAffectation\AgentAffectationService; use Application\Service\AgentAutorite\AgentAutoriteService; use Application\Service\AgentSuperieur\AgentSuperieurService; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; Loading @@ -23,11 +25,15 @@ class AgentAssertionFactory { { /** * @var AgentService $agentService * @var AgentAutoriteService $agentAutoriteService * @var AgentSuperieurService $agentSuperieurService * @var AgentAffectationService $agentAffectationService * @var StructureService $structureService * @var UserService $userService */ $agentService = $container->get(AgentService::class); $agentAutoriteService = $container->get(AgentAutoriteService::class); $agentSuperieurService = $container->get(AgentSuperieurService::class); $agentAffectationService = $container->get(AgentAffectationService::class); $structureService = $container->get(StructureService::class); $userService = $container->get(UserService::class); Loading @@ -35,6 +41,8 @@ class AgentAssertionFactory { /** @var AgentAssertion $assertion */ $assertion = new AgentAssertion(); $assertion->setAgentService($agentService); $assertion->setAgentAutoriteService($agentAutoriteService); $assertion->setAgentSuperieurService($agentSuperieurService); $assertion->setAgentAffectationService($agentAffectationService); $assertion->setStructureService($structureService); $assertion->setUserService($userService); Loading
module/Application/src/Application/Controller/IndexController.php +22 −21 Changes for module/Application/src/Application/Controller/IndexController.php: 22 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -2,11 +2,15 @@ namespace Application\Controller; use Application\Entity\Db\AgentSuperieur; use Application\Provider\Role\RoleProvider as AppRoleProvider; use Application\Entity\Db\Agent; use Application\Provider\Template\TexteTemplate; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait; use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait; use Application\Service\FichePoste\FichePosteServiceAwareTrait; use EntretienProfessionnel\Entity\Db\Campagne; use EntretienProfessionnel\Service\Campagne\CampagneServiceAwareTrait; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceAwareTrait; use Formation\Service\DemandeExterne\DemandeExterneServiceAwareTrait; Loading @@ -25,6 +29,8 @@ use Laminas\View\Model\ViewModel; class IndexController extends AbstractActionController { use AgentServiceAwareTrait; use AgentAutoriteServiceAwareTrait; use AgentSuperieurServiceAwareTrait; use CampagneServiceAwareTrait; use RenduServiceAwareTrait; use RoleServiceAwareTrait; Loading Loading @@ -106,32 +112,27 @@ class IndexController extends AbstractActionController public function indexSuperieurAction() : ViewModel { $user = $this->getUserService()->getConnectedUser(); $complements = $this->getAgentService()->getSuperieurByUser($user); $agents = []; if ($complements) { foreach ($complements as $complement) { $agent = $this->getAgentService()->getAgent($complement->getAttachmentId()); if ($agent !== null) $agents[$agent->getId()] = $agent; $agent = $this->getAgentService()->getAgentByUser($user); $agents = array_map(function (AgentSuperieur $a) { return $a->getAgent(); },$this->getAgentSuperieurService()->getAgentsSuperieursBySuperieur($agent)); usort($agents, function (Agent $a, Agent $b) { return $a->getNomUsuel()." ".$a->getPrenom() > $b->getNomUsuel()." ".$b->getPrenom();}); /** Campagne d'entretien professionnel ************************************************************************/ $last = $this->getCampagneService()->getLastCampagne(); $campagnes = $this->getCampagneService()->getCampagnesActives(); $campagnes[] = $last; usort($campagnes, function (Campagne $a, Campagne $b) { return $a->getDateDebut() > $b->getDateDebut();}); /** récuperation des eps **************************************************************************************/ $entretiens = []; foreach ($campagnes as $campagne) { $entretiens[$campagne->getId()] = $this->getEntretienProfessionnelService()->getEntretienProfessionnelByCampagneAndAgents($campagne, $agents); } } $fiches = []; // $fichesRAW = $this->getFichePosteService()->getFichesPostesbyAgents($agents); // foreach ($fichesRAW as $fiche) { // $fiches[$fiche->getAgent()->getId()][] = $fiche; // } return new ViewModel([ 'agents' => $agents, 'connectedAgent' => $this->getAgentService()->getAgentByUser($user), 'campagnePrevious' => $this->getCampagneService()->getLastCampagne(), 'campagnesCurrents' => $this->getCampagneService()->getCampagnesActives(), 'fiches' => $fiches, 'demandesInternes' => $this->getFormationInstanceInscritService()->getInscrpitionsByAgentsAndAnnee($agents), 'demandesExternes' => $this->getDemandeExterneService()->getDemandesExternesByAgentsAndAnnee($agents), 'campagnes' => $campagnes, 'entretiens' => $entretiens, ]); } Loading
module/Application/src/Application/Controller/IndexControllerFactory.php +10 Changes for module/Application/src/Application/Controller/IndexControllerFactory.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Service\Agent\AgentService; use Application\Service\AgentAutorite\AgentAutoriteService; use Application\Service\AgentSuperieur\AgentSuperieurService; use Application\Service\FichePoste\FichePosteService; use EntretienProfessionnel\Service\Campagne\CampagneService; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelService; Loading @@ -28,6 +30,9 @@ class IndexControllerFactory { public function __invoke(ContainerInterface $container) : IndexController { /** * @var AgentService $agentService * @var AgentAutoriteService $agentAutoriteService * @var AgentSuperieurService $agentSuperieurService * @var AgentService $agentService * @var CampagneService $campagneService * @var RenduService $renduService Loading @@ -43,6 +48,8 @@ class IndexControllerFactory { * */ $agentService = $container->get(AgentService::class); $agentAutoriteService = $container->get(AgentAutoriteService::class); $agentSuperieurService = $container->get(AgentSuperieurService::class); $campagneService = $container->get(CampagneService::class); $renduService = $container->get(RenduService::class); $roleService = $container->get(RoleService::class); Loading @@ -58,6 +65,9 @@ class IndexControllerFactory { /** @var IndexController $controller */ $controller = new IndexController(); $controller->setAgentService($agentService); $controller->setAgentAutoriteService($agentAutoriteService); $controller->setAgentSuperieurService($agentSuperieurService); $controller->setAgentService($agentService); $controller->setCampagneService($campagneService); $controller->setRenduService($renduService); $controller->setRoleService($roleService); Loading
module/Application/src/Application/Service/AgentAutorite/AgentAutoriteService.php +12 Changes for module/Application/src/Application/Service/AgentAutorite/AgentAutoriteService.php: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -201,4 +201,16 @@ class AgentAutoriteService } return $users; } public function isAutorite(Agent $agent, Agent $autorite) : bool { $qb = $this->createQueryBuilder() ->andWhere('agentsuperieur.agent = :agent')->setParameter('agent',$agent) ->andWhere('agentsuperieur.autorite = :autorite')->setParameter('autorite', $autorite) ->andWhere('agentsuperieur.histoDestruction IS NULL') ; $result = $qb->getQuery()->getResult(); return !empty($result); } } No newline at end of file