Commit 829cd8bd authored by Thomas Hamel's avatar Thomas Hamel
Browse files

Première version intégration RNCP

parent 1e713a5f
Loading
Loading
Loading
Loading
+80 −0
Original line number Diff line number Diff line
--
-- Gestion des fiches RNCP
--

create table formation_fiche_rncp
(
    id                    bigserial not null
        primary key,
    code_rncp             varchar(50) UNIQUE,
    titre                 varchar(255),
    description           text,
    date_echeance timestamp,
    histo_createur_id     bigint    not null REFERENCES utilisateur (id),
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_modificateur_id bigint REFERENCES utilisateur (id),
    histo_modification    timestamp,
    histo_destructeur_id  bigint REFERENCES utilisateur (id),
    histo_destruction     timestamp
);

create table formation_formation_competence_rncp
(
    id                    bigserial not null
        primary key,
    fiche_rncp_id         bigint references formation_fiche_rncp (id) ON DELETE CASCADE,
    code                  varchar(20),
    intitule              varchar(1024),
    description           text,
    histo_createur_id     bigint    not null REFERENCES utilisateur (id),
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_modificateur_id bigint REFERENCES utilisateur (id),
    histo_modification    timestamp,
    histo_destructeur_id  bigint REFERENCES utilisateur (id),
    histo_destruction     timestamp
);

create table formation_formation_competence_rncp
(
    id            bigserial not null
        primary key,
    formation_id  bigint references formation_formation (id) ON DELETE CASCADE,
    competence_id bigint references formation_competence_rncp (id) ON DELETE CASCADE
);

--
-- Nouveaux privilèges.
--
insert into unicaen_privilege_privilege(ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE)
with d(ordre, code, lib) as (select 1,
                                    'configurer-module',
                                    'Configurer le module Formation'
)
select nextval('privilege_id_seq'), cp.id, d.code, d.lib, d.ordre
from d
         join unicaen_privilege_categorie cp on cp.CODE = 'formation_formation'
WHERE NOT EXISTS (SELECT 1
                  FROM unicaen_privilege_privilege p
                  WHERE p.CODE = d.code);

-- ajout des privilèges au profil BDD (Maison du Doctorat)
INSERT INTO PROFIL_PRIVILEGE (PRIVILEGE_ID, PROFIL_ID)
with data(categ, priv) as (select 'formation_formation', 'configurer-module')
select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID
from data
         join PROFIL on profil.ROLE_ID in (
                                           'ADMIN_TECH',
                                           'BDD',
                                           'GEST_ED'
    )
         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
         join profil pr on pr.id = p2r.PROFIL_ID
         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)
;
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Doctorant\View\Helper\MissionEnseignementViewHelper;
use Feature\View\Helper\FeatureViewHelper;
use Fichier\Entity\Db\Fichier;
use Fichier\View\Helper\Fichier\FichierViewHelper;
use Formation\View\Helper\CompetenceRNCPViewHelper;
use Horodatage\Entity\Db\Horodatage;
use Horodatage\Entity\Interfaces\HasHorodatagesInterface;
use Horodatage\View\Helper\DernierHorodatageViewHelper;
@@ -176,9 +177,9 @@ use UnicaenIdref\View\Helper\IdrefLinkViewHelper;
 * @method ActualiteViewHelper actualite()
 * @method StructureViewHelper structure(Structure|Etablissement|EcoleDoctorale|UniteRecherche $structure, bool $afficherLibelle = true, bool $sansOmbre = false, $options = [])
 * @method FichierViewHelper fichier(Fichier $object, string $urlTelechargementFichier, string $urlSuppressionFichier, bool $canGererFichier, string $libelleOptionnel = "", bool $voirHistoInfo = true, bool $canVoirSuppression = true, bool $isTargetBlank = false, array $options = [])
 * @method CompetenceRNCPViewHelper competence(CompetenceRNCPViewHelper $object, array $options = [])
 * @method EtatViewHelper etatHelper(mixed $etat = null, int|null $resultat = null, string|null $resultatString = "", $options = [])
 * @method MissionEnseignementViewHelper missionEnseignement(MissionEnseignement $missionEnseignement, These $these, $options = [])
 *
 * @method IdrefLinkViewHelper idrefLink(string $ppn)
 *
 * @method HorodatageViewHelper horodatage(Horodatage $horadatage, array $options = [])
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ use Formation\Service\Parametre\ParametreService;
use Formation\Service\Parametre\ParametreServiceFactory;
use Formation\Service\Url\UrlService;
use Formation\Service\Url\UrlServiceFactory;
use Formation\View\Helper\CompetenceRNCPViewHelper;
use Formation\View\Helper\EtatViewHelper;
use Formation\View\Helper\FormateursViewHelper;
use Formation\View\Helper\ModaliteViewHelper;
@@ -88,6 +89,7 @@ return array(
            'formateurs' => FormateursViewHelper::class,
            'sessionInscription' => SessionInscriptionViewHelper::class,
            'sessionLibelle' => SessionLibelleViewHelper::class,
            'competence' => CompetenceRNCPViewHelper::class,
        ]
    ],

