Skip to main content
2 of 2
improvement the multiple resources
Tuyen Nguyen
  • 1.3k
  • 8
  • 19

Function _isAllowed() was implemented on every action to defined the permission to run the action.

In _isAllowed() it's gonna use the const ADMIN_RESOURCE which be defined on your controller.

To understand the tag Vendor_Catalog::import_product_category_assignment. This is a resource which be defined on etc/acl.xml current module

See https://devdocs.magento.com/guides/v2.4/ext-best-practices/tutorials/create-access-control-list-rule.html

For multiple resources you could add

/**
 * @return bool
 */
protected function _isAllowed()
{
    return $this->_authorization->isAllowed('Foo_Bar::foo_bar') && $this->_authorization->isAllowed('Bar_Foo::bar_foo');
} 
Tuyen Nguyen
  • 1.3k
  • 8
  • 19