Loading code/test3.php +2 −2 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ $sa = $container->get(\Framework\Authorize\Authorize::class); //$a = $sa->isAllowedController(\Application\Controller\IndexController::class, 'index'); $a = $container->get(\Framework\Navigation\Navigation::class)->home->getPage('intervenant')->getPage('validation-referentiel-prevu'); $a = $sa->isAllowedController(\Application\Controller\PeriodeController::class, 'index'); $a = $a->isVisible(); dump($a); module/Administration/config/gestion.config.php +0 −5 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace Administration; use Application\Provider\Privileges; use Framework\Authorize\AssertionFactory; use Framework\Authorize\Authorize; return [ Loading Loading @@ -41,8 +40,4 @@ return [ 'controllers' => [ Controller\GestionController::class => Controller\GestionControllerFactory::class, ], 'services' => [ Assertion\GestionAssertion::class => AssertionFactory::class, ], ]; No newline at end of file module/Administration/src/Assertion/GestionAssertion.php +1 −5 Original line number Diff line number Diff line Loading @@ -16,12 +16,8 @@ class GestionAssertion extends AbstractAssertion use ContextServiceAwareTrait; protected function assertController($controller, $action = null, $privilege = null): bool protected function assertController(string $controller, ?string $action): bool { if ($privilege && !$this->authorize->isAllowedPrivilege($privilege)) { return false; } if ($this->getServiceContext()->getIntervenant()) { return false; } Loading module/Agrement/config/module.config.php +0 −3 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ use Agrement\Service\TypeAgrementService; use Agrement\Service\TypeAgrementServiceFactory; use Agrement\View\Helper\AgrementVewHelperFactory; use Application\Provider\Privileges; use Framework\Authorize\AssertionFactory; use Framework\Authorize\Authorize; Loading Loading @@ -240,8 +239,6 @@ return [ AgrementService::class => AgrementServiceFactory::class, TblAgrementService::class => TblAgrementServiceFactory::class, TypeAgrementService::class => TypeAgrementServiceFactory::class, AgrementAssertion::class => AssertionFactory::class, ], 'view_helpers' => [ 'agrement' => AgrementVewHelperFactory::class, Loading module/Agrement/src/Assertion/AgrementAssertion.php +4 −12 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Application\Provider\Privileges; use Application\Service\Traits\ContextServiceAwareTrait; use Contrat\Service\TblContratServiceAwareTrait; use Framework\Authorize\AbstractAssertion; use Framework\Navigation\Page; use Intervenant\Entity\Db\Intervenant; use Laminas\Permissions\Acl\Resource\ResourceInterface; use Lieu\Entity\Db\Structure; Loading @@ -27,13 +28,6 @@ class AgrementAssertion extends AbstractAssertion use WorkflowServiceAwareTrait; use ContextServiceAwareTrait; /* ---- Routage général ---- */ public function __invoke(array $page) // gestion des visibilités de menus { return $this->assertPage($page); } protected function assertEntity(?ResourceInterface $entity = null, $privilege = null): bool { Loading Loading @@ -79,16 +73,13 @@ class AgrementAssertion extends AbstractAssertion protected function assertController($controller, $action = null, $privilege = null): bool protected function assertController(string $controller, ?string $action): bool { $intervenant = $this->getMvcEvent()->getParam('intervenant'); /* @var $intervenant Intervenant */ $typeAgrement = $this->getMvcEvent()->getParam('typeAgrement'); /* @var $typeAgrement TypeAgrement */ // pareil si le rôle ne possède pas le privilège adéquat if ($privilege && !$this->authorize->isAllowedPrivilege($privilege)) return false; switch ($action) { case 'lister': case 'voir': Loading Loading @@ -132,8 +123,9 @@ class AgrementAssertion extends AbstractAssertion protected function assertPage(array $page): bool protected function assertPage(Page $page): bool { $page = $page->getData(); $intervenant = $this->getMvcEvent()->getParam('intervenant'); if ($this->getServiceContext()->getIntervenant() && str_starts_with($page['route'], 'gestion/')) { Loading Loading
code/test3.php +2 −2 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ $sa = $container->get(\Framework\Authorize\Authorize::class); //$a = $sa->isAllowedController(\Application\Controller\IndexController::class, 'index'); $a = $container->get(\Framework\Navigation\Navigation::class)->home->getPage('intervenant')->getPage('validation-referentiel-prevu'); $a = $sa->isAllowedController(\Application\Controller\PeriodeController::class, 'index'); $a = $a->isVisible(); dump($a);
module/Administration/config/gestion.config.php +0 −5 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace Administration; use Application\Provider\Privileges; use Framework\Authorize\AssertionFactory; use Framework\Authorize\Authorize; return [ Loading Loading @@ -41,8 +40,4 @@ return [ 'controllers' => [ Controller\GestionController::class => Controller\GestionControllerFactory::class, ], 'services' => [ Assertion\GestionAssertion::class => AssertionFactory::class, ], ]; No newline at end of file
module/Administration/src/Assertion/GestionAssertion.php +1 −5 Original line number Diff line number Diff line Loading @@ -16,12 +16,8 @@ class GestionAssertion extends AbstractAssertion use ContextServiceAwareTrait; protected function assertController($controller, $action = null, $privilege = null): bool protected function assertController(string $controller, ?string $action): bool { if ($privilege && !$this->authorize->isAllowedPrivilege($privilege)) { return false; } if ($this->getServiceContext()->getIntervenant()) { return false; } Loading
module/Agrement/config/module.config.php +0 −3 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ use Agrement\Service\TypeAgrementService; use Agrement\Service\TypeAgrementServiceFactory; use Agrement\View\Helper\AgrementVewHelperFactory; use Application\Provider\Privileges; use Framework\Authorize\AssertionFactory; use Framework\Authorize\Authorize; Loading Loading @@ -240,8 +239,6 @@ return [ AgrementService::class => AgrementServiceFactory::class, TblAgrementService::class => TblAgrementServiceFactory::class, TypeAgrementService::class => TypeAgrementServiceFactory::class, AgrementAssertion::class => AssertionFactory::class, ], 'view_helpers' => [ 'agrement' => AgrementVewHelperFactory::class, Loading
module/Agrement/src/Assertion/AgrementAssertion.php +4 −12 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Application\Provider\Privileges; use Application\Service\Traits\ContextServiceAwareTrait; use Contrat\Service\TblContratServiceAwareTrait; use Framework\Authorize\AbstractAssertion; use Framework\Navigation\Page; use Intervenant\Entity\Db\Intervenant; use Laminas\Permissions\Acl\Resource\ResourceInterface; use Lieu\Entity\Db\Structure; Loading @@ -27,13 +28,6 @@ class AgrementAssertion extends AbstractAssertion use WorkflowServiceAwareTrait; use ContextServiceAwareTrait; /* ---- Routage général ---- */ public function __invoke(array $page) // gestion des visibilités de menus { return $this->assertPage($page); } protected function assertEntity(?ResourceInterface $entity = null, $privilege = null): bool { Loading Loading @@ -79,16 +73,13 @@ class AgrementAssertion extends AbstractAssertion protected function assertController($controller, $action = null, $privilege = null): bool protected function assertController(string $controller, ?string $action): bool { $intervenant = $this->getMvcEvent()->getParam('intervenant'); /* @var $intervenant Intervenant */ $typeAgrement = $this->getMvcEvent()->getParam('typeAgrement'); /* @var $typeAgrement TypeAgrement */ // pareil si le rôle ne possède pas le privilège adéquat if ($privilege && !$this->authorize->isAllowedPrivilege($privilege)) return false; switch ($action) { case 'lister': case 'voir': Loading Loading @@ -132,8 +123,9 @@ class AgrementAssertion extends AbstractAssertion protected function assertPage(array $page): bool protected function assertPage(Page $page): bool { $page = $page->getData(); $intervenant = $this->getMvcEvent()->getParam('intervenant'); if ($this->getServiceContext()->getIntervenant() && str_starts_with($page['route'], 'gestion/')) { Loading