+28 −0
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ use Formation\Service\Formation\FormationService;
use Formation\Service\Formation\FormationServiceFactory;
use Formation\Service\Formation\Search\FormationSearchService;
use Formation\Service\Formation\Search\FormationSearchServiceFactory;
use Formation\Service\RNCP\Competence\CompetenceRNCPService;
use Formation\Service\RNCP\Competence\CompetenceRNCPServiceFactory;
use Formation\Service\RNCP\Fiche\FicheRNCPService;
use Formation\Service\RNCP\Fiche\FicheRNCPServiceFactory;
use Laminas\Router\Http\Literal;
use Laminas\Router\Http\Segment;
use UnicaenPrivilege\Guard\PrivilegeController;
@@ -180,6 +184,15 @@ return [
                        FormationPrivileges::FORMATION_SUPPRIMER,
                    ],
                ],
                [
                    'controller' => FormationController::class,
                    'action' => [
                        'configurer-module'
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_CONFIGURER_MODULE,
                    ],
                ],
            ],
        ],
    ],
@@ -336,6 +349,17 @@ return [
                                    ],
                                ],
                            ],
                            'configurer-module' => [
                                'type'          => Literal::class,
                                'options'       => [
                                    'route'    => '/configurer-module',
                                    'defaults' => [
                                        /** @see FormationController::configurerModuleAction() */
                                        'controller'    => FormationController::class,
                                        'action'        => 'configurer-module',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
@@ -355,6 +379,10 @@ return [
            XlsxExportManager::class => XlsxExportManagerFactory::class,
            FormationAssertion::class => FormationAssertionFactory::class,

            //RNCP
            CompetenceRNCPService::class => CompetenceRNCPServiceFactory::class,
            FicheRNCPService::class => FicheRNCPServiceFactory::class,

            FormationStatsXlsxExport::class => FormationStatsXlsxExportFactory::class,
            EnqueteDataProvider::class => EnqueteDataProviderFactory::class,
            EtablissementExplodeDataProcessor::class => EtablissementExplodeDataProcessorFactory::class,
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ use Formation\Form\Formation\FormationFormAwareTrait;
use Formation\Service\Formation\FormationServiceAwareTrait;
use Formation\Service\Module\ModuleServiceAwareTrait;
use Formation\Service\Notification\FormationNotificationFactoryAwareTrait;
use Formation\Service\RNCP\Fiche\FicheRNCPServiceAwareTrait;
use Formation\Service\Session\SessionServiceAwareTrait;
use Laminas\Http\Response;
use Laminas\View\Model\ViewModel;
@@ -40,6 +41,7 @@ class FormationController extends AbstractController
    use FichierServiceAwareTrait;
    use FichierStorageServiceAwareTrait;
    use XlsxExportManagerAwareTrait;
    use FicheRNCPServiceAwareTrait;

    use EtablissementServiceAwareTrait;

@@ -251,4 +253,12 @@ class FormationController extends AbstractController

        return $viewModel;
    }

    public function configurerModuleAction(): ViewModel
    {
        return new ViewModel([
            'fichesRNCP' => $this->ficheRNCPService->getRepository()->findAll(),
            'retour' => $this->params()->fromQuery('retour')
        ]);
    }
}
 No newline at end of file
Loading