magento 后台 创建导航菜单并设置权限

1. 创建导航菜单    模块配置文件    <adminhtml></adminhtml> 下

    <menu>
            <topmeau>
                <title>title</title>
                <sort_order>200</sort_order>
                <children>
                <uploadposters translate="title" module="topmeau">
                    <title>添加海报文案</title>
                    <action>uploadposters/adminhtml_index/index</action>
                    <sort_order>0</sort_order>
                </uploadposters>
                </children>
            </topmeau>

    </menu>

2.设置权限    <adminhtml></adminhtml> 下

    <acl>
    <resources>
    <admin>
    <children>
    <topmeau translate="title" module="topmeau">
                    <title>aaa</title>
                    <sort_order>110</sort_order>
                    <children>
                    <uploadposters>
                    <title>添加海报文案</title>
                    <sort_order>0</sort_order>
                    </uploadposters>
                    </children>
                    </topmeau>
    </children>
    </admin>
    </resources>

    </acl>

    在后台控制器加入以下方法:

    protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('topmeau/uploadposters');//从顶级菜单开始一直到当前菜单
    }

    

猜你喜欢

转载自blog.csdn.net/Gx422954766/article/details/80577307