Commit 0f65a69e authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Modification privilege et assertion

parent bfbfce6f
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -56,8 +56,8 @@ return [
                            PropositionPrivileges::PROPOSITION_VALIDER_BDD,
                            PropositionPrivileges::PROPOSITION_PRESIDENCE,

                            PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VISUALISER,
                            PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER,
                            PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_REVOQUER,
                        ],
                        'resources' => ['These'],
                        'assertion' => PropositionAssertion::class,
@@ -146,16 +146,17 @@ return [
                    'controller' => PropositionController::class,
                    'action' => [
                        'declaration-non-plagiat',
                        'valider-declaration-non-plagiat',
                        'refuser-declaration-non-plagiat',
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VISUALISER,
                    'privileges' => PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER,
                ],
                [
                    'controller' => PropositionController::class,
                    'action' => [
                        'valider-declaration-non-plagiat',
                        'refuser-declaration-non-plagiat',
                        'revoquer-declaration-non-plagiat',
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER,
                    'privileges' => PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_REVOQUER,
                ],
            ],
        ],
@@ -396,6 +397,17 @@ return [
                                            ],
                                        ],
                                    ],
                                    'revoquer' => [
                                        'type' => Literal::class,
                                        'may_terminate' => true,
                                        'options' => [
                                            'route' => '/revoquer',
                                            'defaults' => [
                                                'controller' => PropositionController::class,
                                                'action' => 'revoquer-declaration-non-plagiat',
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
+18 −0
Original line number Diff line number Diff line
@@ -190,6 +190,24 @@ class PropositionAssertion implements AssertionInterface {
                    default:
                        return false;
                }
            case PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER:
                switch ($role) {
                    case Role::CODE_DOCTORANT :
                        $isDoctorant = $doctorant->getId() === $individu->getId();
                        $dateOk = ($sursis OR ($dateCurrent <= $dateValidationMax));
                        return ($isDoctorant AND $dateOk);
                    default:
                    return false;
                }
            case PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_REVOQUER:
                switch($role) {
                    case Role::CODE_ADMIN_TECH :
                        return true;
                    case Role::CODE_BDD :
                        return ($these->getEtablissement()->getStructure() === $identityRole->getStructure());
                    default :
                        return false;
                }
            default :
                return false;
        }
+12 −4
Original line number Diff line number Diff line
@@ -542,13 +542,9 @@ class PropositionController extends AbstractController
    {
        $these = $this->requestedThese();

        $individuUtilisateur = $this->userContextService->getIdentityDb()->getIndividu();
        $individuDoctorant = $these->getDoctorant()->getIndividu();

        return new ViewModel([
            'title' => '«&nbsp;Lutte anti-plagiat : Déclaration sur l’honneur&nbsp;»',
            'these' => $these,
            'isTheseDoctorant' => $individuDoctorant === $individuUtilisateur,
            'validation' => null,

            /** @see PropositionController::validerDeclarationNonPlagiatAction() */
@@ -575,4 +571,16 @@ class PropositionController extends AbstractController

        return $this->redirect()->toRoute('soutenance/proposition', ['these' => $these->getId()], [], true);
    }

    public function revoquerDeclarationNonPlagiatAction() : Response
    {
        $these = $this->requestedThese();

        $validations = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_VALIDATION_DECLARATION_HONNEUR, $these);
        foreach ($validations as $validation) { $this->getValidationService()->historise($validation); }
        $refus = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_REFUS_DECLARATION_HONNEUR, $these);
        foreach ($refus as $refu) { $this->getValidationService()->historise($refu); }

        return $this->redirect()->toRoute('soutenance/proposition', ['these' => $these->getId()], [], true);
    }
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -16,6 +16,6 @@ class PropositionPrivileges extends Privileges
    const PROPOSITION_VALIDER_BDD                     = 'soutenance-proposition-validation-bdd';
    const PROPOSITION_PRESIDENCE                      = 'soutenance-proposition-presidence';
    const PROPOSITION_SURSIS                          = 'soutenance-proposition-sursis';
    const PROPOSITION_DECLARATION_HONNEUR_VISUALISER  = 'soutenance-declaration-honneur-visualiser';
    const PROPOSITION_DECLARATION_HONNEUR_VALIDER     = 'soutenance-declaration-honneur-valider';
    const PROPOSITION_DECLARATION_HONNEUR_REVOQUER    = 'soutenance-declaration-honneur-revoquer';
}
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
/**
 * @see \Soutenance\Controller\PropositionController::declarationNonPlagiatAction()
 * @var These $these
 * @var bool $isTheseDoctorant
 * @var Validation $validation
 * @var string $urlValider
 * @var string $urlRefuser
@@ -12,6 +11,7 @@
use Application\Entity\Db\Acteur;
use Application\Entity\Db\These;
use Application\Entity\Db\Validation;
use Soutenance\Provider\Privilege\PropositionPrivileges;
use Soutenance\Provider\Validation\TypeValidation;

$this->headTitle("Déclaration sur l'honneur de non plagiat");
@@ -42,7 +42,7 @@ if ($ur !== null) {
    $unite = $ur->getLibelle() . " (" . $ur->getSigle() . ")";
}


$canValider = $this->isAllowed($these, PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER);

?>

@@ -75,7 +75,7 @@ if ($ur !== null) {

<div class="row">
    <div class="col-md-4">
        <?php if ($isTheseDoctorant): ?>
        <?php if ($canValider): ?>
            <p>
        <span style="text-align: center">
        <a      href="<?php echo $urlValider;  ?>"
Loading