Commit 4a0fffce authored by Thomas Hamel's avatar Thomas Hamel
Browse files

fix index des rapports activités accessibles aux doctorants

parent b7cac60f
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -60,6 +60,14 @@ class RapportActiviteRechercheAssertion extends AbstractAssertion
                case 'index':
                case 'filters':
                case 'telecharger-zip':
                    $role = $this->userContextService->getSelectedIdentityRole();
                    if (!$role) {
                        return false;
                    }
                    //todo : ajouter un nouveau privilège afin que le doctorant n'ait pas accès à l'index des rapports d'activité (conflit avec les gest/resp ed/ur)
                    if ($role->isDoctorant()) {
                        return false;
                    }
                    break;
            }

+2 −2
Original line number Diff line number Diff line
@@ -37,9 +37,9 @@ return array(
                    'privileges' => IndexPrivileges::INDEX_RAPPORTEUR,
                ],
                [
                    'controller' => IndexController::class,
                    'controller' => PropositionRechercheController::class,
                    'action' => [
                        'index-structure',
                        'index',
                    ],
                    'privileges' => IndexPrivileges::INDEX_STRUCTURE,
                ],
+0 −1
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ return [
                [
                    'controller' => PropositionRechercheController::class,
                    'action' => [
                        'index',
                        'filters',
                        'notres',
                        'notresFilters',
+14 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ class PresoutenanceAssertion extends AbstractAssertion

    private function assertCanAccessInformationsPresoutenance(These $these){
        $role = $this->userContextService->getSelectedIdentityRole();
        $individu = $this->userContextService->getIdentityIndividu();

        if (!$role) {
            return;
        }
@@ -139,6 +141,18 @@ class PresoutenanceAssertion extends AbstractAssertion
                $these->getUniteRecherche()->getStructure()->getId() === $roleUniteRech->getStructure()->getId(),
                "La thèse n'est pas rattachée à l'UR " . $roleUniteRech->getStructure()->getCode()
            );
        } elseif ($role->isDirecteurThese()) {
            $directeurs = $these->getActeursByRoleCode(Role::CODE_DIRECTEUR_THESE);
            $individus = [];
            foreach ($directeurs as $directeur) $individus[] = $directeur->getIndividu();
            $this->assertTrue(array_search($individu, $individus) !== false,
                $individu." n'est pas le directeur de cette thèse");
        } elseif ($role->getCode() === Role::CODE_CODIRECTEUR_THESE) {
            $directeurs = $these->getActeursByRoleCode(Role::CODE_CODIRECTEUR_THESE);
            $individus = [];
            foreach ($directeurs as $directeur) $individus[] = $directeur->getIndividu();
            $this->assertTrue(array_search($individu, $individus) !== false,
                $individu." n'est pas le co-directeur de cette thèse");
        }
    }