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

What does it mean that physics no longer uses mechanical models to describe phenomena?

GDP with Intermediate Production

Universal covering space of the real projective line?

Does the Black Tentacles spell do damage twice at the start of turn to an already restrained creature?

Why is the change of basis formula counter-intuitive? [See details]

How much damage would a cupful of neutron star matter do to the Earth?

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

What is the origin of 落第?

If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?

Tips to organize LaTeX presentations for a semester

"klopfte jemand" or "jemand klopfte"?

Google .dev domain strangely redirects to https

How many time has Arya actually used Needle?

The Nth Gryphon Number

Caught masturbating at work

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

The test team as an enemy of development? And how can this be avoided?

Would color changing eyes affect vision?

Simple Http Server

What does Turing mean by this statement?

How does light 'choose' between wave and particle behaviour?

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

Moving a wrapfig vertically to encroach partially on a subsection title

Is CEO the "profession" with the most psychopaths?



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?