Commit 8cc58225 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Ménage dans la gestion des paramètres

parent df814462
Loading
Loading
Loading
Loading
Loading
+54 −39
Original line number Diff line number Diff line
@@ -26,6 +26,11 @@ return [
                    'route'         => '/:intervenant/agrement',
                    'controller'    => AgrementController::class,
                    'action'        => 'index',
                    'privileges' => [
                        Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                        Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                    ],
                    'assertion'  => AgrementAssertion::class,
                    'may_terminate' => true,
                    'child_routes'  => [
                        'conseil-academique' => [
@@ -34,6 +39,11 @@ return [
                            'defaults' => [
                                'typeAgrementCode' => TypeAgrement::CODE_CONSEIL_ACADEMIQUE,
                            ],
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'conseil-restreint'  => [
                            'route'    => '/conseil-restreint',
@@ -41,6 +51,11 @@ return [
                            'defaults' => [
                                'typeAgrementCode' => TypeAgrement::CODE_CONSEIL_RESTREINT,
                            ],
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'ajouter'            => [
                            'route'       => '/:typeAgrement/ajouter[/:structure]',
@@ -49,6 +64,13 @@ return [
                                'structure'    => '[0-9]*',
                            ],
                            'action'      => 'saisir',
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_EDITION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_EDITION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'voir'               => [
                            'route'       => '/voir/:agrement',
@@ -56,6 +78,11 @@ return [
                                'agrement' => '[0-9]*',
                            ],
                            'action'      => 'voir',
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'saisir'             => [
                            'route'       => '/saisir/[:agrement]',
@@ -63,6 +90,13 @@ return [
                                'agrement' => '[0-9]*',
                            ],
                            'action'      => 'saisir',
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_EDITION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_EDITION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'supprimer'          => [
                            'route'       => '/supprimer/[:agrement]',
@@ -70,6 +104,11 @@ return [
                                'agrement' => '[0-9]*',
                            ],
                            'action'      => 'supprimer',
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_SUPPRESSION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_SUPPRESSION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                    ],
                ],
@@ -89,6 +128,13 @@ return [
                            'defaults' => [
                                'typeAgrementCode' => TypeAgrement::CODE_CONSEIL_ACADEMIQUE,
                            ],
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_EDITION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_EDITION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'conseil-restreint'  => [
                            'route'    => '/conseil-restreint',
@@ -96,10 +142,18 @@ return [
                            'defaults' => [
                                'typeAgrementCode' => TypeAgrement::CODE_CONSEIL_RESTREINT,
                            ],
                            'privileges' => [
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_EDITION,
                                Privileges::AGREMENT_CONSEIL_RESTREINT_EDITION,
                            ],
                            'assertion'  => AgrementAssertion::class,
                        ],
                        'export-csv'         => [
                            'route'  => '/export-csv',
                            'action' => 'export-csv',
                            'privileges' => Privileges::AGREMENT_EXPORT_CSV,
                        ],
                    ],
                ],
@@ -160,45 +214,6 @@ return [

    ],

    'guards' => [
        [
            'controller' => AgrementController::class,
            'action'     => ['index', 'lister', 'voir'],
            'privileges' => [
                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
            ],
            'assertion'  => AgrementAssertion::class,
        ],
        [
            'controller' => AgrementController::class,
            'action'     => ['ajouter', 'saisir-lot', 'saisir'],
            'privileges' => [
                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_VISUALISATION,
                Privileges::AGREMENT_CONSEIL_RESTREINT_VISUALISATION,
                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_EDITION,
                Privileges::AGREMENT_CONSEIL_RESTREINT_EDITION,
            ],
            'assertion'  => AgrementAssertion::class,
        ],
        [
            'controller' => AgrementController::class,
            'action'     => ['export-csv'],
            'privileges' => [
                Privileges::AGREMENT_EXPORT_CSV,
            ],
        ],
        [
            'controller' => AgrementController::class,
            'action'     => ['supprimer'],
            'privileges' => [
                Privileges::AGREMENT_CONSEIL_ACADEMIQUE_SUPPRESSION,
                Privileges::AGREMENT_CONSEIL_RESTREINT_SUPPRESSION,
            ],
            'assertion'  => AgrementAssertion::class,
        ],
    ],

    'rules' => [
        [
            'privileges' => [
+2 −6
Original line number Diff line number Diff line
@@ -31,10 +31,6 @@ class AgrementAssertion extends AbstractAssertion

    protected function assertEntity(?ResourceInterface $entity = null, $privilege = null): bool
    {
        // pareil si le rôle ne possède pas le privilège adéquat
        if ($privilege && !$this->authorize->isAllowedPrivilege($privilege)) return false;

        // Si c'est bon alors on affine...
        switch (true) {
            case $entity instanceof TblAgrement:
                switch ($privilege) {
@@ -76,9 +72,9 @@ class AgrementAssertion extends AbstractAssertion
    protected function assertController(string $controller, ?string $action): bool
    {
        /* @var $intervenant Intervenant */
        $intervenant = $this->getParam('intervenant');
        $intervenant = $this->getParam(Intervenant::class);

        $typeAgrement = $this->getParam('typeAgrement');
        $typeAgrement = $this->getParam(TypeAgrement::class);
        if (!$typeAgrement){
            $typeAgrementCode = $this->getParam('typeAgrementCode');
            if ($typeAgrementCode) {
+1 −5
Original line number Diff line number Diff line
@@ -138,11 +138,7 @@ $config = [
            Controller\IndexController::class => Controller\Factory\IndexControllerFactory::class,
        ],
    ],
    'controller_plugins' => [
        'factories' => [
            'context' => Controller\Plugin\ContextFactory::class,
        ],
    ],

    'view_manager'       => [
        'template_path_stack' => [
            __DIR__ . '/../view',
+1 −9
Original line number Diff line number Diff line
@@ -2,9 +2,7 @@

namespace Application;


use Application\Provider\Privileges;
use Application\Service\PeriodeService;

return [
    'router' => [
@@ -18,6 +16,7 @@ return [
                        'action'     => 'index',
                    ],
                ],

                'may_terminate' => true,
                'child_routes'  => [
                    'saisie'    => [
@@ -86,7 +85,6 @@ return [
        ],
    ],


    'guards'          => [
        [
            'controller' => Controller\PeriodeController::class,
@@ -100,17 +98,11 @@ return [
        ],
    ],


    'controllers'     => [
        'factories' => [
            Controller\PeriodeController::class => Controller\Factory\PeriodeControllerFactory::class,
        ],
    ],
    'service_manager' => [
        'invokables' => [
            PeriodeService::class => PeriodeService::class,
        ],
    ],

    'form_elements' => [
        'factories' => [
+2 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Application\Controller;

use Administration\Service\ParametresServiceAwareTrait;
use Application\Entity\Db\Annee;
use Application\Provider\Privileges;
use Application\Service\Traits\AnneeServiceAwareTrait;
use Application\Service\Traits\ContextServiceAwareTrait;
@@ -66,7 +67,7 @@ class IndexController extends AbstractController
    public function changementAnneeAction()
    {
        /* Prise en compte du changement d'année!! */
        $annee = $this->params()->fromRoute('annee');
        $annee = $this->params()->fromRoute(Annee::class);
        if ($annee) {
            $annee = $this->getServiceAnnee()->get($annee);
            $this->getServiceContext()->setAnnee($annee);
Loading