Loading module/Application/config/merged/structure.config.php +26 −0 Changes for module/Application/config/merged/structure.config.php: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -82,6 +82,8 @@ return [ 'action' => [ 'ajouter-gestionnaire', 'retirer-gestionnaire', 'ajouter-responsable', 'retirer-responsable', ], 'privileges' => StructurePrivileges::STRUCTURE_GESTIONNAIRE, 'assertion' => StructureAssertion::class, Loading Loading @@ -172,6 +174,30 @@ return [ 'may_terminate' => true, 'child_routes' => [], ], 'ajouter-responsable' => [ 'type' => Segment::class, 'options' => [ 'route' => '/ajouter-responsable/:structure', 'defaults' => [ 'controller' => StructureController::class, 'action' => 'ajouter-responsable', ], ], 'may_terminate' => true, 'child_routes' => [], ], 'retirer-responsable' => [ 'type' => Segment::class, 'options' => [ 'route' => '/retirer-responsable/:structure/:responsable', 'defaults' => [ 'controller' => StructureController::class, 'action' => 'retirer-responsable', ], ], 'may_terminate' => true, 'child_routes' => [], ], 'editer-description' => [ 'type' => Segment::class, 'options' => [ Loading module/Application/src/Application/Assertion/AgentAssertion.php +17 −0 Changes for module/Application/src/Application/Assertion/AgentAssertion.php: 17 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,17 @@ class AgentAssertion extends AbstractAssertion { if ($isGestionnaire) break; } } $isResponsable = false; if ($role->getRoleId === RoleConstant::RESPONSABLE) { $structures = []; foreach ($entity->getGrades() as $grade) { $structures[] = $grade->getStructure(); } foreach ($structures as $structure) { $isResponsable = $this->getStructureService()->isResponsable($structure, $user); if ($isResponsable) break; } } switch($privilege) { case AgentPrivileges::AGENT_ELEMENT_VOIR: Loading @@ -48,6 +59,8 @@ class AgentAssertion extends AbstractAssertion { return ($entity->getUtilisateur() === $user); case RoleConstant::GESTIONNAIRE: return $isGestionnaire; case RoleConstant::RESPONSABLE: return $isResponsable; } return false; case AgentPrivileges::AGENT_ELEMENT_AJOUTER: Loading @@ -61,6 +74,8 @@ class AgentAssertion extends AbstractAssertion { return ($entity->getUtilisateur() === $user) AND $entity->hasEntretienEnCours(); case RoleConstant::GESTIONNAIRE: return $isGestionnaire; case RoleConstant::RESPONSABLE: return $isResponsable; } return false; case AgentPrivileges::AGENT_ELEMENT_DETRUIRE: Loading @@ -78,6 +93,8 @@ class AgentAssertion extends AbstractAssertion { return true; case RoleConstant::GESTIONNAIRE: return $isGestionnaire; case RoleConstant::RESPONSABLE: return $isResponsable; } return false; } Loading module/Application/src/Application/Assertion/EntretienProfessionnelAssertion.php +16 −0 Changes for module/Application/src/Application/Assertion/EntretienProfessionnelAssertion.php: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Entity\Db\Agent; use Application\Entity\Db\EntretienProfessionnel; use Application\Provider\Privilege\AgentPrivileges; use Application\Provider\Privilege\EntretienproPrivileges; use Application\Service\Structure\StructureServiceAwareTrait; use UnicaenAuthentification\Assertion\AbstractAssertion; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use Zend\Permissions\Acl\Resource\ResourceInterface; Loading @@ -14,6 +15,7 @@ use Zend\Permissions\Acl\Resource\ResourceInterface; class EntretienProfessionnelAssertion extends AbstractAssertion { use UserServiceAwareTrait; use StructureServiceAwareTrait; protected function assertEntity(ResourceInterface $entity = null, $privilege = null) { Loading @@ -25,6 +27,18 @@ class EntretienProfessionnelAssertion extends AbstractAssertion { $user = $this->getUserService()->getConnectedUser(); $role = $this->getUserService()->getConnectedRole(); $isResponsable = false; if ($role->getRoleId === RoleConstant::RESPONSABLE) { $structures = []; foreach ($entity->getGrades() as $grade) { $structures[] = $grade->getStructure(); } foreach ($structures as $structure) { $isResponsable = $this->getStructureService()->isResponsable($structure, $user); if ($isResponsable) break; } } switch($privilege) { case EntretienproPrivileges::ENTRETIENPRO_VALIDER_AGENT : switch ($role->getRoleId()) { Loading Loading @@ -52,6 +66,8 @@ class EntretienProfessionnelAssertion extends AbstractAssertion { case RoleConstant::ADMIN_TECH: case RoleConstant::DRH: return true; case RoleConstant::RESPONSABLE: return $isResponsable; default: return false; } Loading module/Application/src/Application/Assertion/EntretienProfessionnelAssertionFactory.php +4 −0 Changes for module/Application/src/Application/Assertion/EntretienProfessionnelAssertionFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Application\Assertion; use Application\Service\Structure\StructureService; use Interop\Container\ContainerInterface; use UnicaenUtilisateur\Service\User\UserService; Loading @@ -14,12 +15,15 @@ class EntretienProfessionnelAssertionFactory { public function __invoke(ContainerInterface $container) { /** * @var StructureService $structureService * @var UserService $userService */ $structureService = $container->get(StructureService::class); $userService = $container->get(UserService::class); /** @var EntretienProfessionnelAssertion $assertion */ $assertion = new EntretienProfessionnelAssertion(); $assertion->setStructureService($structureService); $assertion->setUserService($userService); return $assertion; Loading module/Application/src/Application/Assertion/FichePosteAssertion.php +3 −1 Changes for module/Application/src/Application/Assertion/FichePosteAssertion.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class FichePosteAssertion extends AbstractAssertion { $role = $this->getUserService()->getConnectedRole(); $isGestionnaire = false; if ($role->getRoleId() === RoleConstant::GESTIONNAIRE) { if ($role->getRoleId() === RoleConstant::GESTIONNAIRE || $role->getRoleId() === RoleConstant::RESPONSABLE) { $isGestionnaire = $this->getFichePosteService()->isGererPar($entity, $user); } Loading @@ -39,6 +39,7 @@ class FichePosteAssertion extends AbstractAssertion { case RoleConstant::OBSERVATEUR: return true; case RoleConstant::GESTIONNAIRE: case RoleConstant::RESPONSABLE: return $isGestionnaire; case RoleConstant::RESPONSABLE_EPRO: //TODO return false; Loading @@ -55,6 +56,7 @@ class FichePosteAssertion extends AbstractAssertion { case RoleConstant::ADMIN_TECH: return true; case RoleConstant::GESTIONNAIRE: case RoleConstant::RESPONSABLE: return $isGestionnaire; default: return false; Loading Loading
module/Application/config/merged/structure.config.php +26 −0 Changes for module/Application/config/merged/structure.config.php: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -82,6 +82,8 @@ return [ 'action' => [ 'ajouter-gestionnaire', 'retirer-gestionnaire', 'ajouter-responsable', 'retirer-responsable', ], 'privileges' => StructurePrivileges::STRUCTURE_GESTIONNAIRE, 'assertion' => StructureAssertion::class, Loading Loading @@ -172,6 +174,30 @@ return [ 'may_terminate' => true, 'child_routes' => [], ], 'ajouter-responsable' => [ 'type' => Segment::class, 'options' => [ 'route' => '/ajouter-responsable/:structure', 'defaults' => [ 'controller' => StructureController::class, 'action' => 'ajouter-responsable', ], ], 'may_terminate' => true, 'child_routes' => [], ], 'retirer-responsable' => [ 'type' => Segment::class, 'options' => [ 'route' => '/retirer-responsable/:structure/:responsable', 'defaults' => [ 'controller' => StructureController::class, 'action' => 'retirer-responsable', ], ], 'may_terminate' => true, 'child_routes' => [], ], 'editer-description' => [ 'type' => Segment::class, 'options' => [ Loading
module/Application/src/Application/Assertion/AgentAssertion.php +17 −0 Changes for module/Application/src/Application/Assertion/AgentAssertion.php: 17 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,17 @@ class AgentAssertion extends AbstractAssertion { if ($isGestionnaire) break; } } $isResponsable = false; if ($role->getRoleId === RoleConstant::RESPONSABLE) { $structures = []; foreach ($entity->getGrades() as $grade) { $structures[] = $grade->getStructure(); } foreach ($structures as $structure) { $isResponsable = $this->getStructureService()->isResponsable($structure, $user); if ($isResponsable) break; } } switch($privilege) { case AgentPrivileges::AGENT_ELEMENT_VOIR: Loading @@ -48,6 +59,8 @@ class AgentAssertion extends AbstractAssertion { return ($entity->getUtilisateur() === $user); case RoleConstant::GESTIONNAIRE: return $isGestionnaire; case RoleConstant::RESPONSABLE: return $isResponsable; } return false; case AgentPrivileges::AGENT_ELEMENT_AJOUTER: Loading @@ -61,6 +74,8 @@ class AgentAssertion extends AbstractAssertion { return ($entity->getUtilisateur() === $user) AND $entity->hasEntretienEnCours(); case RoleConstant::GESTIONNAIRE: return $isGestionnaire; case RoleConstant::RESPONSABLE: return $isResponsable; } return false; case AgentPrivileges::AGENT_ELEMENT_DETRUIRE: Loading @@ -78,6 +93,8 @@ class AgentAssertion extends AbstractAssertion { return true; case RoleConstant::GESTIONNAIRE: return $isGestionnaire; case RoleConstant::RESPONSABLE: return $isResponsable; } return false; } Loading
module/Application/src/Application/Assertion/EntretienProfessionnelAssertion.php +16 −0 Changes for module/Application/src/Application/Assertion/EntretienProfessionnelAssertion.php: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Entity\Db\Agent; use Application\Entity\Db\EntretienProfessionnel; use Application\Provider\Privilege\AgentPrivileges; use Application\Provider\Privilege\EntretienproPrivileges; use Application\Service\Structure\StructureServiceAwareTrait; use UnicaenAuthentification\Assertion\AbstractAssertion; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use Zend\Permissions\Acl\Resource\ResourceInterface; Loading @@ -14,6 +15,7 @@ use Zend\Permissions\Acl\Resource\ResourceInterface; class EntretienProfessionnelAssertion extends AbstractAssertion { use UserServiceAwareTrait; use StructureServiceAwareTrait; protected function assertEntity(ResourceInterface $entity = null, $privilege = null) { Loading @@ -25,6 +27,18 @@ class EntretienProfessionnelAssertion extends AbstractAssertion { $user = $this->getUserService()->getConnectedUser(); $role = $this->getUserService()->getConnectedRole(); $isResponsable = false; if ($role->getRoleId === RoleConstant::RESPONSABLE) { $structures = []; foreach ($entity->getGrades() as $grade) { $structures[] = $grade->getStructure(); } foreach ($structures as $structure) { $isResponsable = $this->getStructureService()->isResponsable($structure, $user); if ($isResponsable) break; } } switch($privilege) { case EntretienproPrivileges::ENTRETIENPRO_VALIDER_AGENT : switch ($role->getRoleId()) { Loading Loading @@ -52,6 +66,8 @@ class EntretienProfessionnelAssertion extends AbstractAssertion { case RoleConstant::ADMIN_TECH: case RoleConstant::DRH: return true; case RoleConstant::RESPONSABLE: return $isResponsable; default: return false; } Loading
module/Application/src/Application/Assertion/EntretienProfessionnelAssertionFactory.php +4 −0 Changes for module/Application/src/Application/Assertion/EntretienProfessionnelAssertionFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Application\Assertion; use Application\Service\Structure\StructureService; use Interop\Container\ContainerInterface; use UnicaenUtilisateur\Service\User\UserService; Loading @@ -14,12 +15,15 @@ class EntretienProfessionnelAssertionFactory { public function __invoke(ContainerInterface $container) { /** * @var StructureService $structureService * @var UserService $userService */ $structureService = $container->get(StructureService::class); $userService = $container->get(UserService::class); /** @var EntretienProfessionnelAssertion $assertion */ $assertion = new EntretienProfessionnelAssertion(); $assertion->setStructureService($structureService); $assertion->setUserService($userService); return $assertion; Loading
module/Application/src/Application/Assertion/FichePosteAssertion.php +3 −1 Changes for module/Application/src/Application/Assertion/FichePosteAssertion.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class FichePosteAssertion extends AbstractAssertion { $role = $this->getUserService()->getConnectedRole(); $isGestionnaire = false; if ($role->getRoleId() === RoleConstant::GESTIONNAIRE) { if ($role->getRoleId() === RoleConstant::GESTIONNAIRE || $role->getRoleId() === RoleConstant::RESPONSABLE) { $isGestionnaire = $this->getFichePosteService()->isGererPar($entity, $user); } Loading @@ -39,6 +39,7 @@ class FichePosteAssertion extends AbstractAssertion { case RoleConstant::OBSERVATEUR: return true; case RoleConstant::GESTIONNAIRE: case RoleConstant::RESPONSABLE: return $isGestionnaire; case RoleConstant::RESPONSABLE_EPRO: //TODO return false; Loading @@ -55,6 +56,7 @@ class FichePosteAssertion extends AbstractAssertion { case RoleConstant::ADMIN_TECH: return true; case RoleConstant::GESTIONNAIRE: case RoleConstant::RESPONSABLE: return $isGestionnaire; default: return false; Loading