From e8422c28959492db0eea8b1a58faa70e6b4fda89 Mon Sep 17 00:00:00 2001 From: Serhii Zhuravel Date: Fri, 21 May 2021 16:44:01 +0300 Subject: [PATCH] AKM-23: Fix MFA conflict --- Async/ImportProductProcessor.php | 17 +---------------- Async/SyncIntegrationProcessor.php | 17 +---------------- .../Strategy/AttributeFamilyImportStrategy.php | 2 +- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/Async/ImportProductProcessor.php b/Async/ImportProductProcessor.php index 23b0a40f..b023086c 100644 --- a/Async/ImportProductProcessor.php +++ b/Async/ImportProductProcessor.php @@ -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; @@ -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'], @@ -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); - } } diff --git a/Async/SyncIntegrationProcessor.php b/Async/SyncIntegrationProcessor.php index 667a11e1..7835264f 100644 --- a/Async/SyncIntegrationProcessor.php +++ b/Async/SyncIntegrationProcessor.php @@ -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; @@ -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( @@ -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); - } } diff --git a/ImportExport/Strategy/AttributeFamilyImportStrategy.php b/ImportExport/Strategy/AttributeFamilyImportStrategy.php index 752ca5f3..e4f98b0d 100644 --- a/ImportExport/Strategy/AttributeFamilyImportStrategy.php +++ b/ImportExport/Strategy/AttributeFamilyImportStrategy.php @@ -65,7 +65,7 @@ public function beforeProcessEntity($entity) $this->setSystemAttributes($entity); $this->setOwner($entity); - return $entity; + return parent::beforeProcessEntity($entity); } protected function afterProcessEntity($entity)