Commit 3aafaef9 authored by Thomas Hamel's avatar Thomas Hamel
Browse files

Ajout d'un annuaire HDR pour les ADMIN_TECH

parent 7ff74251
Loading
Loading
Loading
Loading
+16 −0
Changes for doc/release-notes/v10/10.1.0/04_hdr.sql: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -22,6 +22,21 @@ from data
         join unicaen_privilege_privilege p on p.CATEGORIE_ID = cp.id and p.code = data.priv
where not exists (select * from PROFIL_PRIVILEGE where PRIVILEGE_ID = p.id and PROFIL_ID = profil.id);

-- Ajout d'un privilège pour accéder à l'annuaire des HDR
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'hdr'), 'acceder-annuaire', 'Accéder à l''annuaire des HDR', 1);

INSERT INTO PROFIL_PRIVILEGE (PRIVILEGE_ID, PROFIL_ID)
with data(categ, priv) as (select 'hdr', 'acceder-annuaire')
select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID
from data
         join PROFIL on profil.ROLE_ID in (
                                           'ADMIN_TECH'
    )
         join unicaen_privilege_categorie cp on cp.CODE = data.categ
         join unicaen_privilege_privilege p on p.CATEGORIE_ID = cp.id and p.code = data.priv
where not exists (select * from PROFIL_PRIVILEGE where PRIVILEGE_ID = p.id and PROFIL_ID = profil.id);

insert into ROLE_PRIVILEGE (ROLE_ID, PRIVILEGE_ID)
select p2r.ROLE_ID, pp.PRIVILEGE_ID
from PROFIL_TO_ROLE p2r
@@ -29,3 +44,4 @@ from PROFIL_TO_ROLE p2r
         join PROFIL_PRIVILEGE pp on pp.PROFIL_ID = pr.id
where not exists (select * from role_privilege where role_id = p2r.role_id and privilege_id = pp.privilege_id)
;
+18 −14
Changes for module/HDR/config/module.config.php: 18 added lines, 14 removed lines.
Original line number Diff line number Diff line
<?php
namespace HDR;

use Application\Entity\Db\Role;
use Application\Navigation\ApplicationNavigationFactory;
use BjyAuthorize\Guard\Controller;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use HDR\Assertion\HDRAssertion;
@@ -16,9 +18,6 @@ use HDR\Service\HDRSearchServiceFactory;
use HDR\Service\HDRService;
use HDR\Service\HDRServiceFactory;
use Laminas\Router\Http\Literal;
use Soutenance\Controller\AvisController;
use Soutenance\Controller\EngagementImpartialiteController;
use Soutenance\Controller\IndexController;
use UnicaenPrivilege\Guard\PrivilegeController;
use UnicaenPrivilege\Provider\Rule\PrivilegeRuleProvider;

@@ -117,6 +116,7 @@ return [
                'options' => [
                    'route' => '/hdr',
                    'defaults' => [
                        /** @see HDRRechercheController::indexAction() */
                        'controller' => HDRRechercheController::class,
                        'action' => 'index',
                    ],
@@ -128,6 +128,7 @@ return [
                        'options' => [
                            'route' => '/recherche',
                            'defaults' => [
                                /** @see HDRRechercheController::indexAction() */
                                'controller' => HDRRechercheController::class,
                                'action' => 'index',
                            ],
@@ -174,6 +175,7 @@ return [
                                'hdr' => '\d+',
                            ],
                            'defaults' => [
                                /** @see HDRController::detailIdentiteAction() */
                                'controller' => HDRController::class,
                                'action' => 'detail-identite',
                            ],
@@ -187,6 +189,7 @@ return [
                                'hdr' => '\d+',
                            ],
                            'defaults' => [
                                /** @see HDRController::demanderSaisieInfosSoutenanceAction() */
                                'controller' => HDRController::class,
                                'action' => 'demander-saisie-infos-soutenance',
                            ],
@@ -197,6 +200,7 @@ return [
                        'options' => [
                            'route' => '/export-csv',
                            'defaults' => [
                                /** @see HDRController::genererExportCsvAction() */
                                'controller' => HDRController::class,
                                'action' => 'generer-export-csv',
                            ],
@@ -217,17 +221,17 @@ return [
                     * Annuaire des HDR
                     */
                    // DEPTH = 1
//                    'annuaireHDR' => [
//                        'order' => 99,
//                        'label' => 'Annuaire des HDR',
//                        'route' => 'hdr',
//                        'params' => [],
//                        'query' => ['etatHDR' => 'E'],
//                        'resource' => PrivilegeController::getResourceId(HDRController::class, 'index'),
//                        'pages' => [
//                            // PAS de pages filles sinon le menu disparaît ! :-/
//                        ]
//                    ],
                    'annuaireHDR' => [
                        'order' => 99,
                        'label' => 'Annuaire des HDR',
                        'route' => 'hdr',
                        'params' => [],
                        'query' => ['etatHDR' => 'E'],
                        'resource' => HDRPrivileges::getResourceId(HDRPrivileges::HDR_ACCEDER_ANNUAIRE),
                        'pages' => [
                            // PAS de pages filles sinon le menu disparaît ! :-/
                        ]
                    ],

                    /**
                     * Navigation pour LA HDR "sélectionnée".
+8 −1
Changes for module/HDR/src/HDR/Controller/HDRRechercheController.php: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -30,7 +30,14 @@ class HDRRechercheController extends AbstractController implements SearchControl

    public function indexAction(): Response|ViewModel
    {
        $role = $this->userContextService->getSelectedIdentityRole();
        if($role->getCode() === Role::CODE_ADMIN_TECH){
            $this->restrictFiltersByStructure();
            $filtersRoute = 'hdr/recherche/filters';
        }else{
            $this->restrictFilters();
            $filtersRoute = 'hdr/recherche/notres/filters';
        }

        $text = $this->params()->fromQuery('text');

@@ -54,7 +61,7 @@ class HDRRechercheController extends AbstractController implements SearchControl
            'displayEtablissement' => !$etablissement,
            'displayDateSoutenance' => $etatHDR === HDR::ETAT_SOUTENUE || !$etatHDR,
            'etatHDR' => $etatHDR,
            'filtersRoute' => 'hdr/recherche/filters',
            'filtersRoute' => $filtersRoute,
        ]);
        return $viewModel;
    }
+1 −0
Changes for module/HDR/src/HDR/Provider/Privileges/HDRPrivileges.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ class HDRPrivileges extends Privileges
     * Tout faire !
     */
    public const HDR_TOUT_FAIRE                          = 'hdr-tout-faire';
    public const HDR_ACCEDER_ANNUAIRE                          = 'hdr-acceder-annuaire';

    /**
     * Recherche