1

I have a module that updates the amin menu by inserting a submenu called "Relatórios Personalizados" in the reports menu.

I set the role permissions for the user named "Luciano", however the menu is not visible to him.

But when I'm as admin, the menu is visible.

The role definition The role definition

The user definition enter image description here

Logged as user enter image description here

Logged as admin enter image description here

My folder structure

enter image description here

In my controller

protected function _isAllowed()
{
    return true;
}

My adminhtml.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <menu>
    <report>
        <children>
            <customreport translate="title" module="vitali_customreport">
                <title>Relatorios Personalizados</title>
                <sort_order>5000</sort_order>
                <children>
                    <sales module="vitali_customreport" translate="title">
                        <title>Vendas</title>
                        <sort_order>1</sort_order>
                        <action>adminhtml/customreport/sales</action>
                    </sales>
                    <salesbyattrset module="vitali_customreport" translate="title">
                        <title>Vendas por Tipo de Produto</title>
                        <sort_order>1</sort_order>
                        <action>adminhtml/customreport/salesbyattrset</action>
                    </salesbyattrset>
                    <productsold module="vitali_customreport" translate="title">
                        <title>Produtos Comprados</title>
                        <sort_order>2</sort_order>
                        <action>adminhtml/customreport/productsold</action>
                    </productsold>
                    <treatment module="vitali_customreport" translate="title">
                        <title>Tempo de Tratamento</title>
                        <sort_order>3</sort_order>
                        <action>adminhtml/customreport/treatment</action>
                    </treatment>
                </children>
            </customreport>
        </children>
    </report>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <customreport translate="title" module="vitali_customreport">
                    <title>Relatórios Personalizados</title>
                    <sort_order>-100</sort_order>
                    <children>
                        <sales translate="title" module="vitali_customreport">
                            <title>Vendas</title>
                            <sort_order>1</sort_order>
                        </sales>
                        <salesbyattrset translate="title" module="vitali_customreport">
                            <title>Vendas por Tipo de Produto</title>
                            <sort_order>1</sort_order>
                        </salesbyattrset>
                        <productsold translate="title" module="vitali_customreport">
                            <title>Produtos Comprados</title>
                            <sort_order>2</sort_order>
                        </productsold>
                        <treatment translate="title" module="vitali_customreport">
                            <title>Tempo de Tratamento</title>
                            <sort_order>3</sort_order>
                        </treatment>
                    </children>
                </customreport>
            </children>
        </admin>
    </resources>
</acl>

3
  • did luciano log out and log in again?
    – Marius
    Nov 18, 2016 at 13:31
  • @Marius yes, I logged in anonimous tab chrome after clear all caches in magento. Nov 18, 2016 at 13:41
  • @Marius I found the solution following the idea suggested by QaisarSatti that the error was in the ACL block xml. Thanks for your attemption, and I posted the answer Nov 18, 2016 at 14:21

2 Answers 2

0

<sort_order>-100</sort_order> mismatched <sort_order>5000</sort_order>

also action missing in acl

<action>adminhtml/customreport/treatment</action>

replace acl with

<acl>
    <resources>
        <admin>
            <children>
                <customreport translate="title" module="vitali_customreport">
                <title>Relatorios Personalizados</title>
                <sort_order>5000</sort_order>
                <children>
                    <sales module="vitali_customreport" translate="title">
                        <title>Vendas</title>
                        <sort_order>1</sort_order>
                        <action>adminhtml/customreport/sales</action>
                    </sales>
                    <salesbyattrset module="vitali_customreport" translate="title">
                        <title>Vendas por Tipo de Produto</title>
                        <sort_order>1</sort_order>
                        <action>adminhtml/customreport/salesbyattrset</action>
                    </salesbyattrset>
                    <productsold module="vitali_customreport" translate="title">
                        <title>Produtos Comprados</title>
                        <sort_order>2</sort_order>
                        <action>adminhtml/customreport/productsold</action>
                    </productsold>
                    <treatment module="vitali_customreport" translate="title">
                        <title>Tempo de Tratamento</title>
                        <sort_order>3</sort_order>
                        <action>adminhtml/customreport/treatment</action>
                    </treatment>
                </children>
              </customreport>
            </children>
        </admin>
    </resources>
</acl>
4
  • 1
    sort order has nothing to do with it and the acl section should not contain actions. take a look at this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…
    – Marius
    Nov 18, 2016 at 13:39
  • @Qaisar Satti Thanks for yor answer, I have modified the xml like your suggestion, but still not working Nov 18, 2016 at 13:39
  • @Marius i faced the problem one time it solved for me Nov 18, 2016 at 13:41
  • @QaisarSatti I found the solution following the idea that the error was in the ACL block xml. Thanks for your attemption, and I posted the answer Nov 18, 2016 at 14:19
0

Thanks for answer, I found the solution, the problem was that the ACL did not contain the part of the reports session, so I updated the xml to contain this information:

<acl>
    <resources>
        <admin>
            <children>
                <!-- start fix-->
                <report>
                    <children>
                    ...
                    </children>
                </report>
                <!-- end fix-->
            </children>
        </admin>
    </resources>
</acl>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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