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

Getting out of while loop on console

What would you call this weird metallic apparatus that allows you to lift people?

Nose gear failure in single prop aircraft: belly landing or nose-gear up landing?

Co-worker has annoying ringtone

Is CEO the "profession" with the most psychopaths?

One-one communication

Is there hard evidence that the grant peer review system performs significantly better than random?

How to write capital alpha?

How can I save and copy a screenhot at the same time?

NERDTreeMenu Remapping

How can a team of shapeshifters communicate?

What is the difference between a "ranged attack" and a "ranged weapon attack"?

What are the main differences between Stargate SG-1 cuts?

Printing attributes of selection in ArcPy?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Can an iPhone 7 be made to function as a NFC Tag?

Relating to the President and obstruction, were Mueller's conclusions preordained?

How to ask rejected full-time candidates to apply to teach individual courses?

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

Trying to understand entropy as a novice in thermodynamics

Is multiple magic items in one inherently imbalanced?

Caught masturbating at work

Random body shuffle every night—can we still function?

Moving a wrapfig vertically to encroach partially on a subsection title



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
    2 days ago











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

    – Mohit Kumar Arora
    yesterday











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

    – sv3n
    yesterday


















-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
    2 days ago











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

    – Mohit Kumar Arora
    yesterday











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

    – sv3n
    yesterday














-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 2 days ago









Sudhanshu Bajaj

172




172










asked 2 days ago









Mohit Kumar AroraMohit Kumar Arora

6,89351634




6,89351634












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

    – Mohit Kumar Arora
    2 days ago











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

    – Mohit Kumar Arora
    yesterday











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

    – sv3n
    yesterday


















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

    – Mohit Kumar Arora
    2 days ago











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

    – Mohit Kumar Arora
    yesterday











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

    – sv3n
    yesterday

















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

– Mohit Kumar Arora
2 days ago





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

– Mohit Kumar Arora
2 days ago













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

– Mohit Kumar Arora
yesterday





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

– Mohit Kumar Arora
yesterday













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

– sv3n
yesterday






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

– sv3n
yesterday











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
    2 days ago











  • 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
    yesterday











  • 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
    yesterday











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
    2 days ago











  • 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
    yesterday











  • 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
    yesterday















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
    2 days ago











  • 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
    yesterday











  • 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
    yesterday













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 2 days ago

























answered 2 days ago









melaxonmelaxon

906




906












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

    – Mohit Kumar Arora
    2 days ago











  • 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
    yesterday











  • 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
    yesterday

















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

    – Mohit Kumar Arora
    2 days ago











  • 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
    yesterday











  • 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
    yesterday
















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

– Mohit Kumar Arora
2 days ago





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

– Mohit Kumar Arora
2 days ago













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
yesterday





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
yesterday













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
yesterday





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
yesterday

















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

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?