Permalink
Browse files

Update as of 8/1/2012

* Refactored ACL for the backend
  * ACL resources
    * Strict configuration format, validated by XSD schema
    * ACL configuration relocation from `app/code/<pool>/<namespace>/<module>/etc/adminhtml.xml` to `app/code/<pool>/<namespace>/<module>/etc/adminhtml/acl.xml`
    * Renamed ACL resource identifiers according to the format `<namespace>_<module>::<resource>` throughout the system
      * Backend menu configuration requires to specify ACL resource identifier in the new format
      * Explicit declaration of ACL resources in `app/code/<pool>/<namespace>/<module>/etc/system.xml` instead of implicit relation by XPath
    * Migration tool `dev/tools/migration/acl.php` to convert ACL configuration from 1.x to 2.x
  * Declaration of ACL resource/role/rule loaders through the area configuration
    * Module `Mage_Backend` declares loader for ACL resources in backend area
    * Module `Mage_User` declares loaders for ACL roles and rules (relations between roles and resources) in backend area
  * Implemented integrity and legacy tests for ACL
* Fixed issues:
  * Losing qty and visibility information when importing products
  * Impossibility to reload captcha on backend
  * Temporary excluded from execution integration test `Mage_Review_Model_Resource_Review_Product_CollectionTest::testGetResultingIds()` and corresponding fixture script, which cause occasional `segmentation fault` (exit code 139)
* Refactored methods with high cyclomatic complexity:
  * `Mage_Adminhtml_Block_System_Store_Edit_Form::_prepareForm()`
  * `Mage_Adminhtml_Block_System_Config_Form::initForm()`
  * `Mage_Adminhtml_Block_System_Config_Form::initFields()`
