-
Notifications
You must be signed in to change notification settings - Fork 9.4k
aclResource for UIComponent buttons #20408
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
Conversation
Hi @kassner. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kassner thanks for your contribution! Please see my code review notes.
/** | ||
* @var AuthorizationInterface | ||
*/ | ||
protected $authorization; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the access level to private
@@ -116,6 +123,7 @@ public function __construct( | |||
UrlInterface $urlBuilder, | |||
Processor $processor, | |||
UiComponentFactory $uiComponentFactory, | |||
AuthorizationInterface $authorization, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add new dependency to constructor as the last optional parameter (backward compatibility)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see "Adding constructor parameters" section for details https://devdocs.magento.com/guides/v2.3/contributor-guide/backward-compatible-development/#php
@sivaschenko also, are you able to remove the partner label? I'm not assigned to that partner anymore (I left the team on Github, dunno why it still assigned to). |
Hi @sivaschenko, thank you for the review. |
Hi @kassner, thank you for your contribution! |
Hi @kassner. Thank you for your contribution. |
Description
Currently is not possible to hide buttons based on the user role in the admin panel. As the example from this Pull Request, the
Create new Order
button is always shown, even when the user does not have the permission for it. Clicking on the button gives a permission denied page, as expected.This PR introduces the possibility of defining an
aclResource
for UIComponents buttons, the same way that a dataSource can have.Manual testing scenarios
Magento_Sales::create
permission;Create New order
button should not be available;Contribution checklist (*)