Loading module/Application/config/utilisateur.config.php +3 −5 Original line number Diff line number Diff line <?php namespace Application; return [ 'console' => [ 'router' => [ Loading Loading @@ -29,11 +27,11 @@ return [ ], 'controllers' => [ 'factory' => [ 'UnicaenAuth\Controller\Utilisateur' => Controller\Factory\UtilisateurControllerFactory::class, 'factories' => [ 'UnicaenAuth\Controller\Utilisateur' => Application\Controller\Factory\UtilisateurControllerFactory::class, ], 'invokables' => [ 'Application\Controller\Utilisateur' => Controller\UtilisateurController::class, 'Application\Controller\Utilisateur' => Application\Controller\UtilisateurController::class, ], ], ]; No newline at end of file module/Application/src/Application/Controller/Factory/UtilisateurControllerFactory.php +2 −1 Original line number Diff line number Diff line <?php namespace Application\Controller; namespace Application\Controller\Factory; use Application\Controller\UtilisateurController; use Interop\Container\ContainerInterface; use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper; use UnicaenAuth\Options\ModuleOptions; Loading module/Application/src/Application/Provider/Role/RoleProvider.php +8 −7 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $intervenant = $this->getServiceContext()->getIntervenant(); $utilisateur = $this->getServiceContext()->getUtilisateur(); $structure = $this->getServiceContext()->getStructure(false); // chargement des rôles métiers Loading Loading @@ -144,8 +145,8 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $role->setPerimetre($dbRole->getPerimetre()); // 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); if ($dbRole->getPerimetre()->isEtablissement() && $structure) { $role->setStructure($structure); } $roles[$roleId] = $role; Loading @@ -153,17 +154,17 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $affectations = $dbRole->getAffectation(); foreach ($affectations as $affectation) { /* @var $affectation Affectation */ if ($structure = $affectation->getStructure()) { $affRoleId = $roleId . '-' . $structure->getSourceCode(); if ($affStructure = $affectation->getStructure()) { $affRoleId = $roleId . '-' . $affStructure->getSourceCode(); if (!isset($roles[$affRoleId]) && $dbRole->estNonHistorise()) { $affRoleLibelle = $dbRole->getLibelle() . ' (' . $structure->getLibelleCourt() . ')'; $affRoleLibelle = $dbRole->getLibelle() . ' (' . $affStructure->getLibelleCourt() . ')'; $affRole = new \Application\Acl\Role($affRoleId, $roleId, $affRoleLibelle); if (isset($rolesPrivileges[$roleId])) { $affRole->initPrivileges($rolesPrivileges[$roleId]); } $affRole->setDbRole($dbRole); $affRole->setPerimetre($dbRole->getPerimetre()); $affRole->setStructure($structure); $affRole->setStructure($affStructure); $roles[$affRoleId] = $affRole; } } Loading module/Application/src/Application/Provider/Role/RoleProviderFactory.php +1 −2 Original line number Diff line number Diff line Loading @@ -38,8 +38,7 @@ class RoleProviderFactory ->setEntityManager($em) ->setServiceStatutIntervenant($container->get(StatutIntervenantService::class)) ->setServiceContext($container->get(ContextService::class)) ->setPrivilegeProvider($container->get('UnicaenAuth\Privilege\PrivilegeProvider')) ->setStructureSelectionnee($this->getServiceContext()->getStructure(true)); ->setPrivilegeProvider($container->get('UnicaenAuth\Privilege\PrivilegeProvider')); return $roleProvider; } Loading module/Application/src/Application/Service/ContextService.php +13 −15 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class ContextService extends AbstractService /** * * @return RoleService * @return Role */ public function getSelectedIdentityRole() { Loading Loading @@ -398,23 +398,21 @@ class ContextService extends AbstractService * * @return Structure */ public function getStructure($initializing = false) public function getStructure($checkInRole = true) { if (!$this->structure) { $sc = $this->getSessionContainer(); if (!$sc->offsetExists('structure')) { if ($initializing) { $sc->structure = null; } else { if ($checkInRole) { $role = $this->getSelectedIdentityRole(); if ($role && $role->getStructure()) { $sc->structure = $role->getStructure()->getId(); } else { $sc->structure = null; return $role->getStructure(); } } if (!$this->structure) { $sc = $this->getSessionContainer(); $structureId = $sc->structure; if ($structureId) { $this->structure = $this->getServiceStructure()->get($structureId); } $this->structure = $this->getServiceStructure()->get($sc->structure); } return $this->structure; Loading Loading
module/Application/config/utilisateur.config.php +3 −5 Original line number Diff line number Diff line <?php namespace Application; return [ 'console' => [ 'router' => [ Loading Loading @@ -29,11 +27,11 @@ return [ ], 'controllers' => [ 'factory' => [ 'UnicaenAuth\Controller\Utilisateur' => Controller\Factory\UtilisateurControllerFactory::class, 'factories' => [ 'UnicaenAuth\Controller\Utilisateur' => Application\Controller\Factory\UtilisateurControllerFactory::class, ], 'invokables' => [ 'Application\Controller\Utilisateur' => Controller\UtilisateurController::class, 'Application\Controller\Utilisateur' => Application\Controller\UtilisateurController::class, ], ], ]; No newline at end of file
module/Application/src/Application/Controller/Factory/UtilisateurControllerFactory.php +2 −1 Original line number Diff line number Diff line <?php namespace Application\Controller; namespace Application\Controller\Factory; use Application\Controller\UtilisateurController; use Interop\Container\ContainerInterface; use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper; use UnicaenAuth\Options\ModuleOptions; Loading
module/Application/src/Application/Provider/Role/RoleProvider.php +8 −7 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $intervenant = $this->getServiceContext()->getIntervenant(); $utilisateur = $this->getServiceContext()->getUtilisateur(); $structure = $this->getServiceContext()->getStructure(false); // chargement des rôles métiers Loading Loading @@ -144,8 +145,8 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $role->setPerimetre($dbRole->getPerimetre()); // 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); if ($dbRole->getPerimetre()->isEtablissement() && $structure) { $role->setStructure($structure); } $roles[$roleId] = $role; Loading @@ -153,17 +154,17 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface $affectations = $dbRole->getAffectation(); foreach ($affectations as $affectation) { /* @var $affectation Affectation */ if ($structure = $affectation->getStructure()) { $affRoleId = $roleId . '-' . $structure->getSourceCode(); if ($affStructure = $affectation->getStructure()) { $affRoleId = $roleId . '-' . $affStructure->getSourceCode(); if (!isset($roles[$affRoleId]) && $dbRole->estNonHistorise()) { $affRoleLibelle = $dbRole->getLibelle() . ' (' . $structure->getLibelleCourt() . ')'; $affRoleLibelle = $dbRole->getLibelle() . ' (' . $affStructure->getLibelleCourt() . ')'; $affRole = new \Application\Acl\Role($affRoleId, $roleId, $affRoleLibelle); if (isset($rolesPrivileges[$roleId])) { $affRole->initPrivileges($rolesPrivileges[$roleId]); } $affRole->setDbRole($dbRole); $affRole->setPerimetre($dbRole->getPerimetre()); $affRole->setStructure($structure); $affRole->setStructure($affStructure); $roles[$affRoleId] = $affRole; } } Loading
module/Application/src/Application/Provider/Role/RoleProviderFactory.php +1 −2 Original line number Diff line number Diff line Loading @@ -38,8 +38,7 @@ class RoleProviderFactory ->setEntityManager($em) ->setServiceStatutIntervenant($container->get(StatutIntervenantService::class)) ->setServiceContext($container->get(ContextService::class)) ->setPrivilegeProvider($container->get('UnicaenAuth\Privilege\PrivilegeProvider')) ->setStructureSelectionnee($this->getServiceContext()->getStructure(true)); ->setPrivilegeProvider($container->get('UnicaenAuth\Privilege\PrivilegeProvider')); return $roleProvider; } Loading
module/Application/src/Application/Service/ContextService.php +13 −15 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class ContextService extends AbstractService /** * * @return RoleService * @return Role */ public function getSelectedIdentityRole() { Loading Loading @@ -398,23 +398,21 @@ class ContextService extends AbstractService * * @return Structure */ public function getStructure($initializing = false) public function getStructure($checkInRole = true) { if (!$this->structure) { $sc = $this->getSessionContainer(); if (!$sc->offsetExists('structure')) { if ($initializing) { $sc->structure = null; } else { if ($checkInRole) { $role = $this->getSelectedIdentityRole(); if ($role && $role->getStructure()) { $sc->structure = $role->getStructure()->getId(); } else { $sc->structure = null; return $role->getStructure(); } } if (!$this->structure) { $sc = $this->getSessionContainer(); $structureId = $sc->structure; if ($structureId) { $this->structure = $this->getServiceStructure()->get($structureId); } $this->structure = $this->getServiceStructure()->get($sc->structure); } return $this->structure; Loading