diff --git a/module/Application/src/Application/Entity/Db/Perimetre.php b/module/Application/src/Application/Entity/Db/Perimetre.php index 666805c102a5e29de4cf6c42a4d7a457f10495ea..a42582fd1dd50e54ba3d194c0e10e8e2cf957a78 100644 --- a/module/Application/src/Application/Entity/Db/Perimetre.php +++ b/module/Application/src/Application/Entity/Db/Perimetre.php @@ -7,6 +7,10 @@ namespace Application\Entity\Db; */ class Perimetre { + const COMPOSANTE = 'composante'; + const ETABLISSEMENT = 'etablissement'; + const DIPLOME = 'diplome'; + /** * @var string */ @@ -96,4 +100,19 @@ class Perimetre { return $this->getLibelle(); } + + public function isEtablissement() + { + return $this->getCode() === self::ETABLISSEMENT; + } + + public function isComposante() + { + return $this->getCode() === self::COMPOSANTE; + } + + public function isDiplome() + { + return $this->getCode() === self::DIPLOME; + } } diff --git a/module/Application/src/Application/Provider/Role/RoleProvider.php b/module/Application/src/Application/Provider/Role/RoleProvider.php index 632dfed9e39ccb8d16898b902d59c2cbc3bd8163..182e463672b402845f7a3769228f52e906771710 100644 --- a/module/Application/src/Application/Provider/Role/RoleProvider.php +++ b/module/Application/src/Application/Provider/Role/RoleProvider.php @@ -123,6 +123,11 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $role->setDbRole($dbRole); $role->setPersonnel($personnel); + // Si le rôle est de périmètre établissement, alors il se peut que l'on veuille zoomer sur une composante en particulier... + if ($this->structureSelectionnee && $dbRole->getPerimetre()->isEtablissement()){ + $role->setStructure( $this->structureSelectionnee ); + } + $roles[$roleId] = $role; $affectations = $dbRole->getAffectation(); @@ -137,6 +142,8 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $affRole->setStructure( $structure ); $roles[$affRoleId] = $affRole; } + }else{ + } } }