transitionRepository = $transitionRepository; $this->profileQuery = $profileQuery; $this->projectPlaceQuery = $projectPlaceQuery; $this->requestStack = $requestStack; $this->userCollect = $userCollect; } /* * Récupèration de l'étape de l'élémént dans le workflow */ public function transitionUserValid(int $id): bool { $grant = false; $token = $this->requestStack->getCurrentRequest()->headers->get('x-auth-token'); $profile = $this->profileQuery->getUserIdFromToken($token); $profileId = $this->userCollect->readUser(); $place = $this->projectPlaceQuery->getPlace($id); if ($place && 'ADMIN' !== $profileId['data']['code']) { $transitions = $this->transitionRepository->findByStartPlaceKey($place); if ($transitions) { $indexTran = 0; while ($indexTran < count($transitions)) { $transition = $transitions[$indexTran]; $index = 0; while ($index < count($transition->getUsers()) && !$grant) { if ($transition->getUsers()[$index]->id === $profile) { $grant = true; } ++$index; } ++$indexTran; } } else { $grant = true; } } else { $grant = true; } return $grant; } }