2

I'v tried to add a new section to Store -> Config -> Catalog Section -> Catalog with custom ACL settings.

I changed (default) adminrole permissions from "All" to "Custom" and left only the new option unchecked.

Expected:

  • new group does not appear

Result:

  • whole Catalog Section disappears

system.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
  <system>
    <section id="catalog">
      <resource>StackExchange_LockAttributes::configuration</resource>
      <group id="backend" translate="label" sortOrder="9999" showInDefault="1" showInWebsite="1" showInStore="1">
        <label>Product Attribute Settings</label>
        <field id="lock_attributes" translate="label tooltip comment" sortOrder="10" type="multiselect" showInDefault="1" showInWebsite="1" showInStore="1">
          <label>Locked Attributes</label>
          <comment>Product attributes that can't be edited.</comment>
          <source_model>StackExchange\LockAttributes\Model\System\Config\Source\Product\Attributes\Frontend</source_model>
          <can_be_empty>1</can_be_empty>
        </field>
      </group>
    </section>
  </system>
</config>

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">
<acl>
  <resources>
    <resource id="Magento_Backend::admin">
      <resource id="Magento_Backend::stores">
        <resource id="Magento_Backend::stores_settings">
          <resource id="Magento_Config::config">
            <resource id="Magento_Catalog::config_catalog">
              <resource id="StackExchange_LockAttributes::configuration" title="Edit Locked Attributes Section" translate="title" sortOrder="100"/>
            </resource>
          </resource>
        </resource>
      </resource>
    </resource>
  </resources>
</acl>
</config>

helper ...

public function isAllowed()
{
    return $this->authorization->isAllowed('StackExchange_LockAttributes::configuration');
}

Extension works ... only config section makes trouble.

What's wrong with my code?


Btw ... i've played arround with CatalogSearch ACL role and it seems it has no effect at all. If I uncheck ACL role, system config for CatalogSearch should not be visiable, but it's still there,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.