Commit 7d6fc8f7 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

WIP

parent 9c368d6b
Loading
Loading
Loading
Loading
+14 −15
Changes for doc/release-notes/v14/14.0.0/01_these_cotutelle.sql: 14 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -263,10 +263,10 @@ VALUES (nextval('nature_fichier_id_seq'),'COTUTELLE_JUSTIFICATIF_PRESENCE', 'Jus

select * from nature_fichier where libelle ilike '%cotut%';


insert into unicaen_privilege_categorie(id, code, libelle)
select nextval('categorie_privilege_id_seq'), 'these-cotutelle', 'Cotutelle de thèse';


insert into unicaen_privilege_privilege(ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE)
with d(ordre, code, lib) as (
    select 10, 'consulter-toutes', 'Consulter une cotutelle de n''importe quelle thèse' union
@@ -381,32 +381,31 @@ call privilege__grant_privileges_to_profiles('these-cotutelle',

insert into unicaen_privilege_privilege(ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE)
with d(ordre, code, lib) as (
    select 310, 'consulter-inscription-toutes', 'Consulter une inscription sur la cotutelle de n''importe quelle thèse' union
    select 320, 'consulter-inscription-miennes', 'Consulter une inscription sur la cotutelle d''une thèse me concernant' union
    select 330, 'ajouter-inscription-toutes', 'Ajouter une inscription sur la cotutelle de n''importe quelle thèse' union
    select 340, 'ajouter-inscription-miennes', 'Ajouter une inscription sur la cotutelle d''une thèse me concernant' union
    select 330, 'modifier-inscription-toutes', 'Modifier une inscription sur la cotutelle de n''importe quelle thèse' union
    select 340, 'modifier-inscription-miennes', 'Modifier une inscription sur la cotutelle d''une thèse me concernant' union
    select 350, 'supprimer-inscription-toutes', 'Supprimer une inscription sur la cotutelle de n''importe quelle thèse' union
    select 360, 'supprimer-inscription-miennes', 'Supprimer une inscription sur la cotutelle d''une thèse me concernant' union
    select 410, 'consulter-inscription-toutes', 'Consulter une inscription sur la cotutelle de n''importe quelle thèse' union
    select 420, 'consulter-inscription-miennes', 'Consulter une inscription sur la cotutelle d''une thèse me concernant' union
    select 430, 'ajouter-inscription-toutes', 'Ajouter une inscription sur la cotutelle de n''importe quelle thèse' union
    select 440, 'ajouter-inscription-miennes', 'Ajouter une inscription sur la cotutelle d''une thèse me concernant' union
    select 430, 'modifier-inscription-toutes', 'Modifier une inscription sur la cotutelle de n''importe quelle thèse' union
    select 440, 'modifier-inscription-miennes', 'Modifier une inscription sur la cotutelle d''une thèse me concernant' union
    select 450, 'supprimer-inscription-toutes', 'Supprimer une inscription sur la cotutelle de n''importe quelle thèse' union
    select 460, 'supprimer-inscription-miennes', 'Supprimer une inscription sur la cotutelle d''une thèse me concernant' union
    --
    select 370, 'modifier-inscription-etat-toutes', 'Modifier l''état d''une inscription sur la cotutelle de n''importe quelle thèse' union
    select 380, 'modifier-inscription-etat-miennes', 'Modifier l''état d''une inscription sur la cotutelle d''une thèse me concernant'

    select 470, 'modifier-inscription-justif-toutes', 'Modifier les justificatifs d''une inscription sur la cotutelle de n''importe quelle thèse' union
    select 480, 'modifier-inscription-justif-miennes', 'Modifier les justificatifs d''une inscription sur la cotutelle d''une thèse me concernant'
)
select nextval('privilege_id_seq'), cp.id, d.code, d.lib, d.ordre
from d join unicaen_privilege_categorie cp on cp.CODE = 'these-cotutelle'
;

call privilege__grant_privileges_to_profiles('these-cotutelle',
                                             ARRAY['consulter-inscription-toutes', 'ajouter-inscription-toutes', 'modifier-inscription-toutes', 'supprimer-inscription-toutes', 'modifier-inscription-etat-toutes'],
                                             ARRAY['consulter-inscription-toutes', 'ajouter-inscription-toutes', 'modifier-inscription-toutes', 'supprimer-inscription-toutes', 'modifier-inscription-justif-toutes'],
                                             ARRAY['ADMIN_TECH', 'BDD']);
call privilege__grant_privileges_to_profiles('these-cotutelle',
                                             ARRAY['consulter-inscription-miennes', 'ajouter-inscription-miennes', 'modifier-inscription-miennes', 'supprimer-inscription-miennes', 'modifier-inscription-etat-miennes'],
                                             ARRAY['consulter-inscription-miennes', 'ajouter-inscription-miennes', 'modifier-inscription-miennes', 'supprimer-inscription-miennes', 'modifier-inscription-justif-miennes'],
                                             ARRAY['GEST_ED']);
call privilege__grant_privileges_to_profiles('these-cotutelle',
                                             ARRAY['consulter-inscription-miennes'],
                                             ARRAY['GEST_UR', 'RESP_UR', 'RESP_ED']);
call privilege__grant_privileges_to_profiles('these-cotutelle',
                                             ARRAY['consulter-inscription-miennes'],
                                             ARRAY['consulter-inscription-miennes', 'modifier-inscription-justif-miennes'],
                                             ARRAY['DOCTORANT']);
+15 −0
Changes for module/TheseCotutelle/config/others/cotutelle.config.php: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ return [
                    'controller' => TheseCotutelleController::class,
                    'action' => [
                        'consulter',
                        'telechargerFichier',
                    ],
                    'privileges' => [
                        TheseCotutellePrivileges::CONSULTER_COTUTELLE_TOUTES,
@@ -144,6 +145,20 @@ return [
                                    ],
                                ],
                            ],
                            'telechargerFichier' => [
                                'type' => Segment::class,
                                'options' => [
                                    'route' => '/telecharger-fichier/:theseCotutelle/fichier/:fichier[/:fichierNom]',
                                    'constraints' => [
                                        'theseCotutelle' => '\d+',
                                        'fichier' => '[a-zA-Z0-9-]+',
                                    ],
                                    'defaults' => [
                                        /** @see TheseCotutelleController::telechargerFichierAction() */
                                        'action' => 'telechargerFichier',
                                    ],
                                ],
                            ],
                            'modifier' => [
                                'type' => Segment::class,
                                'options' => [
+4 −1
Changes for module/TheseCotutelle/config/others/inscription.config.php: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ use Laminas\Router\Http\Literal;
use Laminas\Router\Http\Segment;
use TheseCotutelle\Assertion\TheseCotutelleInscriptionAssertion;
use TheseCotutelle\Assertion\TheseCotutelleInscriptionAssertionFactory;
use TheseCotutelle\Controller\TheseCotutelleFichierController;
use TheseCotutelle\Controller\TheseCotutelleInscriptionController;
use TheseCotutelle\Controller\TheseCotutelleInscriptionControllerFactory;
use TheseCotutelle\Entity\Db\Service\TheseCotutelleInscriptionService;
@@ -39,6 +38,8 @@ return [
                            TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_MIENNES,
                            TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_SUPPRIMER_TOUTES,
                            TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_SUPPRIMER_MIENNES,
                            TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_TOUTES,
                            TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_MIENNES,
                        ],
                        'resources' => ['TheseCotutelleInscription'],
                        'assertion' => TheseCotutelleInscriptionAssertion::class,
@@ -78,6 +79,8 @@ return [
                    'privileges' => [
                        TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_TOUTES,
                        TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_MIENNES,
                        TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_TOUTES,
                        TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_MIENNES,
                    ],
                    'assertion' => TheseCotutelleInscriptionAssertion::class,
                ],
+5 −6
Changes for module/TheseCotutelle/src/TheseCotutelle/Assertion/TheseCotutelleInscriptionAssertion.php: 5 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class TheseCotutelleInscriptionAssertion extends AbstractAssertion
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_CONSULTER_MIENNES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_AJOUTER_MIENNES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_MIENNES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_ETAT_MIENNES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_MIENNES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_SUPPRIMER_MIENNES:
                    $this->assertAppartenanceThese($these);
            }
@@ -49,13 +49,13 @@ class TheseCotutelleInscriptionAssertion extends AbstractAssertion
            switch ($privilege) {
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_TOUTES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_MIENNES:
                    $this->assertEtatCotutelleInscription($theseCotutelleInscription, TheseCotutelleInscriptionEtat::Incomplet);
                    // RAS
            }

            switch ($privilege) {
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_ETAT_TOUTES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_ETAT_MIENNES:
                    // RAS
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_TOUTES:
                case TheseCotutelleInscriptionPrivileges::TheseCotutelleInscription_MODIFIER_JUSTIF_MIENNES:
                    $this->assertEtatCotutelleInscription($theseCotutelleInscription, TheseCotutelleInscriptionEtat::Incomplet);
            }

            switch ($privilege) {
@@ -160,7 +160,6 @@ class TheseCotutelleInscriptionAssertion extends AbstractAssertion
    ): void
    {
        $etats = (array)$etats;
        Assert::allIsInstanceOf($etats, TheseCotutelleInscriptionEtat::class);
        $this->assertTrue(in_array($theseCotutelleInscription->getEtat()->value, $etats, true));
    }

+14 −4
Changes for module/TheseCotutelle/src/TheseCotutelle/Controller/TheseCotutelleController.php: 14 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -4,14 +4,15 @@ namespace TheseCotutelle\Controller;

use Application\Controller\AbstractController;
use Exception;
use Fichier\Controller\FichierController;
use Laminas\Http\Response;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use Structure\Service\Etablissement\EtablissementServiceAwareTrait;
use These\Entity\Db\These;
use These\Service\These\TheseServiceAwareTrait;
use TheseCotutelle\Entity\Db\TheseCotutelle;
use TheseCotutelle\Entity\Db\Service\TheseCotutelleServiceAwareTrait;
use TheseCotutelle\Entity\Db\TheseCotutelle;
use TheseCotutelle\Form\TheseCotutelleForm;
use TheseCotutelle\Rule\PresencePeriodeDisponibleRule;
use Webmozart\Assert\Assert;
@@ -109,9 +110,6 @@ class TheseCotutelleController extends AbstractController
                        $this->theseCotutelle->getThese()->getDoctorant()
                    ));
                }
//                if (!$request->isXmlHttpRequest()) {
//                    return $this->redirect()->toUrl($this->urlIdentite());
//                }
            }
        }

@@ -179,6 +177,18 @@ class TheseCotutelleController extends AbstractController
        exit;
    }

    public function telechargerFichierAction(): void
    {
        $this->theseCotutelle = $this->getRequestedTheseCotutelle();

        $this->forward()->dispatch(FichierController::class, [
            'action' => 'telecharger',
            'fichier' => $this->params('fichier'),
            'fichierNom' => $this->params('fichierNom'),
            'query' => $this->params()->fromQuery(),
        ]);
    }

    private function getRequestedThese(): These
    {
        /** @var \These\Entity\Db\These $these */
Loading