Magento 2: Override ACL using custom module Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Custom module: Access denied (ACL Problem)How to add acl in custom module in magentoCustom extension's custom menu item not showing up on one serverMy custom module routers and acl problemACL for Front End ModuleMagento 2 Why my admin route always redirect to the Dashboard?Magento 2: ACL Permission for Admin ModuleMagento 2 custom Admin controller redirect to DashboardMagento 2 ACL rule move from one db to anotherMagento 2.2.3- ACL Permissions not Working for Customer module

How to mute a string and play another at the same time

Does GDPR cover the collection of data by websites that crawl the web and resell user data

Can a Knight grant Knighthood to another?

Why did Israel vote against lifting the American embargo on Cuba?

Compiling and throwing simple dynamic exceptions at runtime for JVM

Pointing to problems without suggesting solutions

How is an IPA symbol that lacks a name (e.g. ɲ) called?

Is there a way to convert Wolfram Language expression to string?

Can I take recommendation from someone I met at a conference?

Married in secret, can marital status in passport be changed at a later date?

Trying to enter the Fox's den

Coin Game with infinite paradox

What is the evidence that custom checks in Northern Ireland are going to result in violence?

How to leave only the following strings?

When speaking, how do you change your mind mid-sentence?

Why aren't these two solutions equivalent? Combinatorics problem

What were wait-states, and why was it only an issue for PCs?

Is my guitar’s action too high?

Can this water damage be explained by lack of gutters and grading issues?

Do chord progressions usually move by fifths?

Network questions

Can Deduction Guide have an explicit(bool) specifier?

Why these surprising proportionalities of integrals involving odd zeta values?

Can I ask an author to send me his ebook?



Magento 2: Override ACL using custom module



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Custom module: Access denied (ACL Problem)How to add acl in custom module in magentoCustom extension's custom menu item not showing up on one serverMy custom module routers and acl problemACL for Front End ModuleMagento 2 Why my admin route always redirect to the Dashboard?Magento 2: ACL Permission for Admin ModuleMagento 2 custom Admin controller redirect to DashboardMagento 2 ACL rule move from one db to anotherMagento 2.2.3- ACL Permissions not Working for Customer module



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-3















I have updated the parent of a menu item which is coming from a third party extension. I have updated the menu item by my custom module's menu.xml file.



For instance, the menu was coming under Marketing >> Promotions >> Gift Card History. I have changed the menu position to Reports >> Others >> Gift Card Accounting by using the following code:



<update id="Magestore_Giftvoucher::gifthistory" title="Gift Cards Accounting" sortOrder="40" parent="Stream_ChangeCoreMenuPosition::others"/>


Since the parent of the menu item has been changed, now I need to modify the ACL of this item also.



For this, I don't want to make changes in the extension's acl.xml file. So I have created my own acl.xml in my custom module, but when I add the ACL entry for the modified menu position, I get the following error:



ACL Error



