integrationAuthorizationService = $integrationAuthorizationService; $this->_integrationService = $integrationService; $this->integrationConfig = $integrationConfig; } /** * 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) * @deprecated 100.1.0 */ 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]['resource'] ); } } } return $integrationNames; } /** * Process integration resource permissions after the integration is created * * @param ConfigBasedIntegrationManager $subject * @param array $integrations integrations passed as array from the invocation chain * * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterProcessConfigBasedIntegrations( ConfigBasedIntegrationManager $subject, $integrations ) { if (empty($integrations)) { return []; } foreach (array_keys($integrations) as $name) { $integration = $this->_integrationService->findByName($name); if ($integration->getId()) { $this->integrationAuthorizationService->grantPermissions( $integration->getId(), $integrations[$name]['resource'] ); } } return $integrations; } }