auth = $auth; $this->role = $role; $this->role2 = $role2; } public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface { $user = $this->auth->getUser(); //if (array_key_exists('premier', $search_array)) $non_admin = true; if (!in_array($this->role, [$_SESSION['role']])) { $non_admin = false; } if (!in_array($this->role2, [$_SESSION['role']])) { $non_admin = false; } if ($user === null || $non_admin ) { //if ($user === null || !array_key_exists($chaine_user,$this->role)) { throw new ForbiddenException(); } return $delegate->process($request); } }