Skip to content
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

Mark AbstractAccount as DEPRECATED for Magento_Customer controllers #27214

Conversation

lbajsarowicz
Copy link
Contributor

Description (*)

According to recent changes in favour of Composition over inheritance in Magento 2 Controller Structure - I've introduced changes to Account controllers. That is the first step - make AbstractAccount deprecated.

Related Pull Requests

Fixed Issues (if relevant)

N/A

Manual testing scenarios (*)

N/A

Questions or comments

Reattached the Authorization plugin to AccountInterface from AbstractAccount

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 are green)

@m2-assistant
Copy link

m2-assistant bot commented Mar 9, 2020

Hi @lbajsarowicz. Thank you for your contribution
Here is some useful tips 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

For more details, please, review the Magento Contributor Guide documentation.

@lbajsarowicz
Copy link
Contributor Author

@magento give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz, here is your new Magento instance.
Admin access: https://pr-27214.instances.magento-community.engineering/admin_1fd8
Login: 4666e69a Password: dbaf08ab16c8
Instance will be terminated in up to 3 hours.

@lbajsarowicz
Copy link
Contributor Author

PS: I wanted to move Plugin to the right location Magento\Customer\Plugin\AccountControllerPermissionPlugin however this change is strongly backwards-incompatible. If you have any idea how to handle that other way - I'd love to see your PR to achieve this :-)

@dmytro-ch dmytro-ch self-assigned this Mar 10, 2020
@lbajsarowicz
Copy link
Contributor Author

There was a logical issue because even if you were not permitted to Action, the execute was called.
Thanks @lenaorobei for finding :-)

@lbajsarowicz
Copy link
Contributor Author

As we don't implement AbstractAction

//Validation did not produce a result to replace the action's.
if (!$result) {
if ($actionInstance instanceof AbstractAction) {
$result = $actionInstance->dispatch($request);
} else {
$result = $actionInstance->execute();
}
}

I'm not going to put any flags around execute.

Copy link
Contributor

@lenaorobei lenaorobei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can write some integration tests to verify that some actions are allowed for authorized customers only?

app/code/Magento/Customer/Controller/AbstractAccount.php Outdated Show resolved Hide resolved
@ghost ghost assigned lenaorobei Mar 11, 2020
@lenaorobei
Copy link
Contributor

lenaorobei commented Mar 12, 2020

⚠️ QA notes:
Need to create controller and implement AccountInterface and make sure that only logged in customer has access to this route. Guests should have a redirect.

  • check B2B company scenarios.

Copy link
Contributor

@engcom-Alfa engcom-Alfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmytro-ch Could you review the latest changes? Thanks!

@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch, thank you for the review.
ENGCOM-7107 has been created to process this Pull Request

@engcom-Echo
Copy link
Contributor

✔️ QA Passed

@engcom-Echo
Copy link
Contributor

@magento run all tests

@engcom-Echo
Copy link
Contributor

Failed functional tests not related to the changes in this PR

@magento-engcom-team magento-engcom-team merged commit 4f428fd into magento:2.4-develop Mar 21, 2020
@m2-assistant
Copy link

m2-assistant bot commented Mar 21, 2020

Hi @lbajsarowicz, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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.

7 participants