Skip to content

Correctly convert config integration api resources #14065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

therool
Copy link
Contributor

@therool therool commented Mar 12, 2018

Description

Correctly return config based integration api resources. Currently it does not append "root api resource" (Magento_Backend::admin) which causes the integrations to be reset all the time even when there are no data changes when the Magento\Integration\Setup\Recurring is run (setup:upgrade) because Magento\Authorization\Model\Acl\AclRetriever::getAllowedResourcesByUser returns resource tree including "root api resource" (Magento_Backend::admin) and when they are compared they do not match.

Detailed explanation:

  1. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/ConfigBasedIntegrationManager.php#L128 (Get existing integration)
  2. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/Plugin/Integration.php#L109 (Append integration api resources)
  3. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/Plugin/Integration.php#L123 (Append config based integration api resources)
  4. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/ConsolidatedConfig.php#L68 (Read config based integrations)
  5. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/Config/Consolidated/Reader.php#L36 (Converter used to convert api resources from `etc/integration.xml)
  6. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/Config/Consolidated/Converter.php#L41 (Converts config integrations api resources without "root api resource" (Magento_Backend::admin)
  7. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/ConfigBasedIntegrationManager.php#L130 (Returns resource tree including "root api resource" (Magento_Backend::admin)
  8. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Integration/Model/ConfigBasedIntegrationManager.php#L171 (Condition is true due one resource tree having "root api resource" (Magento_Backend::admin) and the other not)

Fixed Issues (if relevant)

  1. Update 2.2.1: One or more integrations have been reset because of a change to their xml configs. #12095: Update 2.2.1: One or more integrations have been reset because of a change to their xml configs

Manual testing scenarios

  1. Create config based integration etc/integration.xml with "Magento_Catalog::catalog" resource and without "endpoint_url", "identity_link_url"
  2. run setup:upgrade so the integration is created
  3. activate integration in admin area under "System -> Integrations"
  4. run setup:upgrade again - the integration should stay as "Authorized" but it is "Reset" due the issue described above

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@therool
Copy link
Contributor Author

therool commented Mar 14, 2018

@omiroshnichenko
Copy link
Contributor

@therool You can ignore it.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Aug 7, 2018

CLA assistant check
All committers have signed the CLA.

@sidolov
Copy link
Contributor

sidolov commented Aug 7, 2018

Hi @therool , please, sign CLA, otherwise, we can't process your pull request

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-2723 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@therool thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-engcom-team
Copy link
Contributor

Hi @therool. Thank you for your contribution.
We will aim to release these changes as part of 2.2.8.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants