Skip to content

Conversation

BeggiNN
Copy link
Contributor

@BeggiNN BeggiNN commented Aug 9, 2023

  • Removed unused class \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper from \Magento\Catalog\Model\ProductRepository

Description (*)

Removed unused class \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper which is an Adminhtml controller from \Magento\Catalog\Model\ProductRepository.

When trying to use the rest-api with an oauth authorization, the Magento\Framework\App\Http class is triggered, which first tries to get the area code of the current url. But then the custom logic by the third party is triggered, finally loading in the productRepository. The productRepository then tries to load the above mentioned adminhtml controller, which tries to access the roleLocatorInterface, which is now not based on the webapi_rest/di.xml, but on the default app/etc/di.xml. Causing the Magento\Framework\Authorization\RoleLocator\DefaultRoleLocator to be loaded instead of the Magento\Framework\Authorization\RoleLocatorInterface\WebapiRoleLocator. This last thing causes the authorization to fail, as the DefaultRoleLocator returns '' instead of executing logic like the WebapiRoleLocator.

Fixed Issues (if relevant)

  1. Fixes ProductRepository is loading initializationHelper which is an Adminhtml controller  #37864

Manual testing scenarios (*)

  1. ...
  2. ...

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
- Removed unused class \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper from \Magento\Catalog\Model\ProductRepository
@m2-assistant
Copy link

m2-assistant bot commented Aug 9, 2023

Hi @BeggiNN. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-community-project m2-community-project bot added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Aug 9, 2023
@m2-github-services m2-github-services added Partner: Perspective partners-contribution Pull Request is created by Magento Partner labels Aug 9, 2023
@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 9, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Aug 9, 2023

@BeggiNN looks like you described a 2nd issue that this PR fixes.
Could you please report a separate issue for tracking the fix? I think it will require additional test coverage.

Edit: sorry, that's exactly the same issue. So everything is fine.
PS: I also expect to see some performance benefit from this change since product repository used in many places, and it won't require creating and initializing all the dependencies of \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 9, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 10, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Aug 10, 2023

@magento run Unit Tests, WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 8, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 8, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@magento-automated-testing
Copy link

Failed to run the builds. Please try to re-run them later.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 11, 2023

@magento run Semantic Version Checker, Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 11, 2023

@magento run Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 12, 2023

@magento run Integration Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@sinhaparul sinhaparul added the Project: Community Picked PRs upvoted by the community label Sep 13, 2023
@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 14, 2023

@magento run Integration Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@BeggiNN
Copy link
Contributor Author

BeggiNN commented Sep 15, 2023

@magento run Integration Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests CE, Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Lima engcom-Lima added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Sep 25, 2023
@engcom-Echo engcom-Echo self-assigned this Oct 4, 2023
@engcom-Echo
Copy link
Contributor

@magento run Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

✔️ QA Passed

QA not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner: Perspective partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept Project: Community Picked PRs upvoted by the community Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
8 participants