Ejemplo n.º 1
0
 public function testAfterDelete()
 {
     $integrationId = 1;
     $integrationsData = [Integration::ID => $integrationId, Integration::NAME => 'TestIntegration1', Integration::EMAIL => '*****@*****.**', Integration::ENDPOINT => 'http://endpoint.com', Integration::SETUP_TYPE => 1];
     $this->integrationAuthServiceMock->expects($this->once())->method('removePermissions')->with($integrationId);
     $this->integrationV1Plugin->afterDelete($this->subjectMock, $integrationsData);
 }
Ejemplo n.º 2
0
 /**
  * Process integration resource permissions after the integration is created
  *
  * @param \Magento\Integration\Service\V1\Integration $subject
  * @param array $integrationData Data of integration deleted
  *
  * @return array $integrationData
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterDelete(\Magento\Integration\Service\V1\Integration $subject, array $integrationData)
 {
     //No check needed for integration data since it cannot be empty in the parent invocation - delete
     $integrationId = (int) $integrationData[IntegrationModel::ID];
     $this->integrationAuthorizationService->removePermissions($integrationId);
     return $integrationData;
 }
Ejemplo n.º 3
0
 /**
  * Process integration resource permissions after the integration is created
  *
  * @param \Magento\Integration\Model\Resource\Setup $subject
  * @param string[] $integrationNames Name of integrations passed as array from the invocation chain
  *
  * @return string[]
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterInitIntegrationProcessing(\Magento\Integration\Model\Resource\Setup $subject, $integrationNames)
 {
     if (empty($integrationNames)) {
         return [];
     }
     /** @var array $integrations */
     $integrations = $this->_integrationConfig->getIntegrations();
     foreach ($integrationNames as $name) {
         if (isset($integrations[$name])) {
             $integration = $this->_integrationService->findByName($name);
             if ($integration->getId()) {
                 $this->integrationAuthorizationService->grantPermissions($integration->getId(), $integrations[$name]['resources']);
             }
         }
     }
     return $integrationNames;
 }
Ejemplo n.º 4
0
 /**
  * Process integration resource permissions after the integration is created
  *
  * @param ConfigBasedIntegrationManager $subject
  * @param string[] $integrationNames Name of integrations passed as array from the invocation chain
  *
  * @return string[]
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterProcessIntegrationConfig(ConfigBasedIntegrationManager $subject, $integrationNames)
 {
     if (empty($integrationNames)) {
         return [];
     }
     /** @var array $integrations */
     $integrations = $this->_integrationConfig->getIntegrations();
     foreach ($integrationNames as $name) {
         if (isset($integrations[$name])) {
             $integration = $this->_integrationService->findByName($name);
             if ($integration->getId()) {
                 $this->integrationAuthorizationService->grantPermissions($integration->getId(), $integrations[$name]['resources']);
             }
         }
     }
     return $integrationNames;
 }