/** * Fetch array of allowed attributes for given resource type, operation and user type. * * @param string $operationType OPTIONAL One of Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_... constant * @return array */ public function getAllowedAttributes($operationType = null) { if (null === $this->_allowedAttributes) { /** @var $helper Mage_Api2_Helper_Data */ $helper = Mage::helper('api2/data'); if (null === $operationType) { $operationType = $helper->getTypeOfOperation($this->_resource->getOperation()); } if ($helper->isAllAttributesAllowed($this->_resource->getUserType())) { $this->_allowedAttributes = array_keys($this->_resource->getAvailableAttributes($this->_resource->getUserType(), $operationType)); } else { $this->_allowedAttributes = $helper->getAllowedAttributes($this->_resource->getUserType(), $this->_resource->getResourceType(), $operationType); } // force attributes to be no filtered foreach ($this->_resource->getForcedAttributes() as $forcedAttr) { if (!in_array($forcedAttr, $this->_allowedAttributes)) { $this->_allowedAttributes[] = $forcedAttr; } } } return $this->_allowedAttributes; }