Commit ebf1edea authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

rétablissement contrôle intervenant au niveau du firewall

parent 00a308e7
Loading
Loading
Loading
Loading
Loading
+9 −6
Changes for module/Application/src/ORM/RouteEntitiesInjector.php: 9 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -48,12 +48,6 @@ class RouteEntitiesInjector implements ParamFirewallInterface
        foreach ($params as $name => $value) {
            $errorMessage = null;
            $this->check($name, $params, null, $errorMessage);
            if ('intervenant' == $name) {
                $profile = $this->userManager->getProfile();
                if ($profile && $profile->getContext('intervenant')) {
                    $profile->setContext('intervenant', $params[$name]);
                }
            }
            if ($this->paramClass) {
                $e->setParam($name, $params[$this->paramClass]);
                $e->getRouteMatch()->setParam($this->paramClass, $params[$this->paramClass]);
@@ -91,11 +85,20 @@ class RouteEntitiesInjector implements ParamFirewallInterface
        switch ($name) {
            case 'intervenant':
                if ($params[$name] !== null) {
                    $profile = $this->userManager->getProfile();
                    if (!empty($profile->getContext('intervenant'))) {
                        // le paramètre en entrée est toujours l'intervenant courant si s'en est un
                        $intervenant               = $profile->getContext('intervenant');
                        $params[$name]             = $intervenant->getId();
                        $this->paramClass          = Intervenant::class;
                        $params[$this->paramClass] = $intervenant;
                    } else {
                        /** @var IntervenantService $serviceIntervenant */
                        $serviceIntervenant        = $this->container->get(IntervenantService::class);
                        $this->paramClass          = Intervenant::class;
                        $params[$this->paramClass] = $serviceIntervenant->getByRouteParam($params[$name]);
                    }
                }
                break;
            default:
                if (array_key_exists($name, $this->entityParams)) {