Commit f5498be6 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'CouvertureOrdreNom' of git.unicaen.fr:dsi/sygal into CouvertureOrdreNom

parents 85a6da8b 3358da45
Loading
Loading
Loading
Loading
+73
Changes for data/role.config.php: 73 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php
//
//
//use Application\Controller\Factory\RoleControllerFactory;
//use Application\Controller\RoleController;
//use UnicaenAuth\Guard\PrivilegeController;
//use Zend\Mvc\Router\Http\Literal;
//use Zend\Mvc\Router\Http\Segment;
//
//return [
//    'bjyauthorize'    => [
//        'guards' => [
//            RoleController::class => [
//                [
//                    'controller' => RoleController::class,
//                    'action'     => [
//                        'index',
//                    ],
//                    'roles' => [],
//                    //'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION,
//                ],
//            ],
//        ],
//    ],
//
//    'router' => [
//        'routes' => [
//            'role-affichage' => [
//                'type'          => Literal::class,
//                'options'       => [
//                    'route'    => '/role-affichage',
//                    'defaults' => [
//                        'controller'    => RoleController::class,
//                        'action'        => 'index',
//                    ],
//                ],
//                'may_terminate' => true,
//                'child_routes'  => [
//                ],
//            ],
//
//        ],
//    ],
//    'navigation'      => [
//        'default' => [
//            'home' => [
//                'pages' => [
//                    'admin' => [
//                        'pages' => [
//                        ],
//                    ],
//                ],
//            ],
//        ],
//    ],
//    'service_manager' => [
//        'factories' => [],
//    ],
//    'controllers'     => [
//        'factories' => [
//            RoleController::class => RoleControllerFactory::class,
//        ],
//    ],
//    'form_elements'   => [
//        'factories' => [],
//    ],
//    'hydrators' => [
//        'factories' => [],
//    ],
//    'view_helpers' => [
//        'invokables' => [],
//    ],
//];
+47
Changes for module/Application/config/others/admin.config.php: 47 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,9 @@

use Application\Controller\AdminController;
use Application\Controller\Factory\PrivilegeControllerFactory;
use Application\Controller\Factory\RoleControllerFactory;
use Application\Controller\MailConfirmationController;
use Application\Controller\RoleController;
use Application\Provider\Privilege\EcoleDoctoralePrivileges;
use Application\Provider\Privilege\UniteRecherchePrivileges;
use Application\Provider\Privilege\UtilisateurPrivileges;
@@ -20,6 +22,17 @@ return [
    'bjyauthorize'    => [
        'guards' => [
            PrivilegeController::class => [
                [
                    'controller' => RoleController::class,
                    'action' => [
                        'index',
                        'incrementer-ordre',
                        'decrementer-ordre',
                    ],
                    'roles' => [
                        'Administrateur technique'
                    ],
                ],
                [
                    'controller' => 'Application\Controller\Admin',
                    'action'     => [
@@ -102,6 +115,39 @@ return [
                    ],
                ],
            ],
            'role-ordre' => [
                'type'          => Literal::class,
                'options'       => [
                    'route'    => '/role-ordre',
                    'defaults' => [
                        'controller'    => RoleController::class,
                        'action'        => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'incrementer' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/incrementer/:role',
                            'defaults' => [
                                'controller'    => RoleController::class,
                                'action'        => 'incrementer-ordre',
                            ],
                        ],
                    ],
                    'decrementer' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/decrementer/:role',
                            'defaults' => [
                                'controller'    => RoleController::class,
                                'action'        => 'decrementer-ordre',
                            ],
                        ],
                    ],
                ]
            ],
            'mail-confirmation-acceuil' => [
                'type' => Segment::class,
                'options' => [
@@ -214,6 +260,7 @@ return [
        'factories' => [
            \Application\Controller\PrivilegeController::class =>  \Application\Controller\Factory\PrivilegeControllerFactory::class,
            MailConfirmationController::class => MailConfirmationControllerFactory::class,
            RoleController::class => RoleControllerFactory::class,
        ],
    ],

+32
Changes for module/Application/src/Application/Controller/Factory/RoleControllerFactory.php: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Controller\Factory;

use Application\Controller\RoleController;
use Application\Service\Etablissement\EtablissementService;
use Application\Service\Role\RoleService;
use Zend\Mvc\Controller\ControllerManager;

class RoleControllerFactory
{

    /**
     * @param ControllerManager $controllerManager
     * @return RoleController
     */
    public function __invoke(ControllerManager $controllerManager)
    {
        /**
         * @var RoleService $roleService
         * @var EtablissementService $etablissementService
         */
        $roleService = $controllerManager->getServiceLocator()->get('RoleService');
        $etablissementService = $controllerManager->getServiceLocator()->get(EtablissementService::class);

        $controller = new RoleController();
        $controller->setRoleService($roleService);
        $controller->setEtablissementService($etablissementService);

        return $controller;
    }
}
 No newline at end of file
+43
Changes for module/Application/src/Application/Controller/RoleController.php: 43 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Controller;

use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\Role\RoleServiceAwareTrait;
use Zend\View\Model\ViewModel;

class RoleController  extends AbstractController {
    use RoleServiceAwareTrait;
    use EtablissementServiceAwareTrait;

    public function indexAction()
    {
        $etablissementsMembres = $this->getEtablissementService()->getRepository()->findAllEtablissementsMembres();

        $mappedRoles = [];
        foreach ($etablissementsMembres as $etablissement) {
            $roles = $this->getRoleService()->getRepository()->findAllRolesTheseDependantByEtablissement($etablissement);
            $mappedRoles[$etablissement->getCode()] = $roles;
        }
        return new ViewModel([
            'etablissements' => $etablissementsMembres,
            'mappedRoles' => $mappedRoles,
        ]);
    }

    public function incrementerOrdreAction() {
        $idRole = $this->params()->fromRoute('role');
        $role = $this->getRoleService()->getRepository()->find($idRole);
        $this->getRoleService()->incrementerOrdre($role);

        $this->redirect()->toRoute('role-ordre');
    }

    public function decrementerOrdreAction() {
        $idRole = $this->params()->fromRoute('role');
        $role = $this->getRoleService()->getRepository()->find($idRole);
        $this->getRoleService()->decrementerOrdre($role);

        $this->redirect()->toRoute('role-ordre');
    }
}
 No newline at end of file
+11 −1
Changes for module/Application/src/Application/Entity/Db/Acteur.php: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -100,8 +100,18 @@ class Acteur implements HistoriqueAwareInterface, ResourceInterface
     */
    public function estRapporteur()
    {
        return $this->getRole()->getCode() === "R";
        return $this->getRole()->getCode() === Role::CODE_RAPPORTEUR_JURY;
    }


    /**
     * Prédicat testant cet un acteur est un rapporteur de thèse.
     *
     * @return bool
     */
    public function estPresidentJury()
    {
        return $this->getRole()->getCode() === Role::CODE_PRESIDENT_JURY;
    }

    /**
Loading