I have a customer with custom attribute as merchant. I want to let that customer to see only my custom module features.

How can I restrict a user to some custom features ?


Actually I have created custom APIs to buy giftcodes as merchant (customer). I can test these APIs in Magento Swagger UI with customer token. But when I open swagger documentation I can see all custom APIs with that customer token. I am looking a way by which I could show the merchant(customer) only the custom APIs related to giftcode.

There is one custom module responsible for selling giftcodes. How can I create ACL to show a customer

where customer->isMerchant is TRUE

  • use extension attribute for it Nov 25, 2019 at 12:40
  • @AnsarHusain I have added more explanation in question please check. I have already created custom attribute for customer.
    – Ajwad Syed
    Nov 25, 2019 at 12:53

2 Answers 2


If you want to create the custom module ACL: Create file in your module at : app/code/Vendor/Module/etc/acl.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
        <resource id="Magento_Backend::admin">
            <resource id="Vendor_Module::save" title="Module" sortOrder="10" >
                <resource id="Vendor_Module::module" title="Module" sortOrder="0" />

Note: Please make sure to add comman resource id in your admin Controller:

protected function _isAllowed()
  return $this->_authorization->isAllowed('Vendor_Module::save');

This will create a New Permissions in admin=> System =>Roles/Permission section.

For more information refer this link: https://www.mageplaza.com/magento-2-module-development/magento-2-acl-access-control-lists.html

  • I'm afraid this applies only to admin users, not store front customers Apr 9, 2021 at 12:37

This is a Magento Commerce feature https://devdocs.magento.com/guides/v2.4/b2b/roles.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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