* GitHub requests:
  * [#32](#32) -- fixed declaration of localization CSV files
  * [#35](#35) -- removed non-used `Mage_Core_Block_Flush` block
  * [#41](#41) -- implemented ability to extends `app/etc/local.xml` by specifying additional config file via `MAGE_LOCAL_CONFIG` environment variable
  • Loading branch information...
1 parent a27835b commit 7fec10a1d6238d8e0058f9907535d98898b7f3d0 @magento-team magento-team committed Aug 2, 2012
Showing 428 changed files with 9,597 additions and 4,140 deletions.
View
@@ -1,3 +1,30 @@
+Update as of 8/1/2012
+=====================
+* Refactored ACL for the backend
+ * ACL resources
+ * Strict configuration format, validated by XSD schema
+ * ACL configuration relocation from `app/code/<pool>/<namespace>/<module>/etc/adminhtml.xml` to `app/code/<pool>/<namespace>/<module>/etc/adminhtml/acl.xml`
+ * Renamed ACL resource identifiers according to the format `<namespace>_<module>::<resource>` throughout the system
+ * Backend menu configuration requires to specify ACL resource identifier in the new format
+ * Explicit declaration of ACL resources in `app/code/<pool>/<namespace>/<module>/etc/system.xml` instead of implicit relation by XPath
+ * Migration tool `dev/tools/migration/acl.php` to convert ACL configuration from 1.x to 2.x
+ * Declaration of ACL resource/role/rule loaders through the area configuration
+ * Module `Mage_Backend` declares loader for ACL resources in backend area
+ * Module `Mage_User` declares loaders for ACL roles and rules (relations between roles and resources) in backend area
+ * Implemented integrity and legacy tests for ACL
+* Fixed issues:
+ * Losing qty and visibility information when importing products
+ * Impossibility to reload captcha on backend
+ * Temporary excluded from execution integration test `Mage_Review_Model_Resource_Review_Product_CollectionTest::testGetResultingIds()` and corresponding fixture script, which cause occasional `segmentation fault` (exit code 139)
+* Refactored methods with high cyclomatic complexity:
+ * `Mage_Adminhtml_Block_System_Store_Edit_Form::_prepareForm()`
+ * `Mage_Adminhtml_Block_System_Config_Form::initForm()`
+ * `Mage_Adminhtml_Block_System_Config_Form::initFields()`
+* GitHub requests:
+ * [#32](https://github.com/magento/magento2/pull/32) -- fixed declaration of localization CSV files
+ * [#35](https://github.com/magento/magento2/issues/35) -- removed non-used `Mage_Core_Block_Flush` block
+ * [#41](https://github.com/magento/magento2/pull/41) -- implemented ability to extends `app/etc/local.xml` by specifying additional config file via `MAGE_LOCAL_CONFIG` environment variable
+
Update as of 7/26/2012
=====================
* Implemented Magento Validator library in order to have clear solid mechanism and formal rules of input data validation
@@ -28,21 +28,13 @@
<config>
<acl>
<resources>
- <admin>
- <children>
- <system>
- <children>
- <config>
- <children>
- <moneybookers translate="title" module="Phoenix_Moneybookers">
- <title>Moneybookers Settings</title>
- </moneybookers>
- </children>
- </config>
- </children>
- </system>
- </children>
- </admin>
+ <resource id="Mage_Adminhtml::admin">
+ <resource id="Mage_Adminhtml::system">
+ <resource id="Mage_Adminhtml::config">
+ <resource id="Phoenix_Moneybookers::moneybookers" module="Phoenix_Moneybookers" title="Moneybookers Settings" />
+ </resource>
+ </resource>
+ </resource>
</resources>
</acl>
</config>
@@ -35,6 +35,7 @@
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
+ <resource>Phoenix_Moneybookers::moneybookers</resource>
<groups>
<settings translate="label">
<label>Moneybookers Settings</label>
@@ -110,221 +110,6 @@ protected function _getHelper($module)
}
/**
- * Load Acl resources from config
- *
- * @param Mage_Admin_Model_Acl $acl
- * @param Mage_Core_Model_Config_Element $resource
- * @param string $parentName
- * @return Mage_Admin_Model_Config
- */
- public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $parentName = null)
- {
- if (is_null($resource)) {
- $resource = $this->getAdminhtmlConfig()->getNode("acl/resources");
- $resourceName = null;
- } else {
- $resourceName = (is_null($parentName) ? '' : $parentName . '/') . $resource->getName();
- $acl->add(Mage::getModel('Mage_Admin_Model_Acl_Resource', $resourceName), $parentName);
- }
-
- if (isset($resource->all)) {
- $acl->add(Mage::getModel('Mage_Admin_Model_Acl_Resource', 'all'), null);
- }
-
- if (isset($resource->admin)) {
- $children = $resource->admin;
- } elseif (isset($resource->children)){
- $children = $resource->children->children();
- }
-
-
-
- if (empty($children)) {
- return $this;
- }
-
- foreach ($children as $res) {
- if (1 == $res->disabled) {
- continue;
- }
- $this->loadAclResources($acl, $res, $resourceName);
- }
- return $this;
- }
-
- /**
- * Retrieve Acl Resource Tree with module and path information
- *
- * @return Varien_Simplexml_Element
- */
- public function getAclResourceTree()
- {
- return $this->_walkResourceTree();
- }
-
- /**
- * Retrieve flat Acl Resource list with level information
- * @param bool $shortFormat
- * @return array
- */
- public function getAclResourceList($shortFormat = false)
- {
- return $this->_flattenResourceTree(null, null, 0, 'Mage_Backend', $shortFormat);
- }
-
- /**
- * Decorate acl resource tree
- *
- * @param Varien_Simplexml_Element $resource
- * @param null $parentName
- * @param string $module
- * @return Varien_Simplexml_Element
- */
- protected function _walkResourceTree(Varien_Simplexml_Element $resource = null,
- $parentName = null, $module = 'Mage_Backend')
- {
- $resourceName = $parentName;
- if (is_null($resource)) {
- $resource = $this->getAdminhtmlConfig()->getNode('acl/resources');
- $resourceName = null;
- $level = -1;
- } else {
- if (!$this->_isServiceElement($resource)) {
- $resourceName = $this->_buildFullResourceName($resource, $parentName);
- //assigning module for its' children nodes
- if ($resource->getAttribute('module')) {
- $module = (string)$resource->getAttribute('module');
-
- }
- $resource->addAttribute('aclpath', $resourceName);
- $resource->addAttribute('module_c', $module);
- }
- }
-
- //check children and run recursion if they exists
- $children = $resource->children();
- foreach ($children as $key => $child) {
- if (1 == $child->disabled) {
- $resource->{$key} = null;
- continue;
- }
- $this->_walkResourceTree($child, $resourceName, $module);
- }
- return $resource;
- }
-
- /**
- * Flatten acl resources tree
- *
- * @param null|Varien_Simplexml_Element $resource
- * @param null $parentName
- * @param int $level
- * @param string $module
- * @param bool $shortFormat
- * @return array
- */
- protected function _flattenResourceTree(Varien_Simplexml_Element $resource = null,
- $parentName = null, $level = 0, $module = 'Mage_Backend', $shortFormat = false)
- {
- $result = array();
- $resourceName = $parentName;
- if (is_null($resource)) {
- $resource = $this->getAdminhtmlConfig()->getNode('acl/resources');
- $resourceName = null;
- $level = -1;
- } else {
- if (!$this->_isServiceElement($resource)) {
- $resourceName = $this->_buildFullResourceName($resource, $parentName);
-
- if ($shortFormat) {
- $result[] = $resourceName;
- } else {
- if ($resource->getAttribute('module')) {
- $module = (string)$resource->getAttribute('module');
- }
- $result[$resourceName]['name'] = $this->_getHelper($module)->__((string)$resource->title);
- $result[$resourceName]['level'] = $level;
- }
- }
- }
- //check children and run recursion if they exists
- $children = $resource->children();
- foreach ($children as $key => $child) {
- if (1 == $child->disabled) {
- continue;
- }
- $result = array_merge(
- $this->_flattenResourceTree($child, $resourceName, $level + 1, $module, $shortFormat),
- $result
- );
- }
- return $result;
- }
-
- /**
- * Check whether provided element is a service element of Admin Xml configuration
- *
- * @param Varien_Simplexml_Element $resource
- * @return bool
- */
- protected function _isServiceElement(Varien_Simplexml_Element $resource)
- {
- return in_array($resource->getName(), array('title', 'sort_order', 'children', 'disabled'));
- }
-
- /**
- * Build acl resource name with path to parent
- *
- * @param Varien_Simplexml_Element $resource
- * @param string $path
- * @return string
- */
- protected function _buildFullResourceName(Varien_Simplexml_Element $resource, $path = null)
- {
- return (is_null($path) ? '' : $path . '/') . $resource->getName();
- }
-
- /**
- * Get acl assert config
- *
- * @param string $name
- * @return Mage_Core_Model_Config_Element|boolean
- */
- public function getAclAssert($name = '')
- {
- $asserts = $this->getNode("admin/acl/asserts");
- if ('' === $name) {
- return $asserts;
- }
-
- if (isset($asserts->$name)) {
- return $asserts->$name;
- }
-
- return false;
- }
-
- /**
- * Retrieve privilege set by name
- *
- * @param string $name
- * @return Mage_Core_Model_Config_Element|boolean
- */
- public function getAclPrivilegeSet($name = '')
- {
- $sets = $this->getNode("admin/acl/privilegeSets");
- if ('' === $name) {
- return $sets;
- }
-
- if (isset($sets->$name)) {
- return $sets->$name;
- }
-
- return false;
- }
-
- /**
* Retrieve xml config
*
* @return Varien_Simplexml_Config
Oops, something went wrong.

0 comments on commit 7fec10a

Please sign in to comment.