コード例 #1
0
 public function retractRegistrationAuthority(RetractRegistrationAuthorityCommand $command)
 {
     $apiCommand = new ApiRetractRegistrationAuthorityCommand();
     $apiCommand->identityId = $command->identityId;
     $result = $this->commandService->execute($apiCommand);
     if (!$result->isSuccessful()) {
         $this->logger->error(sprintf('Could not retract registration authority for identity "%s": "%s"', $apiCommand->identityId, implode("', '", $result->getErrors())));
     }
     return $result->isSuccessful();
 }
コード例 #2
0
 public function revoke(RevokeSecondFactorCommand $command)
 {
     $middlewareCommand = new RevokeRegistrantsSecondFactorCommand();
     $middlewareCommand->secondFactorId = $command->secondFactorId;
     $middlewareCommand->identityId = $command->identityId;
     $middlewareCommand->authorityId = $command->currentUserId;
     $result = $this->commandService->execute($middlewareCommand);
     if (!$result->isSuccessful()) {
         $this->logger->critical(sprintf('Revocation of Second Factor "%s" of Identity "%s" by user "%s" failed: "%s"', $middlewareCommand->secondFactorId, $middlewareCommand->identityId, $middlewareCommand->authorityId, implode(", ", $result->getErrors())));
     }
     return $result->isSuccessful();
 }
コード例 #3
0
 public function accreditCandidate(AccreditCandidateCommand $command)
 {
     $apiCommand = new AccreditIdentityCommand();
     $apiCommand->identityId = $command->identityId;
     $apiCommand->institution = $command->institution;
     $apiCommand->role = $command->role;
     $apiCommand->location = $command->location ?: '';
     $apiCommand->contactInformation = $command->contactInformation ?: '';
     $result = $this->commandService->execute($apiCommand);
     if (!$result->isSuccessful()) {
         $this->logger->critical(sprintf('Accreditation of Identity "%s" of Institution "%s" with role "%s" failed: "%s"', $apiCommand->identityId, $apiCommand->institution, $apiCommand->role, implode(", ", $result->getErrors())));
     }
     return $result->isSuccessful();
 }
コード例 #4
0
 /**
  * @param SwitchLocaleCommand $command
  * @return bool
  */
 public function switchLocale(SwitchLocaleCommand $command)
 {
     /** @var TokenInterface|null */
     $token = $this->tokenStorage->getToken();
     if (!$token) {
         throw new RuntimeException('Cannot switch locales when unauthenticated');
     }
     /** @var Identity $identity */
     $identity = $token->getUser();
     $expressLocalePreferenceCommand = new ExpressLocalePreferenceCommand();
     $expressLocalePreferenceCommand->identityId = $command->identityId;
     $expressLocalePreferenceCommand->preferredLocale = $command->locale;
     $result = $this->commandService->execute($expressLocalePreferenceCommand);
     if ($result->isSuccessful()) {
         $identity->preferredLocale = $command->locale;
     }
     return $result->isSuccessful();
 }
コード例 #5
0
 /**
  * @param string $procedureId
  * @return bool
  * @throws UnknownVettingProcedureException
  * @throws DomainException
  */
 public function vet($procedureId)
 {
     $procedure = $this->getProcedure($procedureId);
     $procedure->vet();
     $command = new VetSecondFactorCommand();
     $command->authorityId = $procedure->getAuthorityId();
     $command->identityId = $procedure->getSecondFactor()->identityId;
     $command->secondFactorId = $procedure->getSecondFactor()->id;
     $command->registrationCode = $procedure->getRegistrationCode();
     $command->secondFactorType = $procedure->getSecondFactor()->type;
     $command->secondFactorIdentifier = $procedure->getInputSecondFactorIdentifier();
     $command->documentNumber = $procedure->getDocumentNumber();
     $command->identityVerified = $procedure->isIdentityVerified();
     $result = $this->commandService->execute($command);
     if (!$result->isSuccessful()) {
         return false;
     }
     $this->vettingProcedureRepository->remove($procedureId);
     return true;
 }