Skip to content

Commit

Permalink
fix on NDE voter to check new formm enabled #2217
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeneuvrier committed Feb 6, 2024
1 parent e433331 commit 3823077
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Security/Voter/UserVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ private function canReactive(User $user)

public function canSeeNde(User $user): bool
{
return $user->isTerritoryAdmin() || \in_array(Qualification::NON_DECENCE_ENERGETIQUE, $user->getPartner()->getCompetence());
$experimentationTerritories = $this->parameterBag->get('experimentation_territory');
$isExperimentationTerritory = \array_key_exists(
$user->getPartner()->getTerritory()->getZip(),
$experimentationTerritories
);
if ($isExperimentationTerritory || $this->parameterBag->get('feature_new_form')) {
return $user->isTerritoryAdmin()
|| \in_array(Qualification::NON_DECENCE_ENERGETIQUE, $user->getPartner()->getCompetence());
}

return false;
}
}

0 comments on commit 3823077

Please sign in to comment.