Skip to content

Commit

Permalink
AKM-23: Fix MFA conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
dxops committed May 21, 2021
1 parent ab1b71f commit e8422c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 33 deletions.
17 changes: 1 addition & 16 deletions Async/ImportProductProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Oro\Bundle\IntegrationBundle\Authentication\Token\IntegrationTokenAwareTrait;
use Oro\Bundle\IntegrationBundle\Entity\Channel as Integration;
use Oro\Bundle\IntegrationBundle\Provider\SyncProcessorRegistry;
use Oro\Bundle\SecurityBundle\Authentication\Token\UsernamePasswordOrganizationToken;
use Oro\Component\MessageQueue\Client\TopicSubscriberInterface;
use Oro\Component\MessageQueue\Consumption\MessageProcessorInterface;
use Oro\Component\MessageQueue\Job\Job;
Expand Down Expand Up @@ -91,7 +90,7 @@ public function process(MessageInterface $message, SessionInterface $session)
return self::REJECT;
}

$this->setTemporaryUserIntegrationToken($integration);
$this->setTemporaryIntegrationToken($integration);

$result = $this->jobRunner->runDelayed(
$body['jobId'],
Expand All @@ -108,20 +107,6 @@ function (JobRunner $jobRunner, Job $child) use ($integration, $body) {
}
);

$this->setTemporaryIntegrationToken($integration);

return $result ? self::ACK : self::REJECT;
}

private function setTemporaryUserIntegrationToken(Integration $integration)
{
$token = new UsernamePasswordOrganizationToken(
$integration->getDefaultUserOwner(),
$integration->getDefaultUserOwner()->getUsername(),
'main',
$integration->getOrganization()
);
$token->setAttribute('owner_description', 'Integration: ' . $integration->getName());
$this->tokenStorage->setToken($token);
}
}
17 changes: 1 addition & 16 deletions Async/SyncIntegrationProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Oro\Bundle\IntegrationBundle\Provider\LoggerStrategyAwareInterface;
use Oro\Bundle\IntegrationBundle\Provider\SyncProcessorRegistry;
use Oro\Bundle\MessageQueueBundle\Entity\Job;
use Oro\Bundle\SecurityBundle\Authentication\Token\UsernamePasswordOrganizationToken;
use Oro\Component\MessageQueue\Client\TopicSubscriberInterface;
use Oro\Component\MessageQueue\Consumption\MessageProcessorInterface;
use Oro\Component\MessageQueue\Job\JobRunner;
Expand Down Expand Up @@ -106,7 +105,7 @@ public function process(MessageInterface $message, SessionInterface $session)

$em->getConnection()->getConfiguration()->setSQLLogger(null);

$this->setTemporaryUserIntegrationToken($integration);
$this->setTemporaryIntegrationToken($integration);
$integration->getTransport()->getSettingsBag()->set('page_size', $body['transport_batch_size']);

$result = $this->jobRunner->runUnique(
Expand All @@ -128,20 +127,6 @@ function (JobRunner $jobRunner, Job $job) use ($integration, $body) {
}
);

$this->setTemporaryIntegrationToken($integration);

return $result ? self::ACK : self::REJECT;
}

private function setTemporaryUserIntegrationToken(Integration $integration)
{
$token = new UsernamePasswordOrganizationToken(
$integration->getDefaultUserOwner(),
$integration->getDefaultUserOwner()->getUsername(),
'main',
$integration->getOrganization()
);
$token->setAttribute('owner_description', 'Integration: ' . $integration->getName());
$this->tokenStorage->setToken($token);
}
}
2 changes: 1 addition & 1 deletion ImportExport/Strategy/AttributeFamilyImportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function beforeProcessEntity($entity)
$this->setSystemAttributes($entity);
$this->setOwner($entity);

return $entity;
return parent::beforeProcessEntity($entity);
}

protected function afterProcessEntity($entity)
Expand Down

0 comments on commit e8422c2

Please sign in to comment.