I've been trying to figure out the difference between acl and aclResource both attributes available for <block> directive.

I know that aclResource is useful to render the block based on specific acl resource_id example :

<block name="my_block" aclResource="Some_Module::default">

see example in magento

I see that the same attribute is also used in blocks inside ui_components like following :

<uiComponent name="notification_area" aclResource="Magento_AdminNotification::show_list"/>

see example in magento

Now by looking at the XSD file of layout for block handle I see acl and aclResource for the block type

    <xs:complexType name="blockType" mixed="true">
        <xs:attribute type="elementNameType" name="name" use="optional"/>
        <xs:attribute type="blockClassType" name="class" use="optional"/>
        <xs:attribute type="elementAliasType" name="as" use="optional"/>
        <xs:attribute type="xs:string" name="template" use="optional"/>
        <xs:attribute type="elementPositionType" name="before" use="optional"/>
        <xs:attribute type="elementPositionType" name="after" use="optional"/>
        <xs:attribute type="elementOutputType" name="output" use="optional"/>
        <xs:attribute type="xs:string" name="acl" use="optional"/> <!-- here -->
        <xs:attribute type="xs:string" name="aclResource" use="optional"/>
        <xs:attribute type="xs:string" name="ifconfig" use="optional"/>
        <xs:attribute type="xs:string" name="group" use="optional" />
        <xs:attribute type="xs:boolean" name="cacheable" default="true" use="optional"/>
        <xs:attribute type="xs:int" name="ttl" use="optional"/>

by searching in magento core for usages of acl=" in blocks but only in customer_form.xml which is a form ui component.

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <htmlContent name="orders_content">
        <block acl="Magento_Sales::actions_view" class="Magento\Sales\Block\Adminhtml\CustomerOrdersTab" name="orders" />
    <htmlContent name="cart_content">
        <block acl="Magento_Cart::manage" class="Magento\Sales\Block\Adminhtml\ShoppingCartsTab" name="cart"/>

All that said, my question(s) is : does acl and aclResource do the same ? is there any rule or best practice to use one above the other ? is acl deprecated ?

1 Answer 1


Finally, minutes after posting the question I found out that :

    const ATTRIBUTE_ACL = 'aclResource';
     * @deprecated 101.0.0
     * @var string
    private $deprecatedAttributeAcl = 'acl';


     * Replaces old ACL attribute key to new.
     * @param array|Element $data
     * @return array|Element
    private function replaceDeprecatedAclKey($data)
        if (isset($data[$this->deprecatedAttributeAcl])) {
            $data[self::ATTRIBUTE_ACL] = (string)$data[$this->deprecatedAttributeAcl];

        return $data;

So in conclusion only aclResouce should be used in block to stay future proof.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.