/** * Populate ACL with rules from external storage. * * @param Magento_Acl $acl */ public function populateAcl(Magento_Acl $acl) { $ruleList = $this->_ruleResource->getRuleList(); foreach ($ruleList as $rule) { $role = $rule['role_id']; $resource = $rule['resource_id']; if ($acl->hasRole($role) && $acl->has($resource)) { $acl->allow($role, $resource); } } }
/** * Populate ACL with rules from external storage * * @param Magento_Acl $acl */ public function populateAcl(Magento_Acl $acl) { $ruleTable = $this->_resource->getTableName("admin_rule"); $adapter = $this->_resource->getConnection('read'); $select = $adapter->select()->from(array('r' => $ruleTable)); $rulesArr = $adapter->fetchAll($select); foreach ($rulesArr as $rule) { $role = $rule['role_type'] . $rule['role_id']; $resource = $rule['resource_id']; $privileges = !empty($rule['privileges']) ? explode(',', $rule['privileges']) : null; if ($rule['permission'] == 'allow') { if ($resource === Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL) { $acl->allow($role, null, $privileges); } $acl->allow($role, $resource, $privileges); } else { if ($rule['permission'] == 'deny') { $acl->deny($role, $resource, $privileges); } } } }