Magento自定义模块管理员权限

Jos*_*ton 3 magento

我为Magento创建了一些自定义模块,当我尝试为模块分配权限时(选中复选框),当我单击"保存"时,取消选中该框.

有人有主意吗?听起来有点像我的config.xml文件中的内容,所以我会在这里发布以防万一:

<config>
<modules>
    <Wpe_Vendorlist>
        <version>0.1.0</version>
    </Wpe_Vendorlist>
</modules>
<admin>
    <routers>
        <vendorlist>
            <use>admin</use>
            <args>
                <module>Wpe_Vendorlist</module>
                <frontName>vendorlist</frontName>
            </args>
        </vendorlist>
    </routers>
</admin>
<adminhtml>
    <menu>
        <customer>
            <children>
                <items module="vendorlist">
                    <title>SO Vendor List</title>
                    <sort_order>999</sort_order>
                    <action>vendorlist/adminhtml_vendorlist</action>
                </items>
            </children>
        </customer>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <Wpe_Vendorlist>
                        <title>Vendorlist Module</title>
                        <sort_order>10</sort_order>
                    </Wpe_Vendorlist>
                </children>
            </admin>
        </resources>
    </acl>
    <layout>
        <updates>
            <vendorlist>
                <file>vendorlist.xml</file>
            </vendorlist>
        </updates>
    </layout>
</adminhtml>
<global>
    <models>
        <vendorlist>
            <class>Wpe_Vendorlist_Model</class>
            <resourceModel>vendorlist_mysql4</resourceModel>
        </vendorlist>
        <vendorlist_mysql4>
            <class>Wpe_Vendorlist_Model_Mysql4</class>
            <entities>
                <vendorlist>
                    <table>vendorlist</table>
                </vendorlist>
            </entities>
        </vendorlist_mysql4>
    </models>
    <resources>
        <vendorlist_setup>
            <setup>
                <module>Wpe_Vendorlist</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </vendorlist_setup>
        <vendorlist_write>
            <connection>
                <use>core_write</use>
            </connection>
        </vendorlist_write>
        <vendorlist_read>
            <connection>
                <use>core_read</use>
            </connection>
        </vendorlist_read>
    </resources>
    <blocks>
        <vendorlist>
            <class>Wpe_Vendorlist_Block</class>
        </vendorlist>
    </blocks>
    <helpers>
        <vendorlist>
            <class>Wpe_Vendorlist_Helper</class>
        </vendorlist>
    </helpers>
</global>
</config>
Run Code Online (Sandbox Code Playgroud)

OSd*_*ave 5

我强烈建议你看一下Alan Storm关于系统配置的文章,以及他的其他系列,这是我发现的有关magento编程的最佳信息.

对于这个特殊的问题,以下是我在模块中使用您的模块名称完成的方法:

<acl><!-- permits -->
    <resources>
        <admin>
            <children>
                <customer translate="title" module="vendorlist"><!-- this tag matches the menu tag, and the same for his children -->
                    <title>what will appears in the checkboxes tree when you create a role</title>
                    <children>
                        <firstchild>
                            <title>what will appears in the checkboxes tree when you create a role</title>
                        </firstchild>
                    </children>
                </customer>
            </children>
        </admin>
    </resources>
</acl>
Run Code Online (Sandbox Code Playgroud)

你不需要:

                <children>
                    <firstchild>
                        <title>what will appears in the checkboxes tree when you create a role</title>
                    </firstchild>
                </children>
Run Code Online (Sandbox Code Playgroud)

因为你的模块里没有孩子,看来,我只是把它作为一个例子.
我希望这有帮助