Please help me, how can I modify the ACL of the extension using my custom module (without modifying the extension's files).










share|improve this question
























  • Why and who downvoted this question? This is neither a duplicate nor a spam.

    – Mohit Kumar Arora
    Apr 18 at 9:32











  • At least let me know the reason for continuous downvoting on the question.

    – Mohit Kumar Arora
    Apr 19 at 12:28











  • Dont know why ... maybe add some code from your acl.xml? However .... +1

    – sv3n
    Apr 19 at 13:52


















-3















I have updated the parent of a menu item which is coming from a third party extension. I have updated the menu item by my custom module's menu.xml file.



For instance, the menu was coming under Marketing >> Promotions >> Gift Card History. I have changed the menu position to Reports >> Others >> Gift Card Accounting by using the following code:



<update id="Magestore_Giftvoucher::gifthistory" title="Gift Cards Accounting" sortOrder="40" parent="Stream_ChangeCoreMenuPosition::others"/>


Since the parent of the menu item has been changed, now I need to modify the ACL of this item also.



For this, I don't want to make changes in the extension's acl.xml file. So I have created my own acl.xml in my custom module, but when I add the ACL entry for the modified menu position, I get the following error:



ACL Error



Please help me, how can I modify the ACL of the extension using my custom module (without modifying the extension's files).










share|improve this question
























  • Why and who downvoted this question? This is neither a duplicate nor a spam.

    – Mohit Kumar Arora
    Apr 18 at 9:32











  • At least let me know the reason for continuous downvoting on the question.

    – Mohit Kumar Arora
    Apr 19 at 12:28











  • Dont know why ... maybe add some code from your acl.xml? However .... +1

    – sv3n
    Apr 19 at 13:52














-3












-3








-3








I have updated the parent of a menu item which is coming from a third party extension. I have updated the menu item by my custom module's menu.xml file.



For instance, the menu was coming under Marketing >> Promotions >> Gift Card History. I have changed the menu position to Reports >> Others >> Gift Card Accounting by using the following code:



<update id="Magestore_Giftvoucher::gifthistory" title="Gift Cards Accounting" sortOrder="40" parent="Stream_ChangeCoreMenuPosition::others"/>


Since the parent of the menu item has been changed, now I need to modify the ACL of this item also.



For this, I don't want to make changes in the extension's acl.xml file. So I have created my own acl.xml in my custom module, but when I add the ACL entry for the modified menu position, I get the following error:



ACL Error



Please help me, how can I modify the ACL of the extension using my custom module (without modifying the extension's files).










share|improve this question
















I have updated the parent of a menu item which is coming from a third party extension. I have updated the menu item by my custom module's menu.xml file.



For instance, the menu was coming under Marketing >> Promotions >> Gift Card History. I have changed the menu position to Reports >> Others >> Gift Card Accounting by using the following code:



<update id="Magestore_Giftvoucher::gifthistory" title="Gift Cards Accounting" sortOrder="40" parent="Stream_ChangeCoreMenuPosition::others"/>


Since the parent of the menu item has been changed, now I need to modify the ACL of this item also.



For this, I don't want to make changes in the extension's acl.xml file. So I have created my own acl.xml in my custom module, but when I add the ACL entry for the modified menu position, I get the following error:



ACL Error



Please help me, how can I modify the ACL of the extension using my custom module (without modifying the extension's files).







magento2 magento2.2 acl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 18 at 8:06









Sudhanshu Bajaj

232




232










asked Apr 18 at 7:42









Mohit Kumar AroraMohit Kumar Arora

6,89851634




6,89851634












  • Why and who downvoted this question? This is neither a duplicate nor a spam.

    – Mohit Kumar Arora
    Apr 18 at 9:32











  • At least let me know the reason for continuous downvoting on the question.

    – Mohit Kumar Arora
    Apr 19 at 12:28











  • Dont know why ... maybe add some code from your acl.xml? However .... +1

    – sv3n
    Apr 19 at 13:52


















  • Why and who downvoted this question? This is neither a duplicate nor a spam.

    – Mohit Kumar Arora
    Apr 18 at 9:32











  • At least let me know the reason for continuous downvoting on the question.

    – Mohit Kumar Arora
    Apr 19 at 12:28











  • Dont know why ... maybe add some code from your acl.xml? However .... +1

    – sv3n
    Apr 19 at 13:52

















Why and who downvoted this question? This is neither a duplicate nor a spam.

– Mohit Kumar Arora
Apr 18 at 9:32





Why and who downvoted this question? This is neither a duplicate nor a spam.

– Mohit Kumar Arora
Apr 18 at 9:32













At least let me know the reason for continuous downvoting on the question.

– Mohit Kumar Arora
Apr 19 at 12:28





At least let me know the reason for continuous downvoting on the question.

– Mohit Kumar Arora
Apr 19 at 12:28













Dont know why ... maybe add some code from your acl.xml? However .... +1

– sv3n
Apr 19 at 13:52






Dont know why ... maybe add some code from your acl.xml? However .... +1

– sv3n
Apr 19 at 13:52











1 Answer
1






active

oldest

votes


















2














you need to create a plugin to disable the existing ACL record first



In di.xml



<!-- remove existing record from ACL --> 
<type name="MagentoIntegrationHelperData">
<plugin name="my-acl-data" type="VendorNameModuleNamePluginIntegrationData" sortOrder="100" />
</type>


VendorNameModuleNamePluginIntegrationData.php



namespace VendorNameModuleNamePluginIntegration;

class Data

public function beforeMapResources(MagentoIntegrationHelperData $helper, array $resources)

$removed = $this->getIdsToRemove();
foreach ($resources as $key => $resource)
if (in_array($resource['id'], $removed))
unset($resources[$key]);


return [$resources];

private function getIdsToRemove()

return [
'Magestore_Giftvoucher::gifthistory',
];




This will remove Magestore_Giftvoucher::gifthistory



Then add your own records in acl.xml : VendorName_ModuleName::yourRecord






share|improve this answer

























  • Okay, thanks @melaxon. I will check and will get back to you soon.

    – Mohit Kumar Arora
    Apr 18 at 11:56











  • Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

    – Mohit Kumar Arora
    Apr 19 at 13:06











  • e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

    – melaxon
    Apr 19 at 20:19











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270596%2fmagento-2-override-acl-using-custom-module%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














you need to create a plugin to disable the existing ACL record first



In di.xml



<!-- remove existing record from ACL --> 
<type name="MagentoIntegrationHelperData">
<plugin name="my-acl-data" type="VendorNameModuleNamePluginIntegrationData" sortOrder="100" />
</type>


VendorNameModuleNamePluginIntegrationData.php



namespace VendorNameModuleNamePluginIntegration;

class Data

public function beforeMapResources(MagentoIntegrationHelperData $helper, array $resources)

$removed = $this->getIdsToRemove();
foreach ($resources as $key => $resource)
if (in_array($resource['id'], $removed))
unset($resources[$key]);


return [$resources];

private function getIdsToRemove()

return [
'Magestore_Giftvoucher::gifthistory',
];




This will remove Magestore_Giftvoucher::gifthistory



Then add your own records in acl.xml : VendorName_ModuleName::yourRecord






share|improve this answer

























  • Okay, thanks @melaxon. I will check and will get back to you soon.

    – Mohit Kumar Arora
    Apr 18 at 11:56











  • Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

    – Mohit Kumar Arora
    Apr 19 at 13:06











  • e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

    – melaxon
    Apr 19 at 20:19















2














you need to create a plugin to disable the existing ACL record first



In di.xml



<!-- remove existing record from ACL --> 
<type name="MagentoIntegrationHelperData">
<plugin name="my-acl-data" type="VendorNameModuleNamePluginIntegrationData" sortOrder="100" />
</type>


VendorNameModuleNamePluginIntegrationData.php



namespace VendorNameModuleNamePluginIntegration;

class Data

public function beforeMapResources(MagentoIntegrationHelperData $helper, array $resources)

$removed = $this->getIdsToRemove();
foreach ($resources as $key => $resource)
if (in_array($resource['id'], $removed))
unset($resources[$key]);


return [$resources];

private function getIdsToRemove()

return [
'Magestore_Giftvoucher::gifthistory',
];




This will remove Magestore_Giftvoucher::gifthistory



Then add your own records in acl.xml : VendorName_ModuleName::yourRecord






share|improve this answer

























  • Okay, thanks @melaxon. I will check and will get back to you soon.

    – Mohit Kumar Arora
    Apr 18 at 11:56











  • Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

    – Mohit Kumar Arora
    Apr 19 at 13:06











  • e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

    – melaxon
    Apr 19 at 20:19













2












2








2







you need to create a plugin to disable the existing ACL record first



In di.xml



<!-- remove existing record from ACL --> 
<type name="MagentoIntegrationHelperData">
<plugin name="my-acl-data" type="VendorNameModuleNamePluginIntegrationData" sortOrder="100" />
</type>


VendorNameModuleNamePluginIntegrationData.php



namespace VendorNameModuleNamePluginIntegration;

class Data

public function beforeMapResources(MagentoIntegrationHelperData $helper, array $resources)

$removed = $this->getIdsToRemove();
foreach ($resources as $key => $resource)
if (in_array($resource['id'], $removed))
unset($resources[$key]);


return [$resources];

private function getIdsToRemove()

return [
'Magestore_Giftvoucher::gifthistory',
];




This will remove Magestore_Giftvoucher::gifthistory



Then add your own records in acl.xml : VendorName_ModuleName::yourRecord






share|improve this answer















you need to create a plugin to disable the existing ACL record first



In di.xml



<!-- remove existing record from ACL --> 
<type name="MagentoIntegrationHelperData">
<plugin name="my-acl-data" type="VendorNameModuleNamePluginIntegrationData" sortOrder="100" />
</type>


VendorNameModuleNamePluginIntegrationData.php



namespace VendorNameModuleNamePluginIntegration;

class Data

public function beforeMapResources(MagentoIntegrationHelperData $helper, array $resources)

$removed = $this->getIdsToRemove();
foreach ($resources as $key => $resource)
if (in_array($resource['id'], $removed))
unset($resources[$key]);


return [$resources];

private function getIdsToRemove()

return [
'Magestore_Giftvoucher::gifthistory',
];




This will remove Magestore_Giftvoucher::gifthistory



Then add your own records in acl.xml : VendorName_ModuleName::yourRecord







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 18 at 11:37

























answered Apr 18 at 11:32









melaxonmelaxon

906




906












  • Okay, thanks @melaxon. I will check and will get back to you soon.

    – Mohit Kumar Arora
    Apr 18 at 11:56











  • Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

    – Mohit Kumar Arora
    Apr 19 at 13:06











  • e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

    – melaxon
    Apr 19 at 20:19

















  • Okay, thanks @melaxon. I will check and will get back to you soon.

    – Mohit Kumar Arora
    Apr 18 at 11:56











  • Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

    – Mohit Kumar Arora
    Apr 19 at 13:06











  • e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

    – melaxon
    Apr 19 at 20:19
















Okay, thanks @melaxon. I will check and will get back to you soon.

– Mohit Kumar Arora
Apr 18 at 11:56





Okay, thanks @melaxon. I will check and will get back to you soon.

– Mohit Kumar Arora
Apr 18 at 11:56













Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

– Mohit Kumar Arora
Apr 19 at 13:06





Great @melaxon, it worked for me. But for that, I had to add the menu item instead of updating the existing one. Also, need to override/pluginize the controller also.

– Mohit Kumar Arora
Apr 19 at 13:06













e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

– melaxon
Apr 19 at 20:19





e.g. im menu.xml <add id="NewVendor_NewModule::some_id" title="My new item" translate="title" module="NewVendor_NewModule" sortOrder="1" parent="Another_Module::another_item" action="some_action/blah_blah" resource="NewVendor_NewModule::something_manage"/> The best way imho is to search through existing Magento modules for some examples that look like yours and can inspire your

– melaxon
Apr 19 at 20:19

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270596%2fmagento-2-override-acl-using-custom-module%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Sum ergo cogito? 1 nng

419 nièngy_Soadمي 19bal1.5o_g

Queiggey Chernihivv 9NnOo i Zw X QqKk LpB