Magento 2 acl.xml 用法解析

本文内容来自QQ群大佬陈伟明(一叶知秋)的学习分享

 

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">//这是进入到业务数据处理菜单的资源
                <!--<resource id="Magento_Backend::content">-->
                <resource id="Silk_Test::job_head" title="Test" sortOrder="100" >
                    <resource id="Silk_Test::department" title="Departments" sortOrder="10">
                        <resource id="Silk_Test::department_save" title="Save Department" sortOrder="10" />
                        <resource id="Silk_Test::department_delete" title="Delete Department" sortOrder="20" />
                    </resource>
                    <resource id="Silk_Test::job" title="Test" sortOrder="20">
                        <resource id="Silk_Test::job_save" title="Save Job" sortOrder="10" />
                        <resource id="Silk_Test::job_delete" title="Delete Job" sortOrder="20" />
                    </resource>
                </resource>
                <!--</resource>-->

                <!-- Admin config -->
                <resource id="Magento_Backend::stores"> //这里进到入业务功能配置的菜单资源
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Silk_Test::test" title="Test Section" />
                        </resource>
                    </resource>
                </resource>

            </resource>
        </resources>
    </acl>
</config>

 

配置完成后,清缓存,去后台查看是否生效

:System > Permissions > User roles;

 

【腾讯云】境外1核2G服务器低至2折,半价续费券限量免费领取!
【腾讯云】618采购季来袭!爆款云服务器18元起,参与活动享多重好礼

发表评论