<commit_before><?php

class EtablissementRoute extends sfObjectRoute implements InterfaceEtablissementRoute {

    protected $etablissement = null;
    
    protected function getObjectForParameters($parameters = null) {
      $this->etablissement = EtablissementClient::getInstance()->find($parameters['identifiant']);
      return $this->etablissement;
    }

    protected function doConvertObjectToArray($object = null) {
  
        return array("identifiant" => $object->getIdentifiant());
    }

    public function getEtablissement() {
      if (!$this->etablissement) {
           $this->etablissement = $this->getObject();
      }
      return $this->etablissement;
    }
}<commit_msg>ajout d'un control sur la route ETB pour la restriction à l'accès aux drm<commit_after><?php

class EtablissementRoute extends sfObjectRoute implements InterfaceEtablissementRoute {

    protected $etablissement = null;

    protected function getObjectForParameters($parameters = null) {
        $this->etablissement = EtablissementClient::getInstance()->find($parameters['identifiant']);
        $myUser = sfContext::getInstance()->getUser();
        if ($myUser->hasTeledeclaration() &&
                $myUser->getCompte()->identifiant != $this->getEtablissement()->getSociete()->getMasterCompte()->identifiant) {
            throw new sfError404Exception("Vous n'avez pas le droit d'accéder à cette page");
        }

        return $this->etablissement;
    }

    protected function doConvertObjectToArray($object = null) {

        return array("identifiant" => $object->getIdentifiant());
    }

    public function getEtablissement() {
        if (!$this->etablissement) {
            $this->etablissement = $this->getObject();
        }
        return $this->etablissement;
    }

}
{'fraction_non_alphanumeric': 0.1225517627308338, 'fraction_numerical': 0.0016787912702853946, 'mean_word_length': 3.526582278481013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4427608', 'n_tokens_mistral': 502, 'n_tokens_neox': 500, 'n_words': 98}