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
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>
-
did luciano log out and log in again?Marius– Marius2016年11月18日 13:31:25 +00:00Commented Nov 18, 2016 at 13:31
-
@Marius yes, I logged in anonimous tab chrome after clear all caches in magento.Vinícius Medeiros– Vinícius Medeiros2016年11月18日 13:41:07 +00:00Commented 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 answerVinícius Medeiros– Vinícius Medeiros2016年11月18日 14:21:34 +00:00Commented Nov 18, 2016 at 14:21
2 Answers 2
<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>
-
1sort 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– Marius2016年11月18日 13:39:00 +00:00Commented Nov 18, 2016 at 13:39
-
@Qaisar Satti Thanks for yor answer, I have modified the xml like your suggestion, but still not workingVinícius Medeiros– Vinícius Medeiros2016年11月18日 13:39:10 +00:00Commented Nov 18, 2016 at 13:39
-
@Marius i faced the problem one time it solved for meQaisar Satti– Qaisar Satti2016年11月18日 13:41:15 +00:00Commented 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 answerVinícius Medeiros– Vinícius Medeiros2016年11月18日 14:19:42 +00:00Commented Nov 18, 2016 at 14:19
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>
Explore related questions
See similar questions with these tags.