Skip to content
Snippets Groups Projects
Commit 69bddfeb authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Renforcement sécurité sur le téléchargement des fichiers liés au contrat de l'intervenant

parent b26280af
No related branches found
No related tags found
No related merge requests found
......@@ -588,16 +588,22 @@ class ContratController extends AbstractController
public function telechargerFichierAction()
{
$contrat = $this->getEvent()->getParam('contrat');
/* @var $contrat Contrat */
$fichierDemandee = $this->getEvent()->getParam('fichier');
if (!$this->isAllowed($contrat, Privileges::CONTRAT_VISUALISATION)) {
throw new UnAuthorizedException('Vous n\'avez pas de droit de télécharger ce fichier');
}
$fichier = $this->getEvent()->getParam('fichier');
$fichiersContrat = $contrat->getFichier();
foreach ($fichiersContrat as $fichier) {
if ($fichier->getId() == $fichierDemandee->getId()) {
$this->uploader()->download($fichier);
}
}
throw new \Exception('Le fichier n\'existe pas ou bien il appartient à un autre intervenant');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment