2.0.0.0-dev35
* Enhancements of System Configuration:
* Introduced new items that can be configured in the similar to Magento 1.x way, using xml files: nested groups in System Configuration form, group dependencies, intersected dependencies
* Enhanced handling of field dependencies, required fields functionality
* Changed Configuration structure to be represented as an object model
* Improved performance of configuration rendering
* Implemented new API in `Mage_Webapi` module
* Removed `Mage_Api` and `Mage_Api2` modules as obsolete API implementation
* Added support of REST and SOAP 1.2 [WS-I 2.0](http://ws-i.org/Profiles/BasicProfile-2.0-2010-11-09.html) APIs
* Introduced versioning per API resource. The application will support old version(s) of API after upgrading to not make old API requests fail
* Unified implementation for all API types
* Significantly simplified coverage of new API resources
* Added two-legged `OAuth` 1.0 for REST authentication
* Added WS-Security for SOAP authentication
* Added automatic generation of REST routes and SOAP WSDL on the basis of API class interface and annotations
* Introduced generation of API reference from annotated WSDL (for SOAP API)
* Introduced service layer. Business logic should be implemented once on service layer and could be utilized from different types of controller (e.g., general or API)
* Business logic is implemented on service layer to be utilized from different types of controller (e.g., general or API)
* Implemented abstract service layer class - `Mage_Core_Service_ServiceAbstract`
* Implemented concrete service layers for customers, orders and quotes. Appropriate duplicate logic has been eliminated from controllers and API
* Improved validation approach:
* Added support of describing validation rules in a module's configuration file - `validation.xml` in the module's `etc` directory
* Added `Mage_Core_Model_Validator_Factory`
* Added new validators to Magento Validator library
* Added `Magento_Translate_Adapter` as a translator for the validators
* New approach is utilized in `Mage_Customer`, `Mage_Eav` and `Mage_Webapi` modules
* Added profiling of DB and cache requests
* Minor Improvements:
* Added an ability to choose the image for logo and upload it from backend web-interface
* Added notification in backend in case of product SKU change
* Bug fixes:
* Fixed bug in `Mage_Adminhtml_Sales_Order_CreditmemoController` that changed item’s stock status after each comment
* Removed `Debug` section in `System -> Configuration -> Advanced -> Developer` for default configuration scope
* Fixed bug in `Mage_Tax_Model_Resource_Calculation` that prevented placing order with two tax rules having the same rate
* Removed `Url Options` section in `System -> Configuration -> General -> Web` for website and store configuration scope
* Changed backend template for UPS shipping provider to fix translation issue
* Fixed security issue - set `CURLOPT_SSL_VERIFYPEER` to `true` by default in cUrl calls
* Added `Zend/Escaper`, `Zend/I18`, `Zend/Validator` ZF2 libraries
* Updated `Zend/Server` and `Zend/Soap` libraries to ZF2 versions
diff --git a/.gitignore b/.gitignore
index ff9a120..ee2ae17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,7 +29,4 @@
/pub/media/customer/*
/pub/media/downloadable/*
/var/*
-dev/api-tests/config.php
-dev/api-tests/integration/tmp/*
-dev/api-tests/integration/framework/local-mysql.xml
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index 3e8af1f..571d65f 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,3 +1,44 @@
+2.0.0.0-dev35
+=============
+* Enhancements of System Configuration:
+ * Introduced new items that can be configured in the similar to Magento 1.x way, using xml files: nested groups in System Configuration form, group dependencies, intersected dependencies
+ * Enhanced handling of field dependencies, required fields functionality
+ * Changed Configuration structure to be represented as an object model
+ * Improved performance of configuration rendering
+* Implemented new API in `Mage_Webapi` module
+ * Removed `Mage_Api` and `Mage_Api2` modules as obsolete API implementation
+ * Added support of REST and SOAP 1.2 [WS-I 2.0](http://ws-i.org/Profiles/BasicProfile-2.0-2010-11-09.html) APIs
+ * Introduced versioning per API resource. The application will support old version(s) of API after upgrading to not make old API requests fail
+ * Unified implementation for all API types
+ * Significantly simplified coverage of new API resources
+ * Added two-legged `OAuth` 1.0 for REST authentication
+ * Added WS-Security for SOAP authentication
+ * Added automatic generation of REST routes and SOAP WSDL on the basis of API class interface and annotations
+ * Introduced generation of API reference from annotated WSDL (for SOAP API)
+* Introduced service layer. Business logic should be implemented once on service layer and could be utilized from different types of controller (e.g., general or API)
+ * Business logic is implemented on service layer to be utilized from different types of controller (e.g., general or API)
+ * Implemented abstract service layer class - `Mage_Core_Service_ServiceAbstract`
+ * Implemented concrete service layers for customers, orders and quotes. Appropriate duplicate logic has been eliminated from controllers and API
+* Improved validation approach:
+ * Added support of describing validation rules in a module's configuration file - `validation.xml` in the module's `etc` directory
+ * Added `Mage_Core_Model_Validator_Factory`
+ * Added new validators to Magento Validator library
+ * Added `Magento_Translate_Adapter` as a translator for the validators
+ * New approach is utilized in `Mage_Customer`, `Mage_Eav` and `Mage_Webapi` modules
+* Added profiling of DB and cache requests
+* Minor Improvements:
+ * Added an ability to choose the image for logo and upload it from backend web-interface
+ * Added notification in backend in case of product SKU change
+* Bug fixes:
+ * Fixed bug in `Mage_Adminhtml_Sales_Order_CreditmemoController` that changed item’s stock status after each comment
+ * Removed `Debug` section in `System -> Configuration -> Advanced -> Developer` for default configuration scope
+ * Fixed bug in `Mage_Tax_Model_Resource_Calculation` that prevented placing order with two tax rules having the same rate
+ * Removed `Url Options` section in `System -> Configuration -> General -> Web` for website and store configuration scope
+ * Changed backend template for UPS shipping provider to fix translation issue
+* Fixed security issue - set `CURLOPT_SSL_VERIFYPEER` to `true` by default in cUrl calls
+* Added `Zend/Escaper`, `Zend/I18`, `Zend/Validator` ZF2 libraries
+* Updated `Zend/Server` and `Zend/Soap` libraries to ZF2 versions
+
2.0.0.0-dev34
=============
* Test Framework:
diff --git a/LICENSE.txt b/LICENSE.txt
index 1c0ad61..63f5337 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,48 +1,48 @@
-
-Open Software License ("OSL") v. 3.0
-
-This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
-
-Licensed under the Open Software License version 3.0
-
- 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
-
- 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
-
- 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
-
- 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
-
- 4. to perform the Original Work publicly; and
-
- 5. to display the Original Work publicly.
-
- 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
-
- 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
-
- 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
-
- 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
-
- 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
-
- 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
-
- 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
-
- 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
-
- 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
-
- 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
-
- 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
-
- 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
-
- 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
- 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
-
+
+Open Software License ("OSL") v. 3.0
+
+This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Open Software License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/LICENSE_AFL.txt b/LICENSE_AFL.txt
index f3144bd..87943b9 100644
--- a/LICENSE_AFL.txt
+++ b/LICENSE_AFL.txt
@@ -1,48 +1,48 @@
-
-Academic Free License ("AFL") v. 3.0
-
-This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
-
-Licensed under the Academic Free License version 3.0
-
- 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
-
- 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
-
- 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
-
- 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
-
- 4. to perform the Original Work publicly; and
-
- 5. to display the Original Work publicly.
-
- 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
-
- 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
-
- 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
-
- 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
-
- 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
-
- 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
-
- 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
-
- 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
-
- 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
-
- 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
-
- 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
-
- 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
-
- 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
- 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
-
+
+Academic Free License ("AFL") v. 3.0
+
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/Mage.php b/app/Mage.php
index 8dc32ae..d5c8e49 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -170,7 +170,7 @@
'revision' => '0',
'patch' => '0',
'stability' => 'dev',
- 'number' => '34',
+ 'number' => '35',
);
}
diff --git a/app/bootstrap.php b/app/bootstrap.php
index 315f3cb..2283f09 100644
--- a/app/bootstrap.php
+++ b/app/bootstrap.php
@@ -18,9 +18,8 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Magento
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/* PHP version validation */
@@ -97,15 +96,22 @@
Mage::initializeObjectManager($definitionsFile);
}
+$output = null;
if (isset($_SERVER['MAGE_PROFILER'])) {
switch ($_SERVER['MAGE_PROFILER']) {
case 'firebug':
- Magento_Profiler::registerOutput(new Magento_Profiler_Output_Firebug());
+ $output = new Magento_Profiler_Driver_Standard_Output_Firebug();
break;
case 'csv':
- Magento_Profiler::registerOutput(new Magento_Profiler_Output_Csvfile(__DIR__ . '/../var/log/profiler.csv'));
+ $output = new Magento_Profiler_Driver_Standard_Output_Csvfile(__DIR__ . '/../var/log/profiler.csv');
break;
default:
- Magento_Profiler::registerOutput(new Magento_Profiler_Output_Html());
+ $output = new Magento_Profiler_Driver_Standard_Output_Html();
}
}
+
+if ($output) {
+ $driver = new Magento_Profiler_Driver_Standard();
+ $driver->registerOutput($output);
+ Magento_Profiler::add($driver);
+}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php b/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php
deleted file mode 100644
index d938be4..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-class Mage_Adminhtml_Block_Api_Buttons extends Mage_Adminhtml_Block_Template
-{
-
- protected $_template = 'api/userinfo.phtml';
-
- protected function _prepareLayout()
- {
- $this->addChild('backButton', 'Mage_Adminhtml_Block_Widget_Button', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Back'),
- 'onclick' => 'window.location.href=\''.$this->getUrl('*/*/').'\'',
- 'class' => 'back'
- ));
-
- $this->addChild('resetButton', 'Mage_Adminhtml_Block_Widget_Button', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Reset'),
- 'onclick' => 'window.location.reload()'
- ));
-
- $this->addChild('saveButton', 'Mage_Adminhtml_Block_Widget_Button', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Save Role'),
- 'class' => 'save',
- 'data_attr' => array(
- 'widget-button' => array('event' => 'save', 'related' => '#role-edit-form')
- )
- ));
-
- $this->addChild('deleteButton', 'Mage_Adminhtml_Block_Widget_Button', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Delete Role'),
- 'onclick' => 'deleteConfirm(\'' . Mage::helper('Mage_Adminhtml_Helper_Data')->__('Are you sure you want to do this?') . '\', \'' . $this->getUrl('*/*/delete', array('rid' => $this->getRequest()->getParam('rid'))) . '\')',
- 'class' => 'delete'
- ));
- return parent::_prepareLayout();
- }
-
- public function getBackButtonHtml()
- {
- return $this->getChildHtml('backButton');
- }
-
- public function getResetButtonHtml()
- {
- return $this->getChildHtml('resetButton');
- }
-
- public function getSaveButtonHtml()
- {
- return $this->getChildHtml('saveButton');
- }
-
- public function getDeleteButtonHtml()
- {
- if( intval($this->getRequest()->getParam('rid')) == 0 ) {
- return;
- }
- return $this->getChildHtml('deleteButton');
- }
-
- public function getUser()
- {
- return Mage::registry('user_data');
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php b/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php
deleted file mode 100644
index 95ad290..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-class Mage_Adminhtml_Block_Api_Editroles extends Mage_Adminhtml_Block_Widget_Tabs {
- protected function _construct()
- {
- parent::_construct();
- $this->setId('role_info_tabs');
- $this->setDestElementId('role-edit-form');
- $this->setTitle(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Information'));
- }
-
- protected function _beforeToHtml()
- {
- $roleId = $this->getRequest()->getParam('rid', false);
- $role = Mage::getModel('Mage_Api_Model_Roles')
- ->load($roleId);
-
- $this->addTab('info', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Info'),
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Info'),
- 'content' => $this->getLayout()->createBlock(
- 'Mage_Adminhtml_Block_Api_Tab_Roleinfo'
- )->setRole($role)->toHtml(),
- 'active' => true
- ));
-
- $this->addTab('account', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Resources'),
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Resources'),
- 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Tab_Rolesedit')->toHtml(),
- ));
-
- if( intval($roleId) > 0 ) {
- $this->addTab('roles', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Users'),
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Users'),
- 'content' => $this->getLayout()->createBlock(
- 'Mage_Adminhtml_Block_Api_Tab_Rolesusers',
- 'role.users.grid'
- )->toHtml(),
- ));
- }
- return parent::_beforeToHtml();
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php b/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php
deleted file mode 100644
index 9b5e38a..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * roles grid
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_Grid_Role extends Mage_Adminhtml_Block_Widget_Grid
-{
- protected function _construct()
- {
- parent::_construct();
- $this->setId('roleGrid');
- $this->setSaveParametersInSession(true);
- $this->setDefaultSort('role_id');
- $this->setDefaultDir('asc');
- $this->setUseAjax(true);
- }
-
- protected function _prepareCollection()
- {
- $collection = Mage::getModel('Mage_Api_Model_Roles')->getCollection();
- $this->setCollection($collection);
-
- return parent::_prepareCollection();
- }
-
- protected function _prepareColumns()
- {
-
- $this->addColumn('role_id', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('ID'),
- 'index' =>'role_id',
- 'align' => 'right',
- 'width' => '50px'
- ));
-
- $this->addColumn('role_name', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Name'),
- 'index' =>'role_name'
- ));
-
- return parent::_prepareColumns();
- }
-
- public function getGridUrl()
- {
- return $this->getUrl('*/*/roleGrid', array('_current'=>true));
- }
-
- public function getRowUrl($row)
- {
- return $this->getUrl('*/*/editrole', array('rid' => $row->getRoleId()));
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role.php b/app/code/core/Mage/Adminhtml/Block/Api/Role.php
deleted file mode 100644
index e502929..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Role.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml permissioms role block
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-
-class Mage_Adminhtml_Block_Api_Role extends Mage_Adminhtml_Block_Widget_Grid_Container
-{
-
- protected function _construct()
- {
- $this->_controller = 'api_role';
- $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Roles');
- $this->_addButtonLabel = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add New Role');
- parent::_construct();
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
deleted file mode 100644
index 478bd8b..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Acl role user grid
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_Role_Grid_User extends Mage_Adminhtml_Block_Widget_Grid
-{
-
- protected function _construct()
- {
- parent::_construct();
- $this->setDefaultSort('role_user_id');
- $this->setDefaultDir('asc');
- $this->setId('roleUserGrid');
- $this->setDefaultFilter(array('in_role_users'=>1));
- $this->setUseAjax(true);
- }
-
- protected function _addColumnFilterToCollection($column)
- {
- if ($column->getId() == 'in_role_users') {
- $inRoleIds = $this->_getUsers();
- if (empty($inRoleIds)) {
- $inRoleIds = 0;
- }
- if ($column->getFilter()->getValue()) {
- $this->getCollection()->addFieldToFilter('user_id', array('in'=>$inRoleIds));
- }
- else {
- if($inRoleIds) {
- $this->getCollection()->addFieldToFilter('user_id', array('nin'=>$inRoleIds));
- }
- }
- }
- else {
- parent::_addColumnFilterToCollection($column);
- }
- return $this;
- }
-
- protected function _prepareCollection()
- {
- $roleId = $this->getRequest()->getParam('rid');
- Mage::register('RID', $roleId);
- $collection = Mage::getModel('Mage_Api_Model_Roles')->getUsersCollection();
- $this->setCollection($collection);
- return parent::_prepareCollection();
- }
-
- protected function _prepareColumns()
- {
- $this->addColumn('in_role_users', array(
- 'header_css_class' => 'a-center',
- 'type' => 'checkbox',
- 'name' => 'in_role_users',
- 'values' => $this->_getUsers(),
- 'align' => 'center',
- 'index' => 'user_id'
- ));
-
- $this->addColumn('role_user_id', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('User ID'),
- 'width' =>5,
- 'align' =>'left',
- 'sortable' =>true,
- 'index' =>'user_id'
- ));
-
- $this->addColumn('role_user_username', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Name'),
- 'align' =>'left',
- 'index' =>'username'
- ));
-
- $this->addColumn('role_user_firstname', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('First Name'),
- 'align' =>'left',
- 'index' =>'firstname'
- ));
-
- $this->addColumn('role_user_lastname', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Last Name'),
- 'align' =>'left',
- 'index' =>'lastname'
- ));
-
- $this->addColumn('role_user_email', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Email'),
- 'width' =>40,
- 'align' =>'left',
- 'index' =>'email'
- ));
-
- $this->addColumn('role_user_is_active', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Status'),
- 'index' => 'is_active',
- 'align' =>'left',
- 'type' => 'options',
- 'options' => array('1' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Active'), '0' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Inactive')),
- ));
-
- /*
- $this->addColumn('grid_actions',
- array(
- 'header'=>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Actions'),
- 'width'=>5,
- 'sortable'=>false,
- 'filter' =>false,
- 'type' => 'action',
- 'actions' => array(
- array(
- 'caption' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Remove'),
- 'onClick' => 'role.deleteFromRole($role_id);'
- )
- )
- )
- );
- */
-
- return parent::_prepareColumns();
- }
-
- public function getGridUrl()
- {
- $roleId = $this->getRequest()->getParam('rid');
- return $this->getUrl('*/*/editrolegrid', array('rid' => $roleId));
- }
-
- protected function _getUsers($json=false)
- {
- if ( $this->getRequest()->getParam('in_role_user') != "" ) {
- return $this->getRequest()->getParam('in_role_user');
- }
- $roleId = ( $this->getRequest()->getParam('rid') > 0 ) ? $this->getRequest()->getParam('rid') : Mage::registry('RID');
- $users = Mage::getModel('Mage_Api_Model_Roles')->setId($roleId)->getRoleUsers();
- if (sizeof($users) > 0) {
- if ( $json ) {
- $jsonUsers = Array();
- foreach($users as $usrid) $jsonUsers[$usrid] = 0;
- return Mage::helper('Mage_Core_Helper_Data')->jsonEncode((object)$jsonUsers);
- } else {
- return array_values($users);
- }
- } else {
- if ( $json ) {
- return '{}';
- } else {
- return array();
- }
- }
- }
-
-}
-
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Roles.php b/app/code/core/Mage/Adminhtml/Block/Api/Roles.php
deleted file mode 100644
index fb6fb86..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Roles.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * user roles block
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_Roles extends Mage_Adminhtml_Block_Template
-{
-
- protected $_template = 'api/roles.phtml';
-
- public function getAddNewUrl()
- {
- return $this->getUrl('*/*/editrole');
- }
-
- public function getGridHtml()
- {
- return $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Grid_Role')->toHtml();
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php
deleted file mode 100644
index 167539f..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * implementing now
- *
- */
-class Mage_Adminhtml_Block_Api_Tab_Roleinfo extends Mage_Adminhtml_Block_Widget_Form
-{
- public function _beforeToHtml() {
- $this->_initForm();
-
- return parent::_beforeToHtml();
- }
-
- protected function _initForm()
- {
- $roleId = $this->getRequest()->getParam('rid');
-
- $form = new Varien_Data_Form();
-
- $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Information')));
-
- $fieldset->addField('role_name', 'text',
- array(
- 'name' => 'rolename',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Name'),
- 'id' => 'role_name',
- 'class' => 'required-entry',
- 'required' => true,
- )
- );
-
- $fieldset->addField('role_id', 'hidden',
- array(
- 'name' => 'role_id',
- 'id' => 'role_id',
- )
- );
-
- $fieldset->addField('in_role_user', 'hidden',
- array(
- 'name' => 'in_role_user',
- 'id' => 'in_role_userz',
- )
- );
-
- $fieldset->addField('in_role_user_old', 'hidden', array('name' => 'in_role_user_old'));
-
- $form->setValues($this->getRole()->getData());
- $this->setForm($form);
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
deleted file mode 100644
index 75725f4..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-class Mage_Adminhtml_Block_Api_Tab_Rolesedit extends Mage_Adminhtml_Block_Widget_Form {
-
- protected $_template = 'api/rolesedit.phtml';
-
-
- protected function _construct() {
- parent::_construct();
-
- $rid = Mage::app()->getRequest()->getParam('rid', false);
-
- $resources = Mage::getModel('Mage_Api_Model_Roles')->getResourcesList();
-
- $rules_set = Mage::getResourceModel('Mage_Api_Model_Resource_Rules_Collection')->getByRoles($rid)->load();
-
- $selrids = array();
-
- foreach ($rules_set->getItems() as $item) {
- if (array_key_exists(strtolower($item->getResource_id()), $resources)
- && $item->getApiPermission() == 'allow')
- {
- $resources[$item->getResource_id()]['checked'] = true;
- array_push($selrids, $item->getResource_id());
- }
- }
-
- $this->setSelectedResources($selrids);
-
-
- //->assign('resources', $resources);
- //->assign('checkedResources', join(',', $selrids));
- }
-
- public function getEverythingAllowed()
- {
- return in_array('all', $this->getSelectedResources());
- }
-
- public function getResTreeJson()
- {
- $rid = Mage::app()->getRequest()->getParam('rid', false);
- $resources = Mage::getModel('Mage_Api_Model_Roles')->getResourcesTree();
-
- $rootArray = $this->_getNodeJson($resources,1);
-
- $json = Mage::helper('Mage_Core_Helper_Data')->jsonEncode(isset($rootArray['children']) ? $rootArray['children'] : array());
-
- return $json;
- }
-
- protected function _sortTree($a, $b)
- {
- return $a['sort_order']<$b['sort_order'] ? -1 : ($a['sort_order']>$b['sort_order'] ? 1 : 0);
- }
-
-
- protected function _getNodeJson($node, $level=0)
- {
- $item = array();
- $selres = $this->getSelectedResources();
-
- if ($level != 0) {
- $item['text']= (string)$node->title;
- $item['sort_order']= isset($node->sort_order) ? (string)$node->sort_order : 0;
- $item['id'] = (string)$node->attributes()->aclpath;
-
- if (in_array($item['id'], $selres))
- $item['checked'] = true;
- }
- if (isset($node->children)) {
- $children = $node->children->children();
- } else {
- $children = $node->children();
- }
- if (empty($children)) {
- return $item;
- }
-
- if ($children) {
- $item['children'] = array();
- //$item['cls'] = 'fiche-node';
- foreach ($children as $child) {
- if ($child->getName()!='title' && $child->getName()!='sort_order' && $child->attributes()->module) {
- if ($level != 0) {
- $item['children'][] = $this->_getNodeJson($child, $level+1);
- } else {
- $item = $this->_getNodeJson($child, $level+1);
- }
- }
- }
- if (!empty($item['children'])) {
- usort($item['children'], array($this, '_sortTree'));
- }
- }
- return $item;
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
deleted file mode 100644
index 2d06670..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-class Mage_Adminhtml_Block_Api_Tab_Rolesusers extends Mage_Adminhtml_Block_Widget_Tabs {
-
- protected function _construct()
- {
- parent::_construct();
-
- $roleId = $this->getRequest()->getParam('rid', false);
-
- $users = Mage::getModel('Mage_Api_Model_User')->getCollection()->load();
- $this->setTemplate('api/rolesusers.phtml')
- ->assign('users', $users->getItems())
- ->assign('roleId', $roleId);
- }
-
- protected function _prepareLayout()
- {
- $this->setChild(
- 'userGrid',
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Role_Grid_User', 'roleUsersGrid')
- );
- return parent::_prepareLayout();
- }
-
- protected function _getGridHtml()
- {
- return $this->getChildHtml('userGrid');
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User.php b/app/code/core/Mage/Adminhtml/Block/Api/User.php
deleted file mode 100644
index 26dbd97..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml permissions user block
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_User extends Mage_Adminhtml_Block_Widget_Grid_Container
-{
-
- protected function _construct()
- {
- $this->_controller = 'api_user';
- $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Users');
- $this->_addButtonLabel = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Add New User');
- parent::_construct();
- }
-
- /**
- * Prepare output HTML
- *
- * @return string
- */
- protected function _toHtml()
- {
- Mage::dispatchEvent('api_user_html_before', array('block' => $this));
- return parent::_toHtml();
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php
deleted file mode 100644
index 823ebd0..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml permissions user edit page
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_User_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
-{
-
- protected function _construct()
- {
- $this->_objectId = 'user_id';
- $this->_controller = 'api_user';
-
- parent::_construct();
-
- $this->_updateButton('save', 'label', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Save User'));
- $this->_updateButton('delete', 'label', Mage::helper('Mage_Adminhtml_Helper_Data')->__('Delete User'));
- }
-
- public function getHeaderText()
- {
- if (Mage::registry('api_user')->getId()) {
- return Mage::helper('Mage_Adminhtml_Helper_Data')->__("Edit User '%s'", $this->escapeHtml(Mage::registry('api_user')->getUsername()));
- }
- else {
- return Mage::helper('Mage_Adminhtml_Helper_Data')->__('New User');
- }
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php
deleted file mode 100644
index 700381d..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml permissions user edit form
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_User_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
-{
-
- protected function _prepareForm()
- {
- $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
- $form->setUseContainer(true);
- $this->setForm($form);
- return parent::_prepareForm();
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
deleted file mode 100644
index 7a14ba8..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Cms page edit form main tab
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-
-class Mage_Adminhtml_Block_Api_User_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
-{
-
- protected function _prepareForm()
- {
- $model = Mage::registry('api_user');
-
- $form = new Varien_Data_Form();
-
- $form->setHtmlIdPrefix('user_');
-
- $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Account Information')));
-
- if ($model->getUserId()) {
- $fieldset->addField('user_id', 'hidden', array(
- 'name' => 'user_id',
- ));
- } else {
- if (! $model->hasData('is_active')) {
- $model->setIsActive(1);
- }
- }
-
- $fieldset->addField('username', 'text', array(
- 'name' => 'username',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Name'),
- 'id' => 'username',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Name'),
- 'required' => true,
- ));
-
- $fieldset->addField('firstname', 'text', array(
- 'name' => 'firstname',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('First Name'),
- 'id' => 'firstname',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('First Name'),
- 'required' => true,
- ));
-
- $fieldset->addField('lastname', 'text', array(
- 'name' => 'lastname',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Last Name'),
- 'id' => 'lastname',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Last Name'),
- 'required' => true,
- ));
-
- $fieldset->addField('email', 'text', array(
- 'name' => 'email',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Email'),
- 'id' => 'customer_email',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Email'),
- 'class' => 'required-entry validate-email',
- 'required' => true,
- ));
-
- if ($model->getUserId()) {
- $fieldset->addField('password', 'password', array(
- 'name' => 'new_api_key',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('New API Key'),
- 'id' => 'new_pass',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('New API Key'),
- 'class' => 'input-text validate-password',
- ));
-
- $fieldset->addField('confirmation', 'password', array(
- 'name' => 'api_key_confirmation',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('API Key Confirmation'),
- 'id' => 'confirmation',
- 'class' => 'input-text validate-cpassword',
- ));
- }
- else {
- $fieldset->addField('password', 'password', array(
- 'name' => 'api_key',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('API Key'),
- 'id' => 'customer_pass',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('API Key'),
- 'class' => 'input-text required-entry validate-password',
- 'required' => true,
- ));
- $fieldset->addField('confirmation', 'password', array(
- 'name' => 'api_key_confirmation',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('API Key Confirmation'),
- 'id' => 'confirmation',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('API Key Confirmation'),
- 'class' => 'input-text required-entry validate-cpassword',
- 'required' => true,
- ));
- }
-
- if (Mage::getSingleton('Mage_Backend_Model_Auth_Session')->getUser()->getId() != $model->getUserId()) {
- $fieldset->addField('is_active', 'select', array(
- 'name' => 'is_active',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('This account is'),
- 'id' => 'is_active',
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Account status'),
- 'class' => 'input-select',
- 'style' => 'width: 80px',
- 'options' => array('1' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Active'), '0' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Inactive')),
- ));
- }
-
- $fieldset->addField('user_roles', 'hidden', array(
- 'name' => 'user_roles',
- 'id' => '_user_roles',
- ));
-
- $data = $model->getData();
-
- unset($data['password']);
-
- $form->setValues($data);
-
- $this->setForm($form);
-
- return parent::_prepareForm();
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
deleted file mode 100644
index d0e34dd..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-class Mage_Adminhtml_Block_Api_User_Edit_Tab_Roles extends Mage_Adminhtml_Block_Widget_Grid
-{
-
- protected function _construct()
- {
- parent::_construct();
- $this->setId('permissionsUserRolesGrid');
- $this->setDefaultSort('sort_order');
- $this->setDefaultDir('asc');
- //$this->setDefaultFilter(array('assigned_user_role'=>1));
- $this->setTitle(Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Roles Information'));
- $this->setUseAjax(true);
- }
-
- protected function _addColumnFilterToCollection($column)
- {
- if ($column->getId() == 'assigned_user_role') {
- $userRoles = $this->_getSelectedRoles();
- if (empty($userRoles)) {
- $userRoles = 0;
- }
- if ($column->getFilter()->getValue()) {
- $this->getCollection()->addFieldToFilter('role_id', array('in'=>$userRoles));
- }
- else {
- if($userRoles) {
- $this->getCollection()->addFieldToFilter('role_id', array('nin'=>$userRoles));
- }
- }
- }
- else {
- parent::_addColumnFilterToCollection($column);
- }
- return $this;
- }
-
- protected function _prepareCollection()
- {
- $collection = Mage::getResourceModel('Mage_Api_Model_Resource_Role_Collection');
- $collection->setRolesFilter();
- $this->setCollection($collection);
- return parent::_prepareCollection();
- }
-
- protected function _prepareColumns()
- {
-
- $this->addColumn('assigned_user_role', array(
- 'header_css_class' => 'a-center',
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Assigned'),
- 'type' => 'radio',
- 'html_name' => 'roles[]',
- 'values' => $this->_getSelectedRoles(),
- 'align' => 'center',
- 'index' => 'role_id'
- ));
-
- /*$this->addColumn('role_id', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role ID'),
- 'index' =>'role_id',
- 'align' => 'right',
- 'width' => '50px'
- ));*/
-
- $this->addColumn('role_name', array(
- 'header' =>Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Name'),
- 'index' =>'role_name'
- ));
-
- return parent::_prepareColumns();
- }
-
- public function getGridUrl()
- {
- return $this->getUrl('*/*/rolesGrid', array('user_id' => Mage::registry('api_user')->getUserId()));
- }
-
- protected function _getSelectedRoles($json=false)
- {
- if ( $this->getRequest()->getParam('user_roles') != "" ) {
- return $this->getRequest()->getParam('user_roles');
- }
- $uRoles = Mage::registry('api_user')->getRoles();
- if ($json) {
- $jsonRoles = Array();
- foreach($uRoles as $urid) $jsonRoles[$urid] = 0;
- return Mage::helper('Mage_Core_Helper_Data')->jsonEncode((object)$jsonRoles);
- } else {
- return $uRoles;
- }
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php
deleted file mode 100644
index 4c36e71..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Admin page left menu
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_User_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
-{
-
- protected function _construct()
- {
- parent::_construct();
- $this->setId('page_tabs');
- $this->setDestElementId('edit_form');
- $this->setTitle(Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Information'));
- }
-
- protected function _beforeToHtml()
- {
- $this->addTab('main_section', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Info'),
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Info'),
- 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_User_Edit_Tab_Main')->toHtml(),
- 'active' => true
- ));
-
- $this->addTab('roles_section', array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Role'),
- 'title' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Role'),
- 'content' => $this->getLayout()->createBlock(
- 'Mage_Adminhtml_Block_Api_User_Edit_Tab_Roles',
- 'user.roles.grid'
- )->toHtml(),
- ));
- return parent::_beforeToHtml();
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php
deleted file mode 100644
index 1d25368..0000000
--- a/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml permissions user grid
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Api_User_Grid extends Mage_Adminhtml_Block_Widget_Grid
-{
-
- protected function _construct()
- {
- parent::_construct();
- $this->setId('permissionsUserGrid');
- $this->setDefaultSort('username');
- $this->setDefaultDir('asc');
- $this->setUseAjax(true);
- }
-
- protected function _prepareCollection()
- {
- $collection = Mage::getResourceModel('Mage_Api_Model_Resource_User_Collection');
- $this->setCollection($collection);
- return parent::_prepareCollection();
- }
-
- protected function _prepareColumns()
- {
- $this->addColumn('user_id', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('ID'),
- 'width' => 5,
- 'align' => 'right',
- 'sortable' => true,
- 'index' => 'user_id'
- ));
-
- $this->addColumn('username', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Name'),
- 'index' => 'username'
- ));
-
- $this->addColumn('firstname', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('First Name'),
- 'index' => 'firstname'
- ));
-
- $this->addColumn('lastname', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Last Name'),
- 'index' => 'lastname'
- ));
-
- $this->addColumn('email', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Email'),
- 'width' => 40,
- 'align' => 'left',
- 'index' => 'email'
- ));
-
- $this->addColumn('is_active', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Status'),
- 'index' => 'is_active',
- 'type' => 'options',
- 'options' => array('1' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Active'), '0' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Inactive')),
- ));
-
- return parent::_prepareColumns();
- }
-
- public function getRowUrl($row)
- {
- return $this->getUrl('*/*/edit', array('user_id' => $row->getId()));
- }
-
- public function getGridUrl()
- {
- //$uid = $this->getRequest()->getParam('user_id');
- return $this->getUrl('*/*/roleGrid', array());
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php
index 816328d..f29aa2d 100644
--- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php
+++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php
@@ -34,6 +34,66 @@
*/
class Mage_Adminhtml_Block_System_Email_Template_Edit extends Mage_Adminhtml_Block_Widget
{
+ /**
+ * @var Mage_Core_Model_Registry
+ */
+ protected $_registryManager;
+
+ /**
+ * @var Mage_Backend_Model_Menu_Config
+ */
+ protected $_menuConfig;
+
+ /**
+ * @var Mage_Backend_Model_Config_Structure
+ */
+ protected $_configStructure;
+
+ /**
+ * @param Mage_Core_Controller_Request_Http $request
+ * @param Mage_Core_Model_Layout $layout
+ * @param Mage_Core_Model_Event_Manager $eventManager
+ * @param Mage_Backend_Model_Url $urlBuilder
+ * @param Mage_Core_Model_Translate $translator
+ * @param Mage_Core_Model_Cache $cache
+ * @param Mage_Core_Model_Design_Package $designPackage
+ * @param Mage_Core_Model_Session $session
+ * @param Mage_Core_Model_Store_Config $storeConfig
+ * @param Mage_Core_Controller_Varien_Front $frontController
+ * @param Mage_Core_Model_Factory_Helper $helperFactory
+ * @param Mage_Core_Model_Registry $registry
+ * @param Mage_Backend_Model_Menu_Config $menuConfig
+ * @param Mage_Backend_Model_Config_Structure $configStructure
+ * @param array $data
+ *
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
+ */
+ public function __construct(
+ Mage_Core_Controller_Request_Http $request,
+ Mage_Core_Model_Layout $layout,
+ Mage_Core_Model_Event_Manager $eventManager,
+ Mage_Backend_Model_Url $urlBuilder,
+ Mage_Core_Model_Translate $translator,
+ Mage_Core_Model_Cache $cache,
+ Mage_Core_Model_Design_Package $designPackage,
+ Mage_Core_Model_Session $session,
+ Mage_Core_Model_Store_Config $storeConfig,
+ Mage_Core_Controller_Varien_Front $frontController,
+ Mage_Core_Model_Factory_Helper $helperFactory,
+ Mage_Core_Model_Registry $registry,
+ Mage_Backend_Model_Menu_Config $menuConfig,
+ Mage_Backend_Model_Config_Structure $configStructure,
+ array $data = array()
+ )
+ {
+ parent::__construct($request, $layout, $eventManager, $urlBuilder, $translator, $cache,
+ $designPackage, $session, $storeConfig, $frontController, $helperFactory, $data
+ );
+ $this->_registryManager = $registry;
+ $this->_menuConfig = $menuConfig;
+ $this->_configStructure = $configStructure;
+ }
+
protected $_template = 'system/email/template/edit.phtml';
@@ -287,7 +347,7 @@
*/
public function getEmailTemplate()
{
- return Mage::registry('current_email_template');
+ return $this->_registryManager->registry('current_email_template');
}
/**
@@ -308,10 +368,12 @@
*/
public function getUsedDefaultForPaths($asJSON = true)
{
- $paths = $this->getEmailTemplate()->getSystemConfigPathsWhereUsedAsDefault();
+ /** @var $template Mage_Adminhtml_Model_Email_Template */
+ $template = $this->getEmailTemplate();
+ $paths = $template->getSystemConfigPathsWhereUsedAsDefault();
$pathsParts = $this->_getSystemConfigPathsParts($paths);
if($asJSON){
- return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($pathsParts);
+ return $this->helper('Mage_Core_Helper_Data')->jsonEncode($pathsParts);
}
return $pathsParts;
}
@@ -324,7 +386,9 @@
*/
public function getUsedCurrentlyForPaths($asJSON = true)
{
- $paths = $this->getEmailTemplate()->getSystemConfigPathsWhereUsedCurrently();
+ /** @var $template Mage_Adminhtml_Model_Email_Template */
+ $template = $this->getEmailTemplate();
+ $paths = $template->getSystemConfigPathsWhereUsedCurrently();
$pathsParts = $this->_getSystemConfigPathsParts($paths);
if($asJSON){
return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($pathsParts);
@@ -341,10 +405,10 @@
protected function _getSystemConfigPathsParts($paths)
{
$result = $urlParams = $prefixParts = array();
- $scopeLabel = Mage::helper('Mage_Adminhtml_Helper_Data')->__('GLOBAL');
+ $scopeLabel = $this->helper('Mage_Backend_Helper_Data')->__('GLOBAL');
if ($paths) {
/** @var $menu Mage_Backend_Model_Menu */
- $menu = Mage::getSingleton('Mage_Backend_Model_Menu_Config')->getMenu();
+ $menu = $this->_menuConfig->getMenu();
$item = $menu->get('Mage_Adminhtml::system');
// create prefix path parts
$prefixParts[] = array(
@@ -357,8 +421,10 @@
);
$pathParts = $prefixParts;
- foreach ($paths as $id => $pathData) {
- list($sectionName, $groupName, $fieldName) = explode('/', $pathData['path']);
+ foreach ($paths as $pathData) {
+ $pathDataParts = explode('/', $pathData['path']);
+ $sectionName = array_shift($pathDataParts);
+
$urlParams = array('section' => $sectionName);
if (isset($pathData['scope']) && isset($pathData['scope_id'])) {
switch ($pathData['scope']) {
@@ -382,20 +448,23 @@
}
}
$pathParts[] = array(
- 'title' => Mage::getSingleton('Mage_Backend_Model_Config_Structure_Reader')
- ->getConfiguration()
- ->getSystemConfigNodeLabel($sectionName),
+ 'title' => $this->_configStructure->getElement($sectionName)->getLabel(),
'url' => $this->getUrl('adminhtml/system_config/edit', $urlParams),
);
+ $elementPathParts = array($sectionName);
+ while (count($pathDataParts) != 1) {
+ $elementPathParts[] = array_shift($pathDataParts);
+ $pathParts[] = array(
+ 'title' => $this->_configStructure
+ ->getElementByPathParts($elementPathParts)
+ ->getLabel()
+ );
+ }
+ $elementPathParts[] = array_shift($pathDataParts);
$pathParts[] = array(
- 'title' => Mage::getSingleton('Mage_Backend_Model_Config_Structure_Reader')
- ->getConfiguration()
- ->getSystemConfigNodeLabel($sectionName, $groupName)
- );
- $pathParts[] = array(
- 'title' => Mage::getSingleton('Mage_Backend_Model_Config_Structure_Reader')
- ->getConfiguration()
- ->getSystemConfigNodeLabel($sectionName, $groupName, $fieldName),
+ 'title' => $this->_configStructure
+ ->getElementByPathParts($elementPathParts)
+ ->getLabel(),
'scope' => $scopeLabel
);
$result[] = $pathParts;
diff --git a/app/code/core/Mage/Adminhtml/Model/Email/Template.php b/app/code/core/Mage/Adminhtml/Model/Email/Template.php
index 1ff14aa..b6d173e 100644
--- a/app/code/core/Mage/Adminhtml/Model/Email/Template.php
+++ b/app/code/core/Mage/Adminhtml/Model/Email/Template.php
@@ -47,10 +47,6 @@
}
$paths = array();
- $configSections = Mage::getSingleton('Mage_Backend_Model_Config_Structure_Reader')
- ->getConfiguration()
- ->getSections();
-
// find nodes which are using $templateCode value
$defaultCfgNodes = Mage::getConfig()->getXpath('default/*/*[*="' . $templateCode . '"]');
if (!is_array($defaultCfgNodes)) {
@@ -79,9 +75,10 @@
return array();
}
- $templatePaths = Mage::getSingleton('Mage_Backend_Model_Config_Structure_Reader')
- ->getConfiguration()
- ->getFieldsByAttribute('source_model', 'Mage_Backend_Model_Config_Source_Email_Template');
+ /** @var Mage_Backend_Model_Config_Structure $configStructure */
+ $configStructure = Mage::getSingleton('Mage_Backend_Model_Config_Structure');
+ $templatePaths = $configStructure
+ ->getFieldPathsByAttribute('source_model', 'Mage_Backend_Model_Config_Source_Email_Template');
if (!count($templatePaths)) {
return array();
diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php
deleted file mode 100644
index 4d839e4..0000000
--- a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php
+++ /dev/null
@@ -1,217 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml roles controller
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Api_RoleController extends Mage_Adminhtml_Controller_Action
-{
-
- protected function _initAction()
- {
- $this->loadLayout();
- $this->_setActiveMenu('Mage_Api::system_api_roles');
- $this->_addBreadcrumb($this->__('Web services'), $this->__('Web services'));
- $this->_addBreadcrumb($this->__('Permissions'), $this->__('Permissions'));
- $this->_addBreadcrumb($this->__('Roles'), $this->__('Roles'));
- return $this;
- }
-
- public function indexAction()
- {
- $this->_title($this->__('System'))
- ->_title($this->__('Web Services'))
- ->_title($this->__('Roles'));
-
- $this->_initAction();
-
- $this->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Roles'));
-
- $this->renderLayout();
- }
-
- public function roleGridAction()
- {
- $this->getResponse()
- ->setBody($this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Api_Grid_Role')
- ->toHtml()
- );
- }
-
- public function editRoleAction()
- {
- $this->_title($this->__('System'))
- ->_title($this->__('Web Services'))
- ->_title($this->__('Roles'));
-
- $this->_initAction();
-
- $roleId = $this->getRequest()->getParam('rid');
- if( intval($roleId) > 0 ) {
- $breadCrumb = $this->__('Edit Role');
- $breadCrumbTitle = $this->__('Edit Role');
- $this->_title($this->__('Edit Role'));
- } else {
- $breadCrumb = $this->__('Add New Role');
- $breadCrumbTitle = $this->__('Add New Role');
- $this->_title($this->__('New Role'));
- }
- $this->_addBreadcrumb($breadCrumb, $breadCrumbTitle);
-
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
-
- $this->_addLeft(
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Editroles')
- );
- $resources = Mage::getModel('Mage_Api_Model_Roles')->getResourcesList();
- $this->_addContent(
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Buttons')
- ->setRoleId($roleId)
- ->setRoleInfo(Mage::getModel('Mage_Api_Model_Roles')->load($roleId))
- ->setTemplate('api/roleinfo.phtml')
- );
- $this->_addJs(
- $this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Template')
- ->setTemplate('api/role_users_grid_js.phtml')
- );
- $this->renderLayout();
- }
-
- public function deleteAction()
- {
- $rid = $this->getRequest()->getParam('rid', false);
-
- try {
- Mage::getModel('Mage_Api_Model_Roles')->load($rid)->delete();
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess($this->__('The role has been deleted.'));
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($this->__('An error occurred while deleting this role.'));
- }
-
- $this->_redirect("*/*/");
- }
-
- public function saveRoleAction()
- {
-
- $rid = $this->getRequest()->getParam('role_id', false);
- $role = Mage::getModel('Mage_Api_Model_Roles')->load($rid);
- if (!$role->getId() && $rid) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($this->__('This Role no longer exists'));
- $this->_redirect('*/*/');
- return;
- }
-
- $resource = explode(',', $this->getRequest()->getParam('resource', false));
- $roleUsers = $this->getRequest()->getParam('in_role_user', null);
- parse_str($roleUsers, $roleUsers);
- $roleUsers = array_keys($roleUsers);
-
- $oldRoleUsers = $this->getRequest()->getParam('in_role_user_old');
- parse_str($oldRoleUsers, $oldRoleUsers);
- $oldRoleUsers = array_keys($oldRoleUsers);
-
- $isAll = $this->getRequest()->getParam('all');
- if ($isAll) {
- $resource = array("all");
- }
-
- try {
- $role = $role
- ->setName($this->getRequest()->getParam('rolename', false))
- ->setPid($this->getRequest()->getParam('parent_id', false))
- ->setRoleType('G')
- ->save();
-
- Mage::getModel('Mage_Api_Model_Rules')
- ->setRoleId($role->getId())
- ->setResources($resource)
- ->saveRel();
-
- foreach($oldRoleUsers as $oUid) {
- $this->_deleteUserFromRole($oUid, $role->getId());
- }
-
- foreach ($roleUsers as $nRuid) {
- $this->_addUserToRole($nRuid, $role->getId());
- }
-
- $rid = $role->getId();
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess($this->__('The role has been saved.'));
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($this->__('An error occurred while saving this role.'));
- }
-
- //$this->getResponse()->setRedirect($this->getUrl("*/*/editrole/rid/$rid"));
- $this->_redirect('*/*/editrole', array('rid' => $rid));
- return;
- }
-
- public function editrolegridAction()
- {
- $this->getResponse()->setBody(
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_Role_Grid_User')->toHtml()
- );
- }
-
- protected function _deleteUserFromRole($userId, $roleId)
- {
- try {
- Mage::getModel('Mage_Api_Model_User')
- ->setRoleId($roleId)
- ->setUserId($userId)
- ->deleteFromRole();
- } catch (Exception $e) {
- throw $e;
- return false;
- }
- return true;
- }
-
- protected function _addUserToRole($userId, $roleId)
- {
- $user = Mage::getModel('Mage_Api_Model_User')->load($userId);
- $user->setRoleId($roleId)->setUserId($userId);
-
- if( $user->roleUserExists() === true ) {
- return false;
- } else {
- $user->add();
- return true;
- }
- }
-
- protected function _isAllowed()
- {
- return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Api::roles');
- }
-}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php
deleted file mode 100644
index d817ad8..0000000
--- a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-class Mage_Adminhtml_Api_UserController extends Mage_Adminhtml_Controller_Action
-{
-
- protected function _initAction()
- {
- $this->loadLayout()
- ->_setActiveMenu('Mage_Api::system_api_users')
- ->_addBreadcrumb($this->__('Web Services'), $this->__('Web Services'))
- ->_addBreadcrumb($this->__('Permissions'), $this->__('Permissions'))
- ->_addBreadcrumb($this->__('Users'), $this->__('Users'))
- ;
- return $this;
- }
-
- public function indexAction()
- {
- $this->_title($this->__('System'))
- ->_title($this->__('Web Services'))
- ->_title($this->__('Users'));
-
- $this->_initAction()
- ->_addContent($this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_User'))
- ->renderLayout();
- }
-
- public function newAction()
- {
- $this->_forward('edit');
- }
-
- public function editAction()
- {
- $this->_title($this->__('System'))
- ->_title($this->__('Web Services'))
- ->_title($this->__('Users'));
-
- $id = $this->getRequest()->getParam('user_id');
- $model = Mage::getModel('Mage_Api_Model_User');
-
- if ($id) {
- $model->load($id);
- if (! $model->getId()) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($this->__('This user no longer exists.'));
- $this->_redirect('*/*/');
- return;
- }
- }
-
- $this->_title($model->getId() ? $model->getName() : $this->__('New User'));
-
- // Restore previously entered form data from session
- $data = Mage::getSingleton('Mage_Adminhtml_Model_Session')->getUserData(true);
- if (!empty($data)) {
- $model->setData($data);
- }
-
- Mage::register('api_user', $model);
-
- $this->_initAction()
- ->_addBreadcrumb($id ? $this->__('Edit User') : $this->__('New User'), $id ? $this->__('Edit User') : $this->__('New User'))
- ->_addContent($this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Api_User_Edit')
- ->setData('action', $this->getUrl('*/api_user/save')))
- ->_addLeft($this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_User_Edit_Tabs'));
-
- $this->_addJs($this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Template')
- ->setTemplate('api/user_roles_grid_js.phtml')
- );
- $this->renderLayout();
- }
-
- public function saveAction()
- {
- if ($data = $this->getRequest()->getPost()) {
- $id = $this->getRequest()->getPost('user_id', false);
- $model = Mage::getModel('Mage_Api_Model_User')->load($id);
- if (!$model->getId() && $id) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($this->__('This user no longer exists.'));
- $this->_redirect('*/*/');
- return;
- }
- $model->setData($data);
- try {
- $model->save();
- if ( $uRoles = $this->getRequest()->getParam('roles', false) ) {
- /*parse_str($uRoles, $uRoles);
- $uRoles = array_keys($uRoles);*/
- if ( 1 == sizeof($uRoles) ) {
- $model->setRoleIds($uRoles)
- ->setRoleUserId($model->getUserId())
- ->saveRelations();
- } else if ( sizeof($uRoles) > 1 ) {
- //@FIXME: stupid fix of previous multi-roles logic.
- //@TODO: make proper DB upgrade in the future revisions.
- $rs = array();
- $rs[0] = $uRoles[0];
- $model->setRoleIds( $rs )->setRoleUserId( $model->getUserId() )->saveRelations();
- }
- }
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess($this->__('The user has been saved.'));
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->setUserData(false);
- $this->_redirect('*/*/edit', array('user_id' => $model->getUserId()));
- return;
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->setUserData($data);
- $this->_redirect('*/*/edit', array('user_id' => $model->getUserId()));
- return;
- }
- }
- $this->_redirect('*/*/');
- }
-
- public function deleteAction()
- {
- if ($id = $this->getRequest()->getParam('user_id')) {
-
- try {
- $model = Mage::getModel('Mage_Api_Model_User')->load($id);
- $model->delete();
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess($this->__('The user has been deleted.'));
- $this->_redirect('*/*/');
- return;
- }
- catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
- $this->_redirect('*/*/edit', array('user_id' => $this->getRequest()->getParam('user_id')));
- return;
- }
- }
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($this->__('Unable to find a user to delete.'));
- $this->_redirect('*/*/');
- }
-
- public function rolesGridAction()
- {
- $id = $this->getRequest()->getParam('user_id');
- $model = Mage::getModel('Mage_Api_Model_User');
-
- if ($id) {
- $model->load($id);
- }
-
- Mage::register('api_user', $model);
- $this->getResponse()->setBody(
- $this->getLayout()->createBlock('Mage_Adminhtml_Block_Api_User_Edit_Tab_Roles')->toHtml()
- );
- }
-
- public function roleGridAction()
- {
- $this->getResponse()
- ->setBody($this->getLayout()
- ->createBlock('Mage_Adminhtml_Block_Api_User_Grid')
- ->toHtml()
- );
- }
-
- protected function _isAllowed()
- {
- return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Api::users');
- }
-
-}
diff --git a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php
index 16da2fb..efee4a0 100644
--- a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php
@@ -1,5 +1,7 @@
<?php
/**
+ * Customer admin controller
+ *
* Magento
*
* NOTICE OF LICENSE
@@ -18,29 +20,29 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Mage
- * @package Mage_Adminhtml
* @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-
-/**
- * Customer admin controller
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
class Mage_Adminhtml_CustomerController extends Mage_Adminhtml_Controller_Action
{
+ /**
+ * @var Magento_Validator
+ */
+ protected $_validator;
+ /**
+ * Customer initialization
+ *
+ * @param string $idFieldName
+ * @return Mage_Adminhtml_CustomerController
+ */
protected function _initCustomer($idFieldName = 'id')
{
+ // Default title
$this->_title($this->__('Customers'))->_title($this->__('Manage Customers'));
- $customerId = (int) $this->getRequest()->getParam($idFieldName);
+ $customerId = (int)$this->getRequest()->getParam($idFieldName);
$customer = Mage::getModel('Mage_Customer_Model_Customer');
-
if ($customerId) {
$customer->load($customerId);
}
@@ -77,12 +79,17 @@
/**
* Add breadcrumb item
*/
- $this->_addBreadcrumb(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customers'), Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customers'));
- $this->_addBreadcrumb(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Manage Customers'), Mage::helper('Mage_Adminhtml_Helper_Data')->__('Manage Customers'));
+ $this->_addBreadcrumb(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customers'),
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customers'));
+ $this->_addBreadcrumb(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Manage Customers'),
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Manage Customers'));
$this->renderLayout();
}
+ /**
+ * Customer grid action
+ */
public function gridAction()
{
$this->loadLayout();
@@ -168,12 +175,12 @@
$customer = Mage::registry('current_customer');
if ($customer->getId()) {
try {
- $customer->load($customer->getId());
$customer->delete();
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(Mage::helper('Mage_Adminhtml_Helper_Data')->__('The customer has been deleted.'));
+ $this->_getSession()->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('The customer has been deleted.'));
}
- catch (Exception $e){
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
+ catch (Exception $exception){
+ $this->_getSession()->addError($exception->getMessage());
}
}
$this->_redirect('*/customer');
@@ -184,191 +191,198 @@
*/
public function saveAction()
{
- $data = $this->getRequest()->getPost();
- if ($data) {
- $redirectBack = $this->getRequest()->getParam('back', false);
- $this->_initCustomer('customer_id');
-
- /** @var $customer Mage_Customer_Model_Customer */
- $customer = Mage::registry('current_customer');
-
- /** @var $customerForm Mage_Customer_Model_Form */
- $customerForm = Mage::getModel('Mage_Customer_Model_Form');
- $customerForm->setEntity($customer)
- ->setFormCode('adminhtml_customer')
- ->ignoreInvisible(false)
- ;
-
- $formData = $customerForm->extractData($this->getRequest(), 'account');
-
- // Handle 'disable auto_group_change' attribute
- if (isset($formData['disable_auto_group_change'])) {
- $formData['disable_auto_group_change'] = empty($formData['disable_auto_group_change']) ? '0' : '1';
- }
-
- $errors = $customerForm->validateData($formData);
- if ($errors !== true) {
- foreach ($errors as $error) {
- $this->_getSession()->addError($error);
- }
- $this->_getSession()->setCustomerData($data);
- $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
- return;
- }
-
- $customerForm->compactData($formData);
-
- // Unset template data
- if (isset($data['address']['_template_'])) {
- unset($data['address']['_template_']);
- }
-
- $modifiedAddresses = array();
- if (!empty($data['address'])) {
- /** @var $addressForm Mage_Customer_Model_Form */
- $addressForm = Mage::getModel('Mage_Customer_Model_Form');
- $addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false);
-
- foreach (array_keys($data['address']) as $index) {
- $address = $customer->getAddressItemById($index);
- if (!$address) {
- $address = Mage::getModel('Mage_Customer_Model_Address');
- }
-
- $requestScope = sprintf('address/%s', $index);
- $formData = $addressForm->setEntity($address)
- ->extractData($this->getRequest(), $requestScope);
-
- // Set default billing and shipping flags to address
- $isDefaultBilling = isset($data['account']['default_billing'])
- && $data['account']['default_billing'] == $index;
- $address->setIsDefaultBilling($isDefaultBilling);
- $isDefaultShipping = isset($data['account']['default_shipping'])
- && $data['account']['default_shipping'] == $index;
- $address->setIsDefaultShipping($isDefaultShipping);
-
- $errors = $addressForm->validateData($formData);
- if ($errors !== true) {
- foreach ($errors as $error) {
- $this->_getSession()->addError($error);
- }
- $this->_getSession()->setCustomerData($data);
- $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array(
- 'id' => $customer->getId())
- ));
- return;
- }
-
- $addressForm->compactData($formData);
-
- // Set post_index for detect default billing and shipping addresses
- $address->setPostIndex($index);
-
- if ($address->getId()) {
- $modifiedAddresses[] = $address->getId();
- } else {
- $customer->addAddress($address);
- }
- }
- }
-
- // Default billing and shipping
- if (isset($data['account']['default_billing'])) {
- $customer->setData('default_billing', $data['account']['default_billing']);
- }
- if (isset($data['account']['default_shipping'])) {
- $customer->setData('default_shipping', $data['account']['default_shipping']);
- }
- if (isset($data['account']['confirmation'])) {
- $customer->setData('confirmation', $data['account']['confirmation']);
- }
-
- // Mark not modified customer addresses for delete
- foreach ($customer->getAddressesCollection() as $customerAddress) {
- if ($customerAddress->getId() && !in_array($customerAddress->getId(), $modifiedAddresses)) {
- $customerAddress->setData('_deleted', true);
- }
- }
-
- if (Mage::getSingleton('Mage_Core_Model_Authorization')
- ->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)
- && !$customer->getConfirmation()
- ) {
- $customer->setIsSubscribed(isset($data['subscription']));
- }
-
- if (isset($data['account']['sendemail_store_id'])) {
- $customer->setSendemailStoreId($data['account']['sendemail_store_id']);
- }
-
- $isNewCustomer = $customer->isObjectNew();
+ /** @var Mage_Customer_Model_Customer $customer */
+ $customer = null;
+ $returnToEdit = false;
+ $customerId = (int)$this->getRequest()->getPost('customer_id');
+ $originalRequestData = $this->getRequest()->getPost();
+ if ($originalRequestData) {
try {
- $sendPassToEmail = false;
- // Force new customer confirmation
- if ($isNewCustomer) {
- $customer->setPassword($data['account']['password']);
- $customer->setForceConfirmed(true);
- if ($customer->getPassword() == 'auto') {
- $sendPassToEmail = true;
- $customer->setPassword($customer->generatePassword());
- }
- }
+ // optional fields might be set in request for future processing by observers in other modules
+ $accountData = $this->_extractCustomerData();
+ $addressesData = $this->_extractCustomerAddressData();
- Mage::dispatchEvent('adminhtml_customer_prepare_save', array(
- 'customer' => $customer,
- 'request' => $this->getRequest()
- ));
-
- $customer->save();
-
- // Send welcome email
- if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
- $storeId = $customer->getSendemailStoreId();
- if ($isNewCustomer) {
- $customer->sendNewAccountEmail('registered', '', $storeId);
- } elseif ((!$customer->getConfirmation())) {
- // Confirm not confirmed customer
- $customer->sendNewAccountEmail('confirmed', '', $storeId);
- }
- }
-
- if (!empty($data['account']['new_password'])) {
- $newPassword = $data['account']['new_password'];
- if ($newPassword == 'auto') {
- $newPassword = $customer->generatePassword();
- }
- $customer->changePassword($newPassword);
- $customer->sendPasswordReminderEmail();
- }
-
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
- Mage::helper('Mage_Adminhtml_Helper_Data')->__('The customer has been saved.')
- );
- Mage::dispatchEvent('adminhtml_customer_save_after', array(
- 'customer' => $customer,
- 'request' => $this->getRequest()
- ));
-
- if ($redirectBack) {
- $this->_redirect('*/*/edit', array(
- 'id' => $customer->getId(),
- '_current' => true
+ $request = $this->getRequest();
+ /** @var Mage_Core_Model_Event_Manager $eventManager */
+ $eventManager = $this->_objectManager->get('Mage_Core_Model_Event_Manager');
+ $beforeSaveCallback = function ($customer) use ($request, $eventManager) {
+ $eventManager->dispatch('adminhtml_customer_prepare_save', array(
+ 'customer' => $customer,
+ 'request' => $request
));
- return;
+ };
+ $afterSaveCallback = function ($customer) use ($request, $eventManager) {
+ $eventManager->dispatch('adminhtml_customer_save_after', array(
+ 'customer' => $customer,
+ 'request' => $request
+ ));
+ };
+
+ /** @var Mage_Customer_Service_Customer $customerService */
+ $customerService = $this->_objectManager->get('Mage_Customer_Service_Customer');
+ $customerService->setIsAdminStore(true);
+ $customerService->setBeforeSaveCallback($beforeSaveCallback);
+ $customerService->setAfterSaveCallback($afterSaveCallback);
+ if ($customerId) {
+ $customer = $customerService->update($customerId, $accountData, $addressesData);
+ } else {
+ $customer = $customerService->create($accountData, $addressesData);
}
- } catch (Mage_Core_Exception $e) {
- $this->_getSession()->addError($e->getMessage());
- $this->_getSession()->setCustomerData($data);
- $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
- } catch (Exception $e) {
- $this->_getSession()->addException($e,
- Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while saving the customer.'));
- $this->_getSession()->setCustomerData($data);
- $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id'=>$customer->getId())));
- return;
+
+ $this->_objectManager->get('Mage_Core_Model_Registry')->register('current_customer', $customer);
+ $this->_getSession()->addSuccess($this->_getHelper()->__('The customer has been saved.'));
+
+ $returnToEdit = (bool)$this->getRequest()->getParam('back', false);
+ $customerId = $customer->getId();
+ } catch (Magento_Validator_Exception $exception) {
+ $this->_addSessionErrorMessages($exception->getMessages());
+ $this->_getSession()->setCustomerData($originalRequestData);
+ $returnToEdit = true;
+ } catch (Mage_Core_Exception $exception) {
+ $messages = $exception->getMessages(Mage_Core_Model_Message::ERROR);
+ if (!count($messages)) {
+ $messages = $exception->getMessage();
+ }
+ $this->_addSessionErrorMessages($messages);
+ $this->_getSession()->setCustomerData($originalRequestData);
+ $returnToEdit = true;
+ } catch (Exception $exception) {
+ $this->_getSession()->addException($exception,
+ $this->_getHelper()->__('An error occurred while saving the customer.'));
+ $this->_getSession()->setCustomerData($originalRequestData);
+ $returnToEdit = true;
}
}
- $this->getResponse()->setRedirect($this->getUrl('*/customer'));
+
+ if ($returnToEdit) {
+ if ($customerId) {
+ $this->_redirect('*/*/edit', array('id' => $customerId, '_current' => true));
+ } else {
+ $this->_redirect('*/*/new', array('_current' => true));
+ }
+ } else {
+ $this->_redirect('*/customer');
+ }
+ }
+
+ /**
+ * Add errors messages to session.
+ *
+ * @param array|string $messages
+ */
+ protected function _addSessionErrorMessages($messages)
+ {
+ $messages = (array)$messages;
+ $session = $this->_getSession();
+
+ $callback = function ($error) use ($session) {
+ if (!($error instanceof Mage_Core_Model_Message_Error)) {
+ $error = new Mage_Core_Model_Message_Error($error);
+ }
+ $session->addMessage($error);
+ };
+ array_walk_recursive($messages, $callback);
+ }
+
+ /**
+ * Reformat customer account data to be compatible with customer service interface
+ *
+ * @return array
+ */
+ protected function _extractCustomerData()
+ {
+ $customerData = array();
+ if ($this->getRequest()->getPost('account')) {
+ $serviceAttributes = array(
+ 'password', 'new_password', 'default_billing', 'default_shipping', 'confirmation');
+
+ /** @var Mage_Customer_Model_Customer $customerEntity */
+ $customerEntity = $this->_objectManager
+ ->get('Mage_Customer_Model_Customer_Factory')
+ ->create();
+ /** @var Mage_Customer_Helper_Data $customerHelper */
+ $customerHelper = $this->_objectManager->get('Mage_Customer_Helper_Data');
+ $customerData = $customerHelper->extractCustomerData(
+ $this->getRequest(), 'adminhtml_customer', $customerEntity, $serviceAttributes, 'account');
+ }
+
+ $this->_processCustomerPassword($customerData);
+ /** @var Mage_Core_Model_Authorization $acl */
+ $acl = $this->_objectManager->get('Mage_Core_Model_Authorization');
+ if ($acl->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)) {
+ $customerData['is_subscribed'] = (bool)$this->getRequest()->getPost('subscription', false);
+ }
+
+ if (isset($customerData['disable_auto_group_change'])) {
+ $customerData['disable_auto_group_change'] = empty($customerData['disable_auto_group_change']) ? '0' : '1';
+ }
+
+ return $customerData;
+ }
+
+ /**
+ * Reformat customer addresses data to be compatible with customer service interface
+ *
+ * @return array
+ */
+ protected function _extractCustomerAddressData()
+ {
+ $addresses = $this->getRequest()->getPost('address');
+ $customerData = $this->getRequest()->getPost('account');
+ $result = array();
+ if ($addresses) {
+ if (isset($addresses['_template_'])) {
+ unset($addresses['_template_']);
+ }
+
+ /** @var Mage_Customer_Model_Address_Form $eavForm */
+ $eavForm = $this->_objectManager->create('Mage_Customer_Model_Address_Form');
+ /** @var Mage_Customer_Model_Address $addressEntity */
+ $addressEntity = $this->_objectManager
+ ->get('Mage_Customer_Model_Address_Factory')
+ ->create();
+
+ $addressIdList = array_keys($addresses);
+ /** @var Mage_Customer_Helper_Data $customerHelper */
+ $customerHelper = $this->_objectManager->get('Mage_Customer_Helper_Data');
+ foreach ($addressIdList as $addressId) {
+ $scope = sprintf('address/%s', $addressId);
+ $addressData = $customerHelper->extractCustomerData(
+ $this->getRequest(), 'adminhtml_customer_address', $addressEntity, array(), $scope, $eavForm);
+ if (is_numeric($addressId)) {
+ $addressData['entity_id'] = $addressId;
+ }
+ // Set default billing and shipping flags to address
+ $addressData['is_default_billing'] = isset($customerData['default_billing'])
+ && $customerData['default_billing']
+ && $customerData['default_billing'] == $addressId;
+ $addressData['is_default_shipping'] = isset($customerData['default_shipping'])
+ && $customerData['default_shipping']
+ && $customerData['default_shipping'] == $addressId;
+
+ $result[] = $addressData;
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Generate password if auto generated password was requested
+ *
+ * @param array $customerData
+ * @throws Mage_Core_Exception
+ */
+ protected function _processCustomerPassword(&$customerData)
+ {
+ if (isset($customerData['new_password']) && $customerData['new_password'] !== false) {
+ $customerData['password'] = $customerData['new_password'];
+ unset($customerData['new_password']);
+ }
+ if (isset($customerData['password']) && ($customerData['password'] == 'auto')) {
+ unset($customerData['password']);
+ $customerData['autogenerate_password'] = true;
+ }
}
/**
@@ -376,9 +390,8 @@
*/
public function exportCsvAction()
{
- $fileName = 'customers.csv';
- $content = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Grid')
- ->getCsvFile();
+ $fileName = 'customers.csv';
+ $content = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Grid')->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);
}
@@ -440,8 +453,8 @@
Mage::getModel('Mage_Wishlist_Model_Item')->load($itemId)
->delete();
}
- catch (Exception $e) {
- Mage::logException($e);
+ catch (Exception $exception) {
+ Mage::logException($exception);
}
}
}
@@ -499,7 +512,7 @@
public function viewCartAction()
{
$this->_initCustomer();
- $layout = $this->loadLayout()
+ $this->loadLayout()
->getLayout()
->getBlock('admin.customer.view.cart')
->setWebsiteId((int)$this->getRequest()->getParam('website_id'));
@@ -532,54 +545,93 @@
$this->renderLayout();
}
+ /**
+ * AJAX customer validation action
+ */
public function validateAction()
{
- $response = new Varien_Object();
+ $response = new Varien_Object();
$response->setError(0);
- $websiteId = Mage::app()->getStore()->getWebsiteId();
- $accountData = $this->getRequest()->getPost('account');
- $customer = Mage::getModel('Mage_Customer_Model_Customer');
- $customerId = $this->getRequest()->getParam('id');
- if ($customerId) {
- $customer->load($customerId);
- $websiteId = $customer->getWebsiteId();
- } else if (isset($accountData['website_id'])) {
- $websiteId = $accountData['website_id'];
+ $customer = $this->_validateCustomer($response);
+ if ($customer) {
+ $this->_validateCustomerAddress($response, $customer);
}
- /* @var $customerForm Mage_Customer_Model_Form */
- $customerForm = Mage::getModel('Mage_Customer_Model_Form');
- $customerForm->setEntity($customer)
- ->setFormCode('adminhtml_customer')
- ->setIsAjaxRequest(true)
- ->ignoreInvisible(false)
- ;
+ if ($response->getError()) {
+ $this->_initLayoutMessages('Mage_Adminhtml_Model_Session');
+ $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
+ }
- $data = $customerForm->extractData($this->getRequest(), 'account');
- $errors = $customerForm->validateData($data);
- if ($errors !== true) {
+ $this->getResponse()->setBody($response->toJson());
+ }
+
+ /**
+ * Customer validation
+ *
+ * @param Varien_Object $response
+ * @return Mage_Customer_Model_Customer|null
+ */
+ protected function _validateCustomer($response)
+ {
+ $customer = null;
+ $errors = null;
+
+ try {
+ /** @var Mage_Customer_Model_Customer $customer */
+ $customer = $this->_objectManager->create('Mage_Customer_Model_Customer');
+ $customerId = $this->getRequest()->getParam('id');
+ if ($customerId) {
+ $customer->load($customerId);
+ }
+
+ /* @var $customerForm Mage_Customer_Model_Form */
+ $customerForm = $this->_objectManager->get('Mage_Customer_Model_Form');
+ $customerForm->setEntity($customer)
+ ->setFormCode('adminhtml_customer')
+ ->setIsAjaxRequest(true)
+ ->ignoreInvisible(false);
+ $data = $customerForm->extractData($this->getRequest(), 'account');
+ $accountData = $this->getRequest()->getPost('account');
+ $this->_processCustomerPassword($accountData);
+ if (isset($accountData['autogenerate_password'])) {
+ $data['password'] = $customer->generatePassword();
+ } else {
+ $data['password'] = $accountData['password'];
+ }
+ $data['confirmation'] = $data['password'];
+
+ if ($customer->getWebsiteId()) {
+ unset($data['website_id']);
+ }
+
+ $customer->addData($data);
+ $errors = $customer->validate();
+ } catch (Mage_Core_Exception $exception) {
+ /* @var $error Mage_Core_Model_Message_Error */
+ foreach ($exception->getMessages(Mage_Core_Model_Message::ERROR) as $error) {
+ $errors[] = $error->getCode();
+ }
+ }
+
+ if ($errors !== true && !empty($errors)) {
foreach ($errors as $error) {
$this->_getSession()->addError($error);
}
$response->setError(1);
}
- # additional validate email
- if (!$response->getError()) {
- # Trying to load customer with the same email and return error message
- # if customer with the same email address exisits
- $checkCustomer = Mage::getModel('Mage_Customer_Model_Customer')
- ->setWebsiteId($websiteId);
- $checkCustomer->loadByEmail($accountData['email']);
- if ($checkCustomer->getId() && ($checkCustomer->getId() != $customer->getId())) {
- $response->setError(1);
- $this->_getSession()->addError(
- Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customer with the same email already exists.')
- );
- }
- }
+ return $customer;
+ }
+ /**
+ * Customer address validation.
+ *
+ * @param Varien_Object $response
+ * @param Mage_Customer_Model_Customer $customer
+ */
+ protected function _validateCustomerAddress($response, $customer)
+ {
$addressesData = $this->getRequest()->getParam('address');
if (is_array($addressesData)) {
/* @var $addressForm Mage_Customer_Model_Form */
@@ -607,21 +659,16 @@
}
}
}
-
- if ($response->getError()) {
- $this->_initLayoutMessages('Mage_Adminhtml_Model_Session');
- $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
- }
-
- $this->getResponse()->setBody($response->toJson());
}
+ /**
+ * Customer mass subscribe action
+ */
public function massSubscribeAction()
{
$customersIds = $this->getRequest()->getParam('customer');
if(!is_array($customersIds)) {
Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select customer(s).'));
-
} else {
try {
foreach ($customersIds as $customerId) {
@@ -632,13 +679,16 @@
Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were updated.', count($customersIds))
);
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
+ } catch (Exception $exception) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($exception->getMessage());
}
}
$this->_redirect('*/*/index');
}
+ /**
+ * Customer mass unsubscribe action
+ */
public function massUnsubscribeAction()
{
$customersIds = $this->getRequest()->getParam('customer');
@@ -654,14 +704,17 @@
Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were updated.', count($customersIds))
);
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
+ } catch (Exception $exception) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($exception->getMessage());
}
}
$this->_redirect('*/*/index');
}
+ /**
+ * Customer mass delete action
+ */
public function massDeleteAction()
{
$customersIds = $this->getRequest()->getParam('customer');
@@ -678,14 +731,17 @@
Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were deleted.', count($customersIds))
);
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
+ } catch (Exception $exception) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($exception->getMessage());
}
}
$this->_redirect('*/*/index');
}
+ /**
+ * Customer mass assign group action
+ */
public function massAssignGroupAction()
{
$customersIds = $this->getRequest()->getParam('customer');
@@ -701,14 +757,17 @@
Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were updated.', count($customersIds))
);
- } catch (Exception $e) {
- Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
+ } catch (Exception $exception) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($exception->getMessage());
}
}
$this->_redirect('*/*/index');
}
+ /**
+ * Customer view file action
+ */
public function viewfileAction()
{
$file = null;
@@ -781,6 +840,10 @@
exit();
}
+ /**
+ * Customer access rights checking
+ * @return bool
+ */
protected function _isAllowed()
{
return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Customer::manage');
diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
index 3bbee32..127ff0f 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
@@ -149,7 +149,9 @@
} elseif ($orderItem->getParentItem() && isset($backToStock[$parentId]) && $backToStock[$parentId]) {
$creditmemoItem->setBackToStock(true);
} elseif (empty($savedData)) {
- $creditmemoItem->setBackToStock(Mage::helper('Mage_CatalogInventory_Helper_Data')->isAutoReturnEnabled());
+ $creditmemoItem->setBackToStock(
+ Mage::helper('Mage_CatalogInventory_Helper_Data')->isAutoReturnEnabled()
+ );
} else {
$creditmemoItem->setBackToStock(false);
}
@@ -387,12 +389,12 @@
Mage::throwException($this->__('The Comment Text field cannot be empty.'));
}
$creditmemo = $this->_initCreditmemo();
- $creditmemo->addComment(
+ $comment = $creditmemo->addComment(
$data['comment'],
isset($data['is_customer_notified']),
isset($data['is_visible_on_front'])
);
- $creditmemo->save();
+ $comment->save();
$creditmemo->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']);
$this->loadLayout();
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml
deleted file mode 100644
index 282028f..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/role_users_grid_js.phtml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<script type="text/javascript">
-<!--
-<?php $myBlock = $this->getLayout()->getBlock('roleUsersGrid'); ?>
-<?php if( is_object($myBlock) && $myBlock->getJsObjectName() ): ?>
- var checkBoxes = $H({});
- var warning = false;
- var inRoleUsers = $H(<?php echo $myBlock->_getUsers(true) ?>);
- if (inRoleUsers.size() > 0) warning = true;
- $('in_role_user').value = inRoleUsers.toQueryString();
-
- function registerUserRole(grid, element, checked){
- if(checked){
- inRoleUsers.set(element.value, 0);
- } else {
- inRoleUsers.unset(element.value);
- }
- $('in_role_user').value = inRoleUsers.toQueryString();
- grid.reloadParams = {'in_role_user[]':inRoleUsers.keys()};
- }
-
- function roleUsersRowClick(grid, event){
- var trElement = Event.findElement(event, 'tr');
- var isInput = Event.element(event).tagName == 'INPUT';
- if(trElement){
- var checkbox = Element.getElementsBySelector(trElement, 'input');
- if(checkbox[0]){
- var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
- if (warning && checkBoxes.size() > 0) {
- if ( !confirm("<?php echo $this->__('Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?') ?>") ) {
- checkbox[0].checked = false;
- checkBoxes.each(function(elem) {
- if (elem.value.status == 1) {
- elem.value.object.checked = true;
- }
- });
- return false;
- }
- warning = false;
- }
- <?php echo $myBlock->getJsObjectName() ?>.setCheckboxChecked(checkbox[0], checked);
- }
- }
- }
-
- function roleUsersRowInit(grid, row){
- var checkbox = $(row).getElementsByClassName('checkbox')[0];
- if (checkbox) {
- checkBoxes.set(checkbox.value, {'status' : ((checkbox.checked) ? 1 : 0), 'object' : checkbox});
- }
- }
-
- function myhandler(obj)
- {
- if (checkBoxes.size() > 0) {
- if ( !confirm("<?php echo $this->__('Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?') ?>") ) {
- obj.checked = false;
- checkBoxes.each(function(elem) {
- if (elem.value.status == 1) {
- elem.value.object.checked = true;
- }
- });
- return false;
- }
- warning = false;
- }
- checkBoxes.each(function(elem) {
- <?php echo $myBlock->getJsObjectName() ?>.setCheckboxChecked(elem.value.object, obj.checked);
- });
- }
-
-<?php echo $myBlock->getJsObjectName() ?>.rowClickCallback = roleUsersRowClick;
-<?php echo $myBlock->getJsObjectName() ?>.initRowCallback = roleUsersRowInit;
-<?php echo $myBlock->getJsObjectName() ?>.checkboxCheckCallback = registerUserRole;
-<?php echo $myBlock->getJsObjectName() ?>.checkCheckboxes = myhandler;
-<?php echo $myBlock->getJsObjectName() ?>.rows.each(function(row){roleUsersRowInit(<?php echo $myBlock->getJsObjectName() ?>, row)});
- $('in_role_user_old').value = $('in_role_user').value;
-<?php endif; ?>
-//-->
-</script>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/roleinfo.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/roleinfo.phtml
deleted file mode 100644
index 1316df7..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/roleinfo.phtml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-/** @var $this Mage_Adminhtml_Block_Api_Tab_Roleinfo */
-
-?>
-<div class="content-header">
- <table cellspacing="0">
- <tr>
- <td style="width:50%;"><h3 class="icon-head head-permissions-role"><?php echo ($this->getRoleId() > 0 ) ? ($this->__('Edit Role') . " '{$this->escapeHtml($this->getRoleInfo()->getRoleName())}'") : $this->__('Add New Role') ?></h3></td>
- <td class="form-buttons">
- <?php echo $this->getBackButtonHtml() ?>
- <?php echo $this->getResetButtonHtml() ?>
- <?php echo $this->getDeleteButtonHtml() ?>
- <?php echo $this->getSaveButtonHtml() ?>
- </td>
- </tr>
- </table>
-</div>
-<form action="<?php echo $this->getUrl('*/*/saverole') ?>" method="post" id="role-edit-form">
- <?php echo $this->getBlockHtml('formkey')?>
-</form>
-<script type="text/javascript">
- jQuery('#role-edit-form').form().validation();
-</script>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/roles.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/roles.phtml
deleted file mode 100644
index 5e1ba95..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/roles.phtml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<div class="content-header">
- <table cellspacing="0">
- <tr>
- <td style="width:50%;"><h3 class="icon-head head-permissions-role"><?php echo $this->__('Roles') ?></h3></td>
- <td class="form-buttons">
- <button class="scalable add" onclick="window.location='<?php echo $this->getAddNewUrl() ?>'"><span><span><span><?php echo $this->__('Add New Role') ?></span></span></span></button>
- </td>
- </tr>
- </table>
-</div>
-<?php echo $this->getGridHtml() ?>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml
deleted file mode 100644
index 756a9ec..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesedit.phtml
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<div class="entry-edit">
- <div class="entry-edit-head">
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Roles Resources') ?></h4>
- </div>
- <input type="hidden" name="resource" id="role_resources" value="">
- <fieldset id="role_resources">
-
- <span class="field-row">
- <label for="all"><?php echo $this->__('Resource Access') ?></label>
- <select id="all" name="all" onchange="$('resources_container').toggle()" class="select">
- <option value="0" <?php echo ($this->getEverythingAllowed()?'':'selected="selected"'); ?>><?php echo $this->__('Custom') ?></option>
- <option value="1" <?php echo ($this->getEverythingAllowed()?'selected="selected"':''); ?>><?php echo $this->__('All') ?></option>
- </select>
- </span>
-
- <span class="field-row" id="resources_container">
- <label><?php echo $this->__('Resources') ?></label>
- <div class="f-left">
- <div class="tree x-tree" id="resource-tree"></div>
- </div>
- </span>
-
- </fieldset>
-</div>
-<!-- Draw Resources Tree -->
-<script type="text/javascript">
-<?php if($this->getEverythingAllowed()): ?>
- $('resources_container').hide();
-<?php endif; ?>
-Ext.EventManager.onDocumentReady(function() {
- var tree = new Ext.tree.TreePanel('resource-tree', {
- animate:false,
- loader: false,
- enableDD:false,
- containerScroll: true,
- rootUIProvider: Ext.tree.CheckboxNodeUI,
- selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
- rootVisible: false
- });
-
- tree.on('check', checkHandler, tree);
-
- // set the root node
- var root = new Ext.tree.TreeNode({
- text: 'root',
- draggable:false,
- checked:'false',
- id:'__root__',
- uiProvider: Ext.tree.CheckboxNodeUI
- });
-
- tree.setRootNode(root);
- bildResourcesTree(root, <?php echo $this->getResTreeJson() ?>);
- tree.addListener('click', resourceClick.createDelegate(this));
-
- // render the tree
- tree.render();
- // root.expand();
- tree.expandAll();
-
- $('role_resources').value = tree.getChecked().join(',');
-});
-
-function resourceClick(node, e){
- node.getUI().check(!node.getUI().checked());
- varienElementMethods.setHasChanges(Event.element(e), e);
-};
-
-function bildResourcesTree(parent, config){
- if (!config) return null;
-
- if (parent && config && config.length){
- for (var i = 0; i < config.length; i++){
- config[i].uiProvider = Ext.tree.CheckboxNodeUI;
- var node = new Ext.tree.TreeNode(config[i]);
- parent.appendChild(node);
- if(config[i].children){
- bildResourcesTree(node, config[i].children);
- }
- }
- }
-}
-
-function checkHandler(node)
-{
- if ( node.attributes.checked && node.parentNode ) {
- var n = node.parentNode;
- this.removeListener('check', checkHandler);
- do {
- if (!n || n.attributes.id == 'admin' || n.attributes.id == '__root__') {
- break;
- } else {
- n.ui.check(true);
- }
- } while (n = n.parentNode );
- this.on('check', checkHandler);
- }
- if ( !node.isLeaf() && node.hasChildNodes() ) {
- this.removeListener('check', checkHandler);
- processChildren(node, node.attributes.checked);
- this.on('check', checkHandler);
- }
- $('role_resources').value = this.getChecked().join(',');
-}
-
-function processChildren(node, state)
-{
- if ( !node.hasChildNodes() ) return false;
- for(var i = 0; i < node.childNodes.length; i++ ) {
- node.childNodes[i].ui.check(state);
- if ( node.childNodes[i].hasChildNodes() ) {
- processChildren(node.childNodes[i], state);
- }
- }
- return true;
-}
-</script>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
deleted file mode 100644
index 9ac85ac..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/rolesusers.phtml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Role Users') ?></h4>
-<?php echo $this->_getGridHtml() ?>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
deleted file mode 100644
index 312a049..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/user_roles_grid_js.phtml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<script type="text/javascript">
-<!--
-<?php $myBlock = $this->getLayout()->getBlock('user.roles.grid'); ?>
-<?php if( is_object($myBlock) && $myBlock->getJsObjectName()): ?>
- var radioBoxes = $H({});
- var warning = false;
- var userRoles = $H(<?php echo $myBlock->_getSelectedRoles(true) ?>);
- if (userRoles.size() > 0) warning = true;
- $('user_user_roles').value = userRoles.toQueryString();
-
- function registerUserRole(grid, element, checked){
- if(checked){
- userRoles.each(function(o){userRoles.remove(o[0]);});
- userRoles[element.value] = 0;
- } else {
- userRoles.remove(element.value);
- }
- $('user_user_roles').value = userRoles.toQueryString();
- grid.reloadParams = {'user_roles[]':userRoles.keys()};
- }
-
- function roleRowClick(grid, event){
- var trElement = Event.findElement(event, 'tr');
- var isInput = Event.element(event).tagName == 'INPUT';
- if(trElement){
- var checkbox = Element.getElementsBySelector(trElement, 'input');
- if(checkbox[0] && !checkbox[0].checked){
- var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
- if (checked && warning && radioBoxes.size() > 0) {
- if ( !confirm("<?php echo $this->__('Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?') ?>") ) {
- checkbox[0].checked = false;
- for(i in radioBoxes) {
- if( radioBoxes[i].status == 1) {
- radioBoxes[i].object.checked = true;
- }
- }
- return false;
- }
- warning = false;
- }
- <?php echo $myBlock->getJsObjectName() ?>.setCheckboxChecked(checkbox[0], checked);
- }
- }
- }
-
- function rolesRowInit(grid, row){
- var checkbox = $(row).getElementsByClassName('radio')[0];
- if (checkbox) {
- radioBoxes[checkbox.value] = {'status' : ((checkbox.checked) ? 1 : 0), 'object' : checkbox};
- }
- }
-
-<?php echo $myBlock->getJsObjectName() ?>.rowClickCallback = roleRowClick;
-<?php echo $myBlock->getJsObjectName() ?>.initRowCallback = rolesRowInit;
-<?php echo $myBlock->getJsObjectName() ?>.checkboxCheckCallback = registerUserRole;
-<?php echo $myBlock->getJsObjectName() ?>.rows.each(function(row){rolesRowInit(<?php echo $myBlock->getJsObjectName() ?>, row)});
-<?php endif; ?>
-//-->
-</script>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml
deleted file mode 100644
index a4a595a..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/userinfo.phtml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<div class="content-header">
- <table cellspacing="0">
- <tr>
- <td style="width:50%;">
- <h3>
- <?php if($this->getUser()->getUserId()): ?>
- <?php $_userName = $this->getUser()->getFirstname() . ' ' . $this->getUser()->getLastname() ?>
- <?php echo $this->__("Edit User '%s'", $_userName) ?>
- <?php else: ?>
- <?php echo $this->__('Add New User') ?>
- <?php endif; ?>
- </h3>
- </td>
- <td class="form-buttons">
- <?php echo $this->getBackButtonHtml() ?>
- <?php echo $this->getResetButtonHtml() ?>
- <?php echo $this->getDeleteButtonHtml() ?>
- <?php echo $this->getSaveButtonHtml() ?>
- </table>
-</div>
-<form action="<?php echo $this->getUrl('*/*/saveuser') ?>" method="post" id="user-edit-form">
- <?php echo $this->getBlockHtml('formkey')?>
-</form>
-<script type="text/javascript">
- jQuery('#user-edit-form').form().validation();
-</script>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml
deleted file mode 100644
index 3180c5a..0000000
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/api/usernroles.phtml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category design
- * @package default_default
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
-?>
-<div id="roles">
- <li class="add"><a href="<?php echo $this->getUrl('*/*/edituser') ?>"><?php echo $this->__('Add New User') ?></a></li>
- <li class="add"><a href="<?php echo $this->getUrl('*/*/editroles') ?>"><?php echo $this->__('Add New Role') ?></a></li>
-</div>
-<div class="clear"></div>
diff --git a/app/code/core/Mage/Adminhtml/view/adminhtml/system/shipping/ups.phtml b/app/code/core/Mage/Adminhtml/view/adminhtml/system/shipping/ups.phtml
index edbef89..32ecdf1 100644
--- a/app/code/core/Mage/Adminhtml/view/adminhtml/system/shipping/ups.phtml
+++ b/app/code/core/Mage/Adminhtml/view/adminhtml/system/shipping/ups.phtml
@@ -124,8 +124,7 @@
while (freeMethod.length > 0) {
freeMethod.remove(0);
}
-
- freeMethod.insert(new Element('option', {value:''}).update('None'));
+ freeMethod.insert(new Element('option', {value:''}).update('<?php echo $_coreHelper->escapeHtml(Mage::helper('Mage_Shipping_Helper_Data')->__('None')); ?>'));
var code, option;
for (code in originShipment) {
diff --git a/app/code/core/Mage/Api/Controller/Action.php b/app/code/core/Mage/Api/Controller/Action.php
deleted file mode 100644
index da4a74c..0000000
--- a/app/code/core/Mage/Api/Controller/Action.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Generic API controller
- */
-class Mage_Api_Controller_Action extends Mage_Core_Controller_Front_Action
-{
- /**
- * Currently used area
- *
- * @var string
- */
- protected $_currentArea = 'adminhtml';
-
- /**
- * Use 'admin' store and prevent the session from starting
- *
- * @return Mage_Api_Controller_Action
- */
- public function preDispatch()
- {
- Mage::app()->setCurrentStore('admin');
- $this->setFlag('', self::FLAG_NO_START_SESSION, 1);
- parent::preDispatch();
- return $this;
- }
-
- /**
- * Retrieve webservice server
- *
- * @return Mage_Api_Model_Server
- */
- protected function _getServer()
- {
- return Mage::getSingleton('Mage_Api_Model_Server');
- }
-}
diff --git a/app/code/core/Mage/Api/Exception.php b/app/code/core/Mage/Api/Exception.php
deleted file mode 100644
index 1da500e..0000000
--- a/app/code/core/Mage/Api/Exception.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Api exception
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Exception extends Mage_Core_Exception
-{
- protected $_customMessage = null;
-
- public function __construct($faultCode, $customMessage=null)
- {
- parent::__construct($faultCode);
- $this->_customMessage = $customMessage;
- }
-
- /**
- * Custom error message, if error is not in api.
- *
- * @return unknown
- */
- public function getCustomMessage()
- {
- return $this->_customMessage;
- }
-} // Class Mage_Api_Model_Resource_Exception End
diff --git a/app/code/core/Mage/Api/Helper/Data.php b/app/code/core/Mage/Api/Helper/Data.php
deleted file mode 100644
index 8d1bd3d..0000000
--- a/app/code/core/Mage/Api/Helper/Data.php
+++ /dev/null
@@ -1,338 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Web service api main helper
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Helper_Data extends Mage_Core_Helper_Abstract
-{
- const XML_PATH_API_WSI = 'api/config/compliance_wsi';
-
- /**
- * Method to find adapter code depending on WS-I compatibility setting
- *
- * @return string
- */
- public function getV2AdapterCode()
- {
- return $this->isComplianceWSI() ? 'soap_wsi' : 'soap_v2';
- }
-
- /**
- * @return boolean
- */
- public function isComplianceWSI()
- {
- return Mage::getStoreConfig(self::XML_PATH_API_WSI);
- }
-
- /**
- * Go thru a WSI args array and turns it to correct state.
- *
- * @param Object $obj - Link to Object
- * @return Object
- */
- public function wsiArrayUnpacker(&$obj)
- {
- if (is_object($obj)) {
-
- $modifiedKeys = $this->clearWsiFootprints($obj);
-
- foreach ($obj as $key => $value) {
- if (is_object($value)) {
- $this->wsiArrayUnpacker($value);
- }
- if (is_array($value)) {
- foreach ($value as &$val) {
- if (is_object($val)) {
- $this->wsiArrayUnpacker($val);
- }
- }
- }
- }
-
- foreach ($modifiedKeys as $arrKey) {
- $this->associativeArrayUnpack($obj->$arrKey);
- }
- }
- }
-
- /**
- * Go thru an object parameters and unpak associative object to array.
- *
- * @param Object $obj - Link to Object
- * @return Object
- */
- public function v2AssociativeArrayUnpacker(&$obj)
- {
- if (is_object($obj)
- && property_exists($obj, 'key')
- && property_exists($obj, 'value')
- ) {
- if (count(array_keys(get_object_vars($obj))) == 2) {
- $obj = array($obj->key => $obj->value);
- return true;
- }
- } elseif (is_array($obj)) {
- $arr = array();
- $needReplacement = true;
- foreach ($obj as $key => &$value) {
- $isAssoc = $this->v2AssociativeArrayUnpacker($value);
- if ($isAssoc) {
- foreach ($value as $aKey => $aVal) {
- $arr[$aKey] = $aVal;
- }
- } else {
- $needReplacement = false;
- }
- }
- if ($needReplacement) {
- $obj = $arr;
- }
- } elseif (is_object($obj)) {
- $objectKeys = array_keys(get_object_vars($obj));
-
- foreach ($objectKeys as $key) {
- $this->v2AssociativeArrayUnpacker($obj->$key);
- }
- }
- return false;
- }
-
- /**
- * Go thru mixed and turns it to a correct look.
- *
- * @param Mixed $mixed A link to variable that may contain associative array.
- */
- public function associativeArrayUnpack(&$mixed)
- {
- if (is_array($mixed)) {
- $tmpArr = array();
- foreach ($mixed as $key => $value) {
- if (is_object($value)) {
- $value = get_object_vars($value);
- if (count($value) == 2 && isset($value['key']) && isset($value['value'])) {
- $tmpArr[$value['key']] = $value['value'];
- }
- }
- }
- if (count($tmpArr)) {
- $mixed = $tmpArr;
- }
- }
-
- if (is_object($mixed)) {
- $numOfVals = count(get_object_vars($mixed));
- if ($numOfVals == 2 && isset($mixed->key) && isset($mixed->value)) {
- $mixed = get_object_vars($mixed);
- /*
- * Processing an associative arrays.
- * $mixed->key = '2'; $mixed->value = '3'; turns to array(2 => '3');
- */
- $mixed = array($mixed['key'] => $mixed['value']);
- }
- }
- }
-
- /**
- * Corrects data representation.
- *
- * @param Object $obj - Link to Object
- * @return Object
- */
- public function clearWsiFootprints(&$obj)
- {
- $modifiedKeys = array();
-
- $objectKeys = array_keys(get_object_vars($obj));
-
- foreach ($objectKeys as $key) {
- if (is_object($obj->$key) && isset($obj->$key->complexObjectArray)) {
- if (is_array($obj->$key->complexObjectArray)) {
- $obj->$key = $obj->$key->complexObjectArray;
- } else { // for one element array
- $obj->$key = array($obj->$key->complexObjectArray);
- }
- $modifiedKeys[] = $key;
- }
- }
- return $modifiedKeys;
- }
-
- /**
- * For the WSI, generates an response object.
- *
- * @param mixed $mixed - Link to Object
- * @return mixed
- */
- public function wsiArrayPacker($mixed)
- {
- if (is_array($mixed)) {
- $arrKeys = array_keys($mixed);
- $isDigit = false;
- $isString = false;
- foreach ($arrKeys as $key) {
- if (is_int($key)) {
- $isDigit = true;
- break;
- }
- }
- if ($isDigit) {
- $mixed = $this->packArrayToObjec($mixed);
- } else {
- $mixed = (object) $mixed;
- }
- }
- if (is_object($mixed) && isset($mixed->complexObjectArray)) {
- foreach ($mixed->complexObjectArray as $k => $v) {
- $mixed->complexObjectArray[$k] = $this->wsiArrayPacker($v);
- }
- }
- return $mixed;
- }
-
- /**
- * For response to the WSI, generates an object from array.
- *
- * @param Array $arr - Link to Object
- * @return Object
- */
- public function packArrayToObjec(Array $arr)
- {
- $obj = new stdClass();
- $obj->complexObjectArray = $arr;
- return $obj;
- }
-
- /**
- * Convert objects and arrays to array recursively
- *
- * @param array|object $data
- * @return void
- */
- public function toArray(&$data)
- {
- if (is_object($data)) {
- $data = get_object_vars($data);
- }
- if (is_array($data)) {
- foreach ($data as &$value) {
- if (is_array($value) or is_object($value)) {
- $this->toArray($value);
- }
- }
- }
- }
-
- /**
- * Parse filters and format them to be applicable for collection filtration
- *
- * @param null|object|array $filters
- * @param array $fieldsMap Map of field names in format: array('field_name_in_filter' => 'field_name_in_db')
- * @return array
- */
- public function parseFilters($filters, $fieldsMap = null)
- {
- // if filters are used in SOAP they must be represented in array format to be used for collection filtration
- if (is_object($filters)) {
- $parsedFilters = array();
- // parse simple filter
- if (isset($filters->filter) && is_array($filters->filter)) {
- foreach ($filters->filter as $field => $value) {
- if (is_object($value) && isset($value->key) && isset($value->value)) {
- $parsedFilters[$value->key] = $value->value;
- } else {
- $parsedFilters[$field] = $value;
- }
- }
- }
- // parse complex filter
- if (isset($filters->complex_filter) && is_array($filters->complex_filter)) {
- if ($this->isComplianceWSI()) {
- // WS-I compliance mode
- foreach ($filters->complex_filter as $fieldName => $condition) {
- if (is_object($condition) && isset($condition->key) && isset($condition->value)) {
- $conditionName = $condition->key;
- $conditionValue = $condition->value;
- $this->formatFilterConditionValue($conditionName, $conditionValue);
- $parsedFilters[$fieldName] = array($conditionName => $conditionValue);
- }
- }
- } else {
- // non WS-I compliance mode
- foreach ($filters->complex_filter as $value) {
- if (is_object($value) && isset($value->key) && isset($value->value)) {
- $fieldName = $value->key;
- $condition = $value->value;
- if (is_object($condition) && isset($condition->key) && isset($condition->value)) {
- $this->formatFilterConditionValue($condition->key, $condition->value);
- $parsedFilters[$fieldName] = array($condition->key => $condition->value);
- }
- }
- }
- }
- }
- $filters = $parsedFilters;
- }
- // make sure that method result is always array
- if (!is_array($filters)) {
- $filters = array();
- }
- // apply fields mapping
- if (isset($fieldsMap) && is_array($fieldsMap)) {
- foreach ($filters as $field => $value) {
- if (isset($fieldsMap[$field])) {
- unset($filters[$field]);
- $field = $fieldsMap[$field];
- $filters[$field] = $value;
- }
- }
- }
- return $filters;
- }
-
- /**
- * Convert condition value from the string into the array
- * for the condition operators that require value to be an array.
- * Condition value is changed by reference
- *
- * @param string $conditionOperator
- * @param string $conditionValue
- */
- public function formatFilterConditionValue($conditionOperator, &$conditionValue)
- {
- if (is_string($conditionOperator) && in_array($conditionOperator, array('in', 'nin', 'finset'))
- && is_string($conditionValue)
- ) {
- $delimiter = ',';
- $conditionValue = explode($delimiter, $conditionValue);
- }
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Acl.php b/app/code/core/Mage/Api/Model/Acl.php
deleted file mode 100644
index 1c9ded5..0000000
--- a/app/code/core/Mage/Api/Model/Acl.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Acl model
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl extends Zend_Acl
-{
- /**
- * All the group roles are prepended by G
- *
- */
- const ROLE_TYPE_GROUP = 'G';
-
- /**
- * All the user roles are prepended by U
- *
- */
- const ROLE_TYPE_USER = 'U';
-
- /**
- * User types for store access
- * G - Guest customer (anonymous)
- * C - Authenticated customer
- * A - Authenticated admin user
- *
- */
- const USER_TYPE_GUEST = 'G';
- const USER_TYPE_CUSTOMER = 'C';
- const USER_TYPE_ADMIN = 'A';
-
- /**
- * Permission level to deny access
- *
- */
- const RULE_PERM_DENY = 0;
-
- /**
- * Permission level to inheric access from parent role
- *
- */
- const RULE_PERM_INHERIT = 1;
-
- /**
- * Permission level to allow access
- *
- */
- const RULE_PERM_ALLOW = 2;
-
- /**
- * Get role registry object or create one
- *
- * @return Mage_Api_Model_Acl_Role_Registry
- */
- protected function _getRoleRegistry()
- {
- if (null === $this->_roleRegistry) {
- $this->_roleRegistry = Mage::getModel('Mage_Api_Model_Acl_Role_Registry');
- }
- return $this->_roleRegistry;
- }
-
- /**
- * Add parent to role object
- *
- * @param Zend_Acl_Role $role
- * @param Zend_Acl_Role $parent
- * @return Mage_Api_Model_Acl
- */
- public function addRoleParent($role, $parent)
- {
- $this->_getRoleRegistry()->addParent($role, $parent);
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Acl/Resource.php b/app/code/core/Mage/Api/Model/Acl/Resource.php
deleted file mode 100644
index f363df9..0000000
--- a/app/code/core/Mage/Api/Model/Acl/Resource.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Acl resource
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl_Resource extends Zend_Acl_Resource
-{
-
-}
diff --git a/app/code/core/Mage/Api/Model/Acl/Role.php b/app/code/core/Mage/Api/Model/Acl/Role.php
deleted file mode 100644
index 72d1525..0000000
--- a/app/code/core/Mage/Api/Model/Acl/Role.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * User acl role
- *
- * @method Mage_Api_Model_Resource_Role _getResource()
- * @method Mage_Api_Model_Resource_Role getResource()
- * @method int getParentId()
- * @method Mage_Api_Model_Acl_Role setParentId(int $value)
- * @method int getTreeLevel()
- * @method Mage_Api_Model_Acl_Role setTreeLevel(int $value)
- * @method int getSortOrder()
- * @method Mage_Api_Model_Acl_Role setSortOrder(int $value)
- * @method string getRoleType()
- * @method Mage_Api_Model_Acl_Role setRoleType(string $value)
- * @method int getUserId()
- * @method Mage_Api_Model_Acl_Role setUserId(int $value)
- * @method string getRoleName()
- * @method Mage_Api_Model_Acl_Role setRoleName(string $value)
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl_Role extends Mage_Core_Model_Abstract
-{
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Resource_Role');
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Generic.php b/app/code/core/Mage/Api/Model/Acl/Role/Generic.php
deleted file mode 100644
index ac7d899..0000000
--- a/app/code/core/Mage/Api/Model/Acl/Role/Generic.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * User acl role
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl_Role_Generic extends Zend_Acl_Role
-{
-
-}
diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Group.php b/app/code/core/Mage/Api/Model/Acl/Role/Group.php
deleted file mode 100644
index 6ded6c4..0000000
--- a/app/code/core/Mage/Api/Model/Acl/Role/Group.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Acl Group model
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl_Role_Group extends Mage_Api_Model_Acl_Role_Generic
-{
-
-}
diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php
deleted file mode 100644
index 4bb9d78..0000000
--- a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Acl role registry
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl_Role_Registry extends Zend_Acl_Role_Registry
-{
- /**
- * Add parent to the $role node
- *
- * @param Zend_Acl_Role_Interface|string $role
- * @param array|Zend_Acl_Role_Interface|string $parents
- * @return Mage_Auth_Model_Acl_Role_Registry
- */
- function addParent($role, $parents)
- {
- try {
- if ($role instanceof Zend_Acl_Role_Interface) {
- $roleId = $role->getRoleId();
- } else {
- $roleId = $role;
- $role = $this->get($role);
- }
- } catch (Zend_Acl_Role_Registry_Exception $e) {
- throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist");
- }
-
- if (!is_array($parents)) {
- $parents = array($parents);
- }
- foreach ($parents as $parent) {
- try {
- if ($parent instanceof Zend_Acl_Role_Interface) {
- $roleParentId = $parent->getRoleId();
- } else {
- $roleParentId = $parent;
- }
- $roleParent = $this->get($roleParentId);
- } catch (Zend_Acl_Role_Registry_Exception $e) {
- throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist");
- }
- $this->_roles[$roleId]['parents'][$roleParentId] = $roleParent;
- $this->_roles[$roleParentId]['children'][$roleId] = $role;
- }
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Acl/Role/User.php b/app/code/core/Mage/Api/Model/Acl/Role/User.php
deleted file mode 100644
index 494b0b5..0000000
--- a/app/code/core/Mage/Api/Model/Acl/Role/User.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * User acl role
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Acl_Role_User extends Mage_Api_Model_Acl_Role_Generic
-{
-
-}
diff --git a/app/code/core/Mage/Api/Model/Config.php b/app/code/core/Mage/Api/Model/Config.php
deleted file mode 100644
index d24a42e..0000000
--- a/app/code/core/Mage/Api/Model/Config.php
+++ /dev/null
@@ -1,291 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice api config model
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Config extends Varien_Simplexml_Config
-{
- const CACHE_TAG = 'config_api';
-
- /**
- * Constructor
- *
- * @see Varien_Simplexml_Config
- */
- public function __construct($sourceData=null)
- {
- $this->setCacheId('config_api');
- $this->setCacheTags(array(self::CACHE_TAG));
-
- parent::__construct($sourceData);
- $this->_construct();
- }
-
- /**
- * Init configuration for webservices api
- *
- * @return Mage_Api_Model_Config
- */
- protected function _construct()
- {
- if (Mage::app()->useCache('config_api')) {
- if ($this->loadCache()) {
- return $this;
- }
- }
-
- $config = Mage::getConfig()->loadModulesConfiguration('api.xml');
- $this->setXml($config->getNode('api'));
-
- if (Mage::app()->useCache('config_api')) {
- $this->saveCache();
- }
- return $this;
- }
-
- /**
- * Retrieve adapter aliases from config.
- *
- * @return array
- */
- public function getAdapterAliases()
- {
- $aliases = array();
-
- foreach ($this->getNode('adapter_aliases')->children() as $alias => $adapter) {
- $aliases[$alias] = array(
- (string) $adapter->suggest_class, // model class name
- (string) $adapter->suggest_method // model method name
- );
- }
- return $aliases;
- }
-
- /**
- * Retrieve all adapters
- *
- * @return array
- */
- public function getAdapters()
- {
- $adapters = array();
- foreach ($this->getNode('adapters')->children() as $adapterName => $adapter) {
- /* @var $adapter Varien_SimpleXml_Element */
- if (isset($adapter->use)) {
- $adapter = $this->getNode('adapters/' . (string) $adapter->use);
- }
- $adapters[$adapterName] = $adapter;
- }
- return $adapters;
- }
-
- /**
- * Retrieve active adapters
- *
- * @return array
- */
- public function getActiveAdapters()
- {
- $adapters = array();
- foreach ($this->getAdapters() as $adapterName => $adapter) {
- if (!isset($adapter->active) || $adapter->active == '0') {
- continue;
- }
-
- if (isset($adapter->required) && isset($adapter->required->extensions)) {
- foreach ($adapter->required->extensions->children() as $extension=>$data) {
- if (!extension_loaded($extension)) {
- continue;
- }
- }
- }
-
- $adapters[$adapterName] = $adapter;
- }
-
- return $adapters;
- }
-
- /**
- * Retrieve handlers
- *
- * @return Varien_Simplexml_Element
- */
- public function getHandlers()
- {
- return $this->getNode('handlers')->children();
- }
-
- /**
- * Retrieve resources
- *
- * @return Varien_Simplexml_Element
- */
- public function getResources()
- {
- return $this->getNode('resources')->children();
- }
-
- /**
- * Retrieve resources alias
- *
- * @return Varien_Simplexml_Element
- */
- public function getResourcesAlias()
- {
- return $this->getNode('resources_alias')->children();
- }
-
-
- /**
- * Load Acl resources from config
- *
- * @param Mage_Api_Model_Acl $acl
- * @param Mage_Core_Model_Config_Element $resource
- * @param string $parentName
- * @return Mage_Api_Model_Config
- */
- public function loadAclResources(Mage_Api_Model_Acl $acl, $resource=null, $parentName=null)
- {
- $resourceName = null;
- if (is_null($resource)) {
- $resource = $this->getNode('acl/resources');
- } else {
- $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName();
- $acl->add(Mage::getModel('Mage_Api_Model_Acl_Resource', array('resourceId' => $resourceName)), $parentName);
- }
-
- $children = $resource->children();
-
- if (empty($children)) {
- return $this;
- }
-
- foreach ($children as $res) {
- if ($res->getName() != 'title' && $res->getName() != 'sort_order') {
- $this->loadAclResources($acl, $res, $resourceName);
- }
- }
- return $this;
- }
-
- /**
- * Get acl assert config
- *
- * @param string $name
- * @return Mage_Core_Model_Config_Element|boolean
- */
- public function getAclAssert($name='')
- {
- $asserts = $this->getNode('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('acl/privilegeSets');
- if (''===$name) {
- return $sets;
- }
-
- if (isset($sets->$name)) {
- return $sets->$name;
- }
-
- return false;
- }
-
- public function getFaults($resourceName=null)
- {
- if (is_null($resourceName)
- || !isset($this->getResources()->$resourceName)
- || !isset($this->getResources()->$resourceName->faults)) {
- $faultsNode = $this->getNode('faults');
- } else {
- $faultsNode = $this->getResources()->$resourceName->faults;
- }
- /* @var $faultsNode Varien_Simplexml_Element */
-
- $translateModule = 'Mage_Api';
- if (isset($faultsNode['module'])) {
- $translateModule = (string) $faultsNode['module'];
- }
-
- $faults = array();
- foreach ($faultsNode->children() as $faultName => $fault) {
- $faults[$faultName] = array(
- 'code' => (string) $fault->code,
- 'message' => Mage::helper($translateModule)->__((string)$fault->message)
- );
- }
-
- return $faults;
- }
-
- /**
- * Retrieve cache object
- *
- * @return Zend_Cache_Frontend_File
- */
- public function getCache()
- {
- return Mage::app()->getCache();
- }
-
- protected function _loadCache($id)
- {
- return Mage::app()->loadCache($id);
- }
-
- protected function _saveCache($data, $id, $tags=array(), $lifetime=false)
- {
- return Mage::app()->saveCache($data, $id, $tags, $lifetime);
- }
-
- protected function _removeCache($id)
- {
- return Mage::app()->removeCache($id);
- }
-} // Class Mage_Api_Model_Config End
diff --git a/app/code/core/Mage/Api/Model/Resource/Abstract.php b/app/code/core/Mage/Api/Model/Resource/Abstract.php
deleted file mode 100644
index 10f7403..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Abstract.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Api resource abstract
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Abstract
-{
-
- /**
- * Resource configuration
- *
- * @var Varien_Simplexml_Element
- */
- protected $_resourceConfig = null;
-
- /**
- * Retrieve webservice session
- *
- * @return Mage_Api_Model_Session
- */
- protected function _getSession()
- {
- return Mage::getSingleton('Mage_Api_Model_Session');
- }
-
- /**
- * Retrieve webservice configuration
- *
- * @return Mage_Api_Model_Config
- */
- protected function _getConfig()
- {
- return Mage::getSingleton('Mage_Api_Model_Config');
- }
-
- /**
- * Set configuration for api resource
- *
- * @param Varien_Simplexml_Element $xml
- * @return Mage_Api_Model_Resource_Abstract
- */
- public function setResourceConfig(Varien_Simplexml_Element $xml)
- {
- $this->_resourceConfig = $xml;
- return $this;
- }
-
- /**
- * Retrieve configuration for api resource
- *
- * @return Varien_Simplexml_Element
- */
- public function getResourceConfig()
- {
- return $this->_resourceConfig;
- }
-
- /**
- * Retrieve webservice server
- *
- * @return Mage_Api_Model_Server
- */
- protected function _getServer()
- {
- return Mage::getSingleton('Mage_Api_Model_Server');
- }
-
- /**
- * Dispatches fault
- *
- * @param string $code
- */
- protected function _fault($code, $customMessage=null)
- {
- throw new Mage_Api_Exception($code, $customMessage);
- }
-} // Class Mage_Api_Model_Resource_Abstract End
diff --git a/app/code/core/Mage/Api/Model/Resource/Acl.php b/app/code/core/Mage/Api/Model/Resource/Acl.php
deleted file mode 100755
index 5b2035d..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Acl.php
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Resource model for admin ACL
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Acl extends Mage_Core_Model_Resource_Db_Abstract
-{
- /**
- * Initialize resource connections
- *
- */
- protected function _construct()
- {
- $this->_init('api_role', 'role_id');
- }
-
- /**
- * Load ACL for the user
- *
- * @return Mage_Api_Model_Acl
- */
- public function loadAcl()
- {
- $acl = Mage::getModel('Mage_Api_Model_Acl');
- $adapter = $this->_getReadAdapter();
-
- Mage::getSingleton('Mage_Api_Model_Config')->loadAclResources($acl);
-
- $rolesArr = $adapter->fetchAll(
- $adapter->select()
- ->from($this->getTable('api_role'))
- ->order(array('tree_level', 'role_type'))
- );
- $this->loadRoles($acl, $rolesArr);
-
- $rulesArr = $adapter->fetchAll(
- $adapter->select()
- ->from(array('r'=>$this->getTable('api_rule')))
- ->joinLeft(
- array('a'=>$this->getTable('api_assert')),
- 'a.assert_id=r.assert_id',
- array('assert_type', 'assert_data')
- ));
- $this->loadRules($acl, $rulesArr);
- return $acl;
- }
-
- /**
- * Load roles
- *
- * @param Mage_Api_Model_Acl $acl
- * @param array $rolesArr
- * @return Mage_Api_Model_Resource_Acl
- */
- public function loadRoles(Mage_Api_Model_Acl $acl, array $rolesArr)
- {
- foreach ($rolesArr as $role) {
- $parent = $role['parent_id']>0 ? Mage_Api_Model_Acl::ROLE_TYPE_GROUP.$role['parent_id'] : null;
- switch ($role['role_type']) {
- case Mage_Api_Model_Acl::ROLE_TYPE_GROUP:
- $roleId = $role['role_type'].$role['role_id'];
- $acl->addRole(Mage::getModel('Mage_Api_Model_Acl_Role_Group', array('roleId' => $roleId)),
- $parent);
- break;
-
- case Mage_Api_Model_Acl::ROLE_TYPE_USER:
- $roleId = $role['role_type'].$role['user_id'];
- if (!$acl->hasRole($roleId)) {
- $acl->addRole(Mage::getModel('Mage_Api_Model_Acl_Role_User', array('roleId' => $roleId)),
- $parent);
- } else {
- $acl->addRoleParent($roleId, $parent);
- }
- break;
- }
- }
-
- return $this;
- }
-
- /**
- * Load rules
- *
- * @param Mage_Api_Model_Acl $acl
- * @param array $rulesArr
- * @return Mage_Api_Model_Resource_Acl
- */
- public function loadRules(Mage_Api_Model_Acl $acl, array $rulesArr)
- {
- foreach ($rulesArr as $rule) {
- $role = $rule['role_type'].$rule['role_id'];
- $resource = $rule['resource_id'];
- $privileges = !empty($rule['api_privileges']) ? explode(',', $rule['api_privileges']) : null;
-
- $assert = null;
- if (0!=$rule['assert_id']) {
- $assertClass = Mage::getSingleton('Mage_Api_Model_Config')->getAclAssert($rule['assert_type'])->getClassName();
- $assert = new $assertClass(unserialize($rule['assert_data']));
- }
- try {
- if ($rule['api_permission'] == 'allow') {
- $acl->allow($role, $resource, $privileges, $assert);
- } else if ($rule['api_permission'] == 'deny') {
- $acl->deny($role, $resource, $privileges, $assert);
- }
- } catch (Exception $e) {
- //$m = $e->getMessage();
- //if ( eregi("^Resource '(.*)' not found", $m) ) {
- // Deleting non existent resource rule from rules table
- //$cond = $this->_write->quoteInto('resource_id = ?', $resource);
- //$this->_write->delete(Mage::getSingleton('Mage_Core_Model_Resource')->getTableName('admin_rule'), $cond);
- //} else {
- //TODO: We need to log such exceptions to somewhere like a system/errors.log
- //}
- }
- /*
- switch ($rule['api_permission']) {
- case Mage_Api_Model_Acl::RULE_PERM_ALLOW:
- $acl->allow($role, $resource, $privileges, $assert);
- break;
-
- case Mage_Api_Model_Acl::RULE_PERM_DENY:
- $acl->deny($role, $resource, $privileges, $assert);
- break;
- }
- */
- }
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Acl/Role.php b/app/code/core/Mage/Api/Model/Resource/Acl/Role.php
deleted file mode 100755
index ed780cc..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Acl/Role.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * ACL role resource
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Acl_Role extends Mage_Core_Model_Resource_Db_Abstract
-{
- /**
- * Resource initialization
- *
- */
- protected function _construct()
- {
- $this->_init('api_role', 'role_id');
- }
-
- /**
- * Action before save
- *
- * @param Mage_Core_Model_Abstract $object
- * @return Mage_Api_Model_Resource_Acl_Role
- */
- protected function _beforeSave(Mage_Core_Model_Abstract $object)
- {
- if (!$object->getId()) {
- $this->setCreated(Mage::getSingleton('Mage_Core_Model_Date')->gmtDate());
- }
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Acl/Role/Collection.php b/app/code/core/Mage/Api/Model/Resource/Acl/Role/Collection.php
deleted file mode 100755
index 69b4adf..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Acl/Role/Collection.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Acl Role Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Acl_Role_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Role', 'Mage_Api_Model_Resource_Role');
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Permissions/Collection.php b/app/code/core/Mage/Api/Model/Resource/Permissions/Collection.php
deleted file mode 100755
index ef76c92..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Permissions/Collection.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Permissions Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Permissions_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Rules', 'Mage_Api_Model_Resource_Rules');
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Role.php b/app/code/core/Mage/Api/Model/Resource/Role.php
deleted file mode 100755
index c2334c1..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Role.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * ACL role resource
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Role extends Mage_Core_Model_Resource_Db_Abstract
-{
- /**
- * Resource initialization
- *
- */
- protected function _construct()
- {
- $this->_init('api_role', 'role_id');
- }
-
- /**
- * Action before save
- *
- * @param Mage_Core_Model_Abstract $object
- * @return Mage_Api_Model_Resource_Role
- */
- protected function _beforeSave(Mage_Core_Model_Abstract $object)
- {
- if (!$object->getId()) {
- $object->setCreated(now());
- }
- $object->setModified(now());
- return $this;
- }
-
- /**
- * Load an object
- *
- * @param Mage_Core_Model_Abstract $object
- * @param mixed $value
- * @param string $field field to load by (defaults to model id)
- * @return Mage_Core_Model_Resource_Db_Abstract
- */
- public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
- {
- if (!intval($value) && is_string($value)) {
- $field = 'role_id';
- }
- return parent::load($object, $value, $field);
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Role/Collection.php b/app/code/core/Mage/Api/Model/Resource/Role/Collection.php
deleted file mode 100755
index 0271898..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Role/Collection.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Api Role Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Role_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Role', 'Mage_Api_Model_Resource_Role');
- }
-
- /**
- * Aet user filter
- *
- * @param int $userId
- * @return Mage_Api_Model_Resource_Role_Collection
- */
- public function setUserFilter($userId)
- {
- $this->addFieldToFilter('user_id', $userId);
- $this->addFieldToFilter('role_type', Mage_Api_Model_Acl::ROLE_TYPE_GROUP);
- return $this;
- }
-
- /**
- * Set roles filter
- *
- * @return Mage_Api_Model_Resource_Role_Collection
- */
- public function setRolesFilter()
- {
- $this->addFieldToFilter('role_type', Mage_Api_Model_Acl::ROLE_TYPE_GROUP);
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php
deleted file mode 100755
index b40d080..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Roles.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * ACL roles resource
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Roles extends Mage_Core_Model_Resource_Db_Abstract
-{
- /**
- * User table name
- *
- * @var unknown
- */
- protected $_usersTable;
-
- /**
- * Rule table name
- *
- * @var unknown
- */
- protected $_ruleTable;
-
- /**
- * Resource initialization
- *
- */
- protected function _construct()
- {
- $this->_init('api_role', 'role_id');
-
- $this->_usersTable = $this->getTable('api_user');
- $this->_ruleTable = $this->getTable('api_rule');
- }
-
- /**
- * Action before save
- *
- * @param Mage_Core_Model_Abstract $role
- * @return Mage_Api_Model_Resource_Roles
- */
- protected function _beforeSave(Mage_Core_Model_Abstract $role)
- {
- if ($role->getId() == '') {
- if ($role->getIdFieldName()) {
- $role->unsetData($role->getIdFieldName());
- } else {
- $role->unsetData('id');
- }
- }
-
- if ($role->getPid() > 0) {
- $row = $this->load($role->getPid());
- } else {
- $row = array('tree_level' => 0);
- }
- $role->setTreeLevel($row['tree_level'] + 1);
- $role->setRoleName($role->getName());
- return $this;
- }
-
- /**
- * Action after save
- *
- * @param Mage_Core_Model_Abstract $role
- * @return Mage_Api_Model_Resource_Roles
- */
- protected function _afterSave(Mage_Core_Model_Abstract $role)
- {
- $this->_updateRoleUsersAcl($role);
- Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG);
- return $this;
- }
-
- /**
- * Action after delete
- *
- * @param Mage_Core_Model_Abstract $role
- * @return Mage_Api_Model_Resource_Roles
- */
- protected function _afterDelete(Mage_Core_Model_Abstract $role)
- {
- $adapter = $this->_getWriteAdapter();
- $adapter->delete($this->getMainTable(), array('parent_id=?'=>$role->getId()));
- $adapter->delete($this->_ruleTable, array('role_id=?'=>$role->getId()));
- return $this;
- }
-
- /**
- * Get role users
- *
- * @param Mage_Api_Model_Roles $role
- * @return unknown
- */
- public function getRoleUsers(Mage_Api_Model_Roles $role)
- {
- $adapter = $this->_getReadAdapter();
- $select = $adapter->select()
- ->from($this->getMainTable(), array('user_id'))
- ->where('parent_id = ?', $role->getId())
- ->where('role_type = ?', Mage_Api_Model_Acl::ROLE_TYPE_USER)
- ->where('user_id > 0');
- return $adapter->fetchCol($select);
- }
-
- /**
- * Update role users
- *
- * @param Mage_Api_Model_Roles $role
- * @return boolean
- */
- private function _updateRoleUsersAcl(Mage_Api_Model_Roles $role)
- {
- $users = $this->getRoleUsers($role);
- $rowsCount = 0;
- if (sizeof($users) > 0) {
- $rowsCount = $this->_getWriteAdapter()->update(
- $this->_usersTable,
- array('reload_acl_flag' => 1),
- array('user_id IN(?)' => $users));
- }
- return ($rowsCount > 0) ? true : false;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Roles/Collection.php b/app/code/core/Mage/Api/Model/Resource/Roles/Collection.php
deleted file mode 100755
index 6674846..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Roles/Collection.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Api Roles Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Roles_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Role', 'Mage_Api_Model_Resource_Role');
- }
-
- /**
- * Init collection select
- *
- * @return Mage_Api_Model_Resource_Roles_Collection
- */
- protected function _initSelect()
- {
- parent::_initSelect();
- $this->getSelect()->where('main_table.role_type = ?', Mage_Api_Model_Acl::ROLE_TYPE_GROUP);
- return $this;
- }
-
- /**
- * Convert items array to array for select options
- *
- * @return array
- */
- public function toOptionArray()
- {
- return $this->_toOptionArray('role_id', 'role_name');
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Roles/User/Collection.php b/app/code/core/Mage/Api/Model/Resource/Roles/User/Collection.php
deleted file mode 100755
index 4aad945..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Roles/User/Collection.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Roles User Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Roles_User_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_User', 'Mage_Api_Model_Resource_User');
- }
-
- /**
- * Init collection select
- *
- * @return Mage_Api_Model_Resource_Roles_User_Collection
- */
- protected function _initSelect()
- {
- parent::_initSelect();
-
- $this->getSelect()->where("user_id > 0");
-
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Rules.php b/app/code/core/Mage/Api/Model/Resource/Rules.php
deleted file mode 100755
index c83cb6f..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Rules.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Rules resource model
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Rules extends Mage_Core_Model_Resource_Db_Abstract
-{
- /**
- * Resource initialization
- *
- */
- protected function _construct()
- {
- $this->_init('api_rule', 'rule_id');
- }
-
- /**
- * Save rule
- *
- * @param Mage_Api_Model_Rules $rule
- */
- public function saveRel(Mage_Api_Model_Rules $rule)
- {
- $adapter = $this->_getWriteAdapter();
- $adapter->beginTransaction();
-
- try {
- $roleId = $rule->getRoleId();
- $adapter->delete($this->getMainTable(), array('role_id = ?' => $roleId));
- $masterResources = Mage::getModel('Mage_Api_Model_Roles')->getResourcesList2D();
- $masterAdmin = false;
- if ($postedResources = $rule->getResources()) {
- foreach ($masterResources as $index => $resName) {
- if (!$masterAdmin) {
- $permission = (in_array($resName, $postedResources))? 'allow' : 'deny';
- $adapter->insert($this->getMainTable(), array(
- 'role_type' => 'G',
- 'resource_id' => trim($resName, '/'),
- 'api_privileges' => null,
- 'assert_id' => 0,
- 'role_id' => $roleId,
- 'api_permission' => $permission
- ));
- }
- if ($resName == 'all' && $permission == 'allow') {
- $masterAdmin = true;
- }
- }
- }
-
- $adapter->commit();
- } catch (Mage_Core_Exception $e) {
- throw $e;
- } catch (Exception $e) {
- $adapter->rollBack();
- }
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php
deleted file mode 100755
index 3c9fdd1..0000000
--- a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Api Rules Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_Rules_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Rules', 'Mage_Api_Model_Resource_Rules');
- }
-
- /**
- * Retrieve rules by role
- *
- * @param int $id
- * @return Mage_Api_Model_Resource_Rules_Collection
- */
- public function getByRoles($id)
- {
- $this->getSelect()->where("role_id = ?", (int)$id);
- return $this;
- }
-
- /**
- * Add sort by length
- *
- * @return Mage_Api_Model_Resource_Rules_Collection
- */
- public function addSortByLength()
- {
- $this->getSelect()->columns(array('length' => $this->getConnection()->getLengthSql('resource_id')))
- ->order('length DESC');
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php
deleted file mode 100755
index d7cc9ed..0000000
--- a/app/code/core/Mage/Api/Model/Resource/User.php
+++ /dev/null
@@ -1,435 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * ACL user resource
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_User extends Mage_Core_Model_Resource_Db_Abstract
-{
- /**
- * Resource initialization
- *
- */
- protected function _construct()
- {
- $this->_init('api_user', 'user_id');
- }
-
- /**
- * Initialize unique fields
- *
- * @return Mage_Api_Model_Resource_User
- */
- protected function _initUniqueFields()
- {
- $this->_uniqueFields = array(
- array(
- 'field' => 'email',
- 'title' => Mage::helper('Mage_Api_Helper_Data')->__('Email')
- ),
- array(
- 'field' => 'username',
- 'title' => Mage::helper('Mage_Api_Helper_Data')->__('User Name')
- ),
- );
- return $this;
- }
-
- /**
- * Authenticate user by $username and $password
- *
- * @param Mage_Api_Model_User $user
- * @return Mage_Api_Model_Resource_User
- */
- public function recordLogin(Mage_Api_Model_User $user)
- {
- $data = array(
- 'lognum' => $user->getLognum()+1,
- );
- $condition = $this->_getReadAdapter()->quoteInto('user_id=?', $user->getUserId());
- $this->_getWriteAdapter()->update($this->getTable('api_user'), $data, $condition);
- return $this;
- }
-
- /**
- * Record api user session
- *
- * @param Mage_Api_Model_User $user
- * @return Mage_Api_Model_Resource_User
- */
- public function recordSession(Mage_Api_Model_User $user)
- {
- $readAdapter = $this->_getReadAdapter();
- $writeAdapter = $this->_getWriteAdapter();
- $select = $readAdapter->select()
- ->from($this->getTable('api_session'), 'user_id')
- ->where('user_id = ?', $user->getId())
- ->where('sessid = ?', $user->getSessid());
- $loginDate = now();
- if ($readAdapter->fetchRow($select)) {
- $writeAdapter->update(
- $this->getTable('api_session'),
- array ('logdate' => $loginDate),
- $readAdapter->quoteInto('user_id = ?', $user->getId()) . ' AND '
- . $readAdapter->quoteInto('sessid = ?', $user->getSessid())
- );
- } else {
- $writeAdapter->insert(
- $this->getTable('api_session'),
- array(
- 'user_id' => $user->getId(),
- 'logdate' => $loginDate,
- 'sessid' => $user->getSessid()
- )
- );
- }
- $user->setLogdate($loginDate);
- return $this;
- }
-
- /**
- * Clean old session
- *
- * @param Mage_Api_Model_User $user
- * @return Mage_Api_Model_Resource_User
- */
- public function cleanOldSessions(Mage_Api_Model_User $user)
- {
- $readAdapter = $this->_getReadAdapter();
- $writeAdapter = $this->_getWriteAdapter();
- $timeout = Mage::getStoreConfig('api/config/session_timeout');
- $timeSubtract = $readAdapter->getDateAddSql(
- 'logdate',
- $timeout,
- Varien_Db_Adapter_Interface::INTERVAL_SECOND);
- $writeAdapter->delete(
- $this->getTable('api_session'),
- array('user_id = ?' => $user->getId(), $readAdapter->quote(now()) . ' > '.$timeSubtract)
- );
- return $this;
- }
-
- /**
- * Load data by username
- *
- * @param string $username
- * @return array
- */
- public function loadByUsername($username)
- {
- $adapter = $this->_getReadAdapter();
- $select = $adapter->select()->from($this->getTable('api_user'))
- ->where('username=:username');
- return $adapter->fetchRow($select, array('username'=>$username));
- }
-
- /**
- * load by session id
- *
- * @param string $sessId
- * @return array
- */
- public function loadBySessId($sessId)
- {
- $result = array();
- $adapter = $this->_getReadAdapter();
- $select = $adapter->select()
- ->from($this->getTable('api_session'))
- ->where('sessid = ?', $sessId);
- if ($apiSession = $adapter->fetchRow($select)) {
- $selectUser = $adapter->select()
- ->from($this->getTable('api_user'))
- ->where('user_id = ?', $apiSession['user_id']);
- if ($user = $adapter->fetchRow($selectUser)) {
- $result = array_merge($user, $apiSession);
- }
- }
- return $result;
- }
-
- /**
- * Clear by session
- *
- * @param string $sessid
- * @return Mage_Api_Model_Resource_User
- */
- public function clearBySessId($sessid)
- {
- $this->_getWriteAdapter()->delete(
- $this->getTable('api_session'),
- array('sessid = ?' => $sessid)
- );
- return $this;
- }
-
- /**
- * Retrieve api user role data if it was assigned to role
- *
- * @param int | Mage_Api_Model_User $user
- * @return null | array
- */
- public function hasAssigned2Role($user)
- {
- $userId = null;
- $result = null;
- if (is_numeric($user)) {
- $userId = $user;
- } else if ($user instanceof Mage_Core_Model_Abstract) {
- $userId = $user->getUserId();
- }
-
- if ($userId) {
- $adapter = $this->_getReadAdapter();
- $select = $adapter->select();
- $select->from($this->getTable('api_role'))
- ->where('parent_id > 0 AND user_id = ?', $userId);
- $result = $adapter->fetchAll($select);
- }
- return $result;
- }
-
- /**
- * Action before save
- *
- * @param Mage_Core_Model_Abstract $user
- * @return Mage_Api_Model_Resource_User
- */
- protected function _beforeSave(Mage_Core_Model_Abstract $user)
- {
- if (!$user->getId()) {
- $user->setCreated(now());
- }
- $user->setModified(now());
- return $this;
- }
-
- /**
- * Delete the object
- *
- * @param Mage_Core_Model_Abstract $user
- * @return boolean
- */
- public function delete(Mage_Core_Model_Abstract $user)
- {
- $dbh = $this->_getWriteAdapter();
- $uid = (int) $user->getId();
- $dbh->beginTransaction();
- try {
- $dbh->delete($this->getTable('api_user'), array('user_id = ?' => $uid));
- $dbh->delete($this->getTable('api_role'), array('user_id = ?' => $uid));
- } catch (Mage_Core_Exception $e) {
- throw $e;
- return false;
- } catch (Exception $e) {
- $dbh->rollBack();
- return false;
- }
- $dbh->commit();
- return true;
- }
-
- /**
- * Save user roles
- *
- * @param Mage_Core_Model_Abstract $user
- * @return unknown
- */
- public function _saveRelations(Mage_Core_Model_Abstract $user)
- {
- $rolesIds = $user->getRoleIds();
- if (!is_array($rolesIds) || count($rolesIds) == 0) {
- return $user;
- }
-
- $adapter = $this->_getWriteAdapter();
-
- $adapter->beginTransaction();
-
- try {
- $adapter->delete(
- $this->getTable('api_role'),
- array('user_id = ?' => (int) $user->getId()));
- foreach ($rolesIds as $rid) {
- $rid = intval($rid);
- if ($rid > 0) {
- //$row = $this->load($user, $rid);
- } else {
- $row = array('tree_level' => 0);
- }
- $row = array('tree_level' => 0);
-
- $data = array(
- 'parent_id' => $rid,
- 'tree_level' => $row['tree_level'] + 1,
- 'sort_order' => 0,
- 'role_type' => Mage_Api_Model_Acl::ROLE_TYPE_USER,
- 'user_id' => $user->getId(),
- 'role_name' => $user->getFirstname()
- );
- $adapter->insert($this->getTable('api_role'), $data);
- }
- $adapter->commit();
- } catch (Mage_Core_Exception $e) {
- throw $e;
- } catch (Exception $e) {
- $adapter->rollBack();
- }
- return $this;
- }
-
- /**
- * Retrieve roles data
- *
- * @param Mage_Core_Model_Abstract $user
- * @return array
- */
- public function _getRoles(Mage_Core_Model_Abstract $user)
- {
- if (!$user->getId()) {
- return array();
- }
- $table = $this->getTable('api_role');
- $adapter = $this->_getReadAdapter();
- $select = $adapter->select()
- ->from($table, array())
- ->joinLeft(
- array('ar' => $table),
- $adapter->quoteInto(
- "ar.role_id = {$table}.parent_id AND ar.role_type = ?",
- Mage_Api_Model_Acl::ROLE_TYPE_GROUP),
- array('role_id'))
- ->where("{$table}.user_id = ?", $user->getId());
-
- return (($roles = $adapter->fetchCol($select)) ? $roles : array());
- }
-
- /**
- * Add Role
- *
- * @param Mage_Core_Model_Abstract $user
- * @return Mage_Api_Model_Resource_User
- */
- public function add(Mage_Core_Model_Abstract $user)
- {
- $adapter = $this->_getWriteAdapter();
- $aRoles = $this->hasAssigned2Role($user);
- if (sizeof($aRoles) > 0) {
- foreach ($aRoles as $idx => $data) {
- $adapter->delete(
- $this->getTable('api_role'),
- array('role_id = ?' => $data['role_id'])
- );
- }
- }
-
- if ($user->getId() > 0) {
- $role = Mage::getModel('Mage_Api_Model_Role')->load($user->getRoleId());
- } else {
- $role = new Varien_Object(array('tree_level' => 0));
- }
- $adapter->insert($this->getTable('api_role'), array(
- 'parent_id' => $user->getRoleId(),
- 'tree_level'=> ($role->getTreeLevel() + 1),
- 'sort_order'=> 0,
- 'role_type' => Mage_Api_Model_Acl::ROLE_TYPE_USER,
- 'user_id' => $user->getUserId(),
- 'role_name' => $user->getFirstname()
- ));
-
- return $this;
- }
-
- /**
- * Delete from role
- *
- * @param Mage_Core_Model_Abstract $user
- * @return Mage_Api_Model_Resource_User
- */
- public function deleteFromRole(Mage_Core_Model_Abstract $user)
- {
- if ($user->getUserId() <= 0) {
- return $this;
- }
- if ($user->getRoleId() <= 0) {
- return $this;
- };
-
- $adapter = $this->_getWriteAdapter();
- $table = $this->getTable('api_role');
-
- $condition = array(
- "{$table}.user_id = ?" => $user->getUserId(),
- "{$table}.parent_id = ?"=> $user->getRoleId()
- );
- $adapter->delete($table, $condition);
- return $this;
- }
-
- /**
- * Retrieve roles which exists for user
- *
- * @param Mage_Core_Model_Abstract $user
- * @return array
- */
- public function roleUserExists(Mage_Core_Model_Abstract $user)
- {
- $result = array();
- if ($user->getUserId() > 0) {
- $adapter = $this->_getReadAdapter();
- $select = $adapter->select()->from($this->getTable('api_role'))
- ->where('parent_id = ?', $user->getRoleId())
- ->where('user_id = ?', $user->getUserId());
- $result = $adapter->fetchCol($select);
- }
- return $result;
- }
-
- /**
- * Check if user not unique
- *
- * @param Mage_Core_Model_Abstract $user
- * @return array
- */
- public function userExists(Mage_Core_Model_Abstract $user)
- {
- $usersTable = $this->getTable('api_user');
- $adapter = $this->_getReadAdapter();
- $condition = array(
- $adapter->quoteInto("{$usersTable}.username = ?", $user->getUsername()),
- $adapter->quoteInto("{$usersTable}.email = ?", $user->getEmail()),
- );
- $select = $adapter->select()
- ->from($usersTable)
- ->where(implode(' OR ', $condition))
- ->where($usersTable.'.user_id != ?', (int) $user->getId());
- return $adapter->fetchRow($select);
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Resource/User/Collection.php b/app/code/core/Mage/Api/Model/Resource/User/Collection.php
deleted file mode 100755
index 565fcd7..0000000
--- a/app/code/core/Mage/Api/Model/Resource/User/Collection.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Api User Resource Collection
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Resource_User_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
-{
- /**
- * Resource collection initialization
- *
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_User', 'Mage_Api_Model_Resource_User');
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Role.php b/app/code/core/Mage/Api/Model/Role.php
deleted file mode 100644
index 356a2b5..0000000
--- a/app/code/core/Mage/Api/Model/Role.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Role item model
- *
- * @method Mage_Api_Model_Resource_Role _getResource()
- * @method Mage_Api_Model_Resource_Role getResource()
- * @method int getParentId()
- * @method Mage_Api_Model_Role setParentId(int $value)
- * @method int getTreeLevel()
- * @method Mage_Api_Model_Role setTreeLevel(int $value)
- * @method int getSortOrder()
- * @method Mage_Api_Model_Role setSortOrder(int $value)
- * @method string getRoleType()
- * @method Mage_Api_Model_Role setRoleType(string $value)
- * @method int getUserId()
- * @method Mage_Api_Model_Role setUserId(int $value)
- * @method string getRoleName()
- * @method Mage_Api_Model_Role setRoleName(string $value)
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Role extends Mage_Core_Model_Abstract
-{
- /**
- * Initialize resource
- */
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Resource_Role');
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php
deleted file mode 100644
index c9d153b..0000000
--- a/app/code/core/Mage/Api/Model/Roles.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Enter description here ...
- *
- * @method Mage_Api_Model_Resource_Roles _getResource()
- * @method Mage_Api_Model_Resource_Roles getResource()
- * @method int getParentId()
- * @method Mage_Api_Model_Roles setParentId(int $value)
- * @method int getTreeLevel()
- * @method Mage_Api_Model_Roles setTreeLevel(int $value)
- * @method int getSortOrder()
- * @method Mage_Api_Model_Roles setSortOrder(int $value)
- * @method string getRoleType()
- * @method Mage_Api_Model_Roles setRoleType(string $value)
- * @method int getUserId()
- * @method Mage_Api_Model_Roles setUserId(int $value)
- * @method string getRoleName()
- * @method Mage_Api_Model_Roles setRoleName(string $value)
- * @method string getName()
- * @method Mage_Api_Model_Role setName() setName(string $name)
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Roles extends Mage_Core_Model_Abstract
-{
- /**
- * Filters
- *
- * @var array
- */
- protected $_filters;
-
-
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Resource_Roles');
- }
-
- public function update()
- {
- $this->getResource()->update($this);
- return $this;
- }
-
- public function getUsersCollection()
- {
- return Mage::getResourceModel('Mage_Api_Model_Resource_Roles_User_Collection');
- }
-
- public function getResourcesTree()
- {
- return $this->_buildResourcesArray(null, null, null, null, true);
- }
-
- public function getResourcesList()
- {
- return $this->_buildResourcesArray();
- }
-
- public function getResourcesList2D()
- {
- return $this->_buildResourcesArray(null, null, null, true);
- }
-
- public function getRoleUsers()
- {
- return $this->getResource()->getRoleUsers($this);
- }
-
- protected function _buildResourcesArray(
- Varien_Simplexml_Element $resource = null, $parentName = null, $level = 0, $represent2Darray = null,
- $rawNodes = false, $module = 'Mage_Adminhtml'
- ) {
- static $result;
-
- if (is_null($resource)) {
- $resource = Mage::getSingleton('Mage_Api_Model_Config')->getNode('acl/resources');
- $resourceName = null;
- $level = -1;
- } else {
- $resourceName = $parentName;
- if ($resource->getName()!='title' && $resource->getName()!='sort_order'
- && $resource->getName() != 'children'
- ) {
- $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName();
-
- //assigning module for its' children nodes
- if ($resource->getAttribute('module')) {
- $module = (string)$resource->getAttribute('module');
- }
-
- if ($rawNodes) {
- $resource->addAttribute("aclpath", $resourceName);
- }
-
- $resource->title = Mage::helper($module)->__((string)$resource->title);
-
- if ( is_null($represent2Darray) ) {
- $result[$resourceName]['name'] = (string)$resource->title;
- $result[$resourceName]['level'] = $level;
- } else {
- $result[] = $resourceName;
- }
- }
- }
-
- $children = $resource->children();
- if (empty($children)) {
- if ($rawNodes) {
- return $resource;
- } else {
- return $result;
- }
- }
- foreach ($children as $child) {
- $this->_buildResourcesArray($child, $resourceName, $level+1, $represent2Darray, $rawNodes, $module);
- }
- if ($rawNodes) {
- return $resource;
- } else {
- return $result;
- }
- }
-
- /**
- * Filter data before save
- *
- * @return Mage_Api_Model_Roles
- */
- protected function _beforeSave()
- {
- $this->filter();
- parent::_beforeSave();
- return $this;
- }
-
- /**
- * Filter set data
- *
- * @return Mage_Api_Model_Roles
- */
- public function filter()
- {
- $data = $this->getData();
- if (!$this->_filters || !$data) {
- return $this;
- }
- /** @var $filter Mage_Core_Model_Input_Filter */
- $filter = Mage::getModel('Mage_Core_Model_Input_Filter');
- $filter->setFilters($this->_filters);
- $this->setData($filter->filter($data));
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Rules.php b/app/code/core/Mage/Api/Model/Rules.php
deleted file mode 100644
index 28cc1c9..0000000
--- a/app/code/core/Mage/Api/Model/Rules.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Enter description here ...
- *
- * @method Mage_Api_Model_Resource_Rules _getResource()
- * @method Mage_Api_Model_Resource_Rules getResource()
- * @method int getRoleId()
- * @method Mage_Api_Model_Rules setRoleId(int $value)
- * @method string getResourceId()
- * @method Mage_Api_Model_Rules setResourceId(string $value)
- * @method string getPrivileges()
- * @method Mage_Api_Model_Rules setPrivileges(string $value)
- * @method int getAssertId()
- * @method Mage_Api_Model_Rules setAssertId(int $value)
- * @method string getRoleType()
- * @method Mage_Api_Model_Rules setRoleType(string $value)
- * @method string getPermission()
- * @method Mage_Api_Model_Rules setPermission(string $value)
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Rules extends Mage_Core_Model_Abstract
-{
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Resource_Rules');
- }
-
- public function update() {
- $this->getResource()->update($this);
- return $this;
- }
-
- public function getCollection() {
- return Mage::getResourceModel('Mage_Api_Model_Resource_Permissions_Collection');
- }
-
- public function saveRel() {
- $this->getResource()->saveRel($this);
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Server.php b/app/code/core/Mage/Api/Model/Server.php
deleted file mode 100644
index d5aabee..0000000
--- a/app/code/core/Mage/Api/Model/Server.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice api abstract
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server
-{
-
- /**
- * Api Name by Adapter
- * @var string
- */
- protected $_api = "";
-
- /**
- * Web service adapter
- *
- * @var Mage_Api_Model_Server_Adapter_Interface
- */
- protected $_adapter;
-
- /**
- * Complex retrieve adapter code by calling auxiliary model method
- *
- * @param string $alias Alias name
- * @return string|null Returns NULL if no alias found
- */
- public function getAdapterCodeByAlias($alias)
- {
- /** @var $config Mage_Api_Model_Config */
- $config = Mage::getSingleton('Mage_Api_Model_Config');
- $aliases = $config->getAdapterAliases();
-
- if (!isset($aliases[$alias])) {
- return null;
- }
- $object = Mage::getModel($aliases[$alias][0]);
- $method = $aliases[$alias][1];
-
- if (!method_exists($object, $method)) {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Can not find webservice adapter.'));
- }
- return $object->$method();
- }
-
- /**
- * Initialize server components
- *
- * @param Mage_Api_Controller_Action $controller
- * @param string $adapter Adapter name
- * @param string $handler Handler name
- * @return Mage_Api_Model_Server
- */
- public function init(Mage_Api_Controller_Action $controller, $adapter = 'default', $handler = 'default')
- {
- $this->initialize($adapter, $handler);
-
- $this->_adapter->setController($controller);
-
- return $this;
- }
-
- /**
- * Initialize server components. Lightweight implementation of init() method
- *
- * @param string $adapterCode Adapter code
- * @param string $handler OPTIONAL Handler name (if not specified, it will be found from config)
- * @return Mage_Api_Model_Server
- */
- public function initialize($adapterCode, $handler = null)
- {
- /** @var $helper Mage_Api_Model_Config */
- $helper = Mage::getSingleton('Mage_Api_Model_Config');
- $adapters = $helper->getActiveAdapters();
-
- if (isset($adapters[$adapterCode])) {
- /** @var $adapterModel Mage_Api_Model_Server_Adapter_Interface */
- $adapterModel = Mage::getModel((string) $adapters[$adapterCode]->model);
-
- if (!($adapterModel instanceof Mage_Api_Model_Server_Adapter_Interface)) {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Invalid webservice adapter specified.'));
- }
- $this->_adapter = $adapterModel;
- $this->_api = $adapterCode;
-
- // get handler code from config if no handler passed as argument
- if (null === $handler && !empty($adapters[$adapterCode]->handler)) {
- $handler = (string) $adapters[$adapterCode]->handler;
- }
- $handlers = $helper->getHandlers();
-
- if (!isset($handlers->$handler)) {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Invalid webservice handler specified.'));
- }
- $handlerClassName = Mage::getConfig()->getModelClassName((string) $handlers->$handler->model);
-
- $this->_adapter->setHandler($handlerClassName);
- } else {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Invalid webservice adapter specified.'));
- }
- return $this;
- }
-
- /**
- * Run server
- *
- */
- public function run()
- {
- $this->getAdapter()->run();
- }
-
- /**
- * Get Api name by Adapter
- * @return string
- */
- public function getApiName()
- {
- return $this->_api;
- }
-
- /**
- * Retrieve web service adapter
- *
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- public function getAdapter()
- {
- return $this->_adapter;
- }
-
-
-} // Class Mage_Api_Model_Server_Abstract End
diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php b/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php
deleted file mode 100644
index 9e2dcb4..0000000
--- a/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Web service api server interface
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-interface Mage_Api_Model_Server_Adapter_Interface
-{
- /**
- * Set handler class name for webservice
- *
- * @param string $handler
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- function setHandler($handler);
-
- /**
- * Retrive handler class name for webservice
- *
- * @return string
- */
- function getHandler();
-
- /**
- * Set webservice api controller
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- function setController(Mage_Api_Controller_Action $controller);
-
- /**
- * Retrive webservice api controller
- *
- * @return Mage_Api_Controller_Action
- */
- function getController();
-
- /**
- * Run webservice
- *
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- function run();
-
- /**
- * Dispatch webservice fault
- *
- * @param int $code
- * @param string $message
- */
- function fault($code, $message);
-
-} // Class Mage_Api_Model_Server_Adapter_Interface End
diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
deleted file mode 100644
index 5390e37..0000000
--- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice soap adapter
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_Adapter_Soap
- extends Varien_Object
- implements Mage_Api_Model_Server_Adapter_Interface
-{
- /**
- * Soap server
- *
- * @var SoapServer
- */
- protected $_soap = null;
-
- /**
- * Set handler class name for webservice
- *
- * @param string $handler
- * @return Mage_Api_Model_Server_Adapter_Soap
- */
- public function setHandler($handler)
- {
- $this->setData('handler', $handler);
- return $this;
- }
-
- /**
- * Retrive handler class name for webservice
- *
- * @return string
- */
- public function getHandler()
- {
- return $this->getData('handler');
- }
-
- /**
- * Set webservice api controller
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Soap
- */
- public function setController(Mage_Api_Controller_Action $controller)
- {
- $this->setData('controller', $controller);
- return $this;
- }
-
- /**
- * Retrive webservice api controller. If no controller have been set - emulate it by the use of Varien_Object
- *
- * @return Mage_Api_Controller_Action|Varien_Object
- */
- public function getController()
- {
- $controller = $this->getData('controller');
-
- if (null === $controller) {
- $controller = new Varien_Object(
- array('request' => Mage::app()->getRequest(), 'response' => Mage::app()->getResponse())
- );
-
- $this->setData('controller', $controller);
- }
- return $controller;
- }
-
- /**
- * Run webservice
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Soap
- */
- public function run()
- {
- $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
-
- if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
- // Generating wsdl content from template
- $io = new Varien_Io_File();
- $io->open(array('path'=>Mage::getModuleDir('etc', 'Mage_Api')));
-
- $wsdlContent = $io->read('wsdl.xml');
-
- $template = Mage::getModel('Mage_Core_Model_Email_Template_Filter');
-
- $wsdlConfig = new Varien_Object();
- $queryParams = $this->getController()->getRequest()->getQuery();
- if (isset($queryParams['wsdl'])) {
- unset($queryParams['wsdl']);
- }
-
- $wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
- $wsdlConfig->setName('Magento');
- $wsdlConfig->setHandler($this->getHandler());
-
- $template->setVariables(array('wsdl' => $wsdlConfig));
-
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody(
- preg_replace(
- '/<\?xml version="([^\"]+)"([^\>]+)>/i',
- '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
- $template->filter($wsdlContent)
- )
- );
- } else {
- try {
- $this->_instantiateServer();
-
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody(
- preg_replace(
- '/<\?xml version="([^\"]+)"([^\>]+)>/i',
- '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
- $this->_soap->handle()
- )
- );
- } catch( Zend_Soap_Server_Exception $e ) {
- $this->fault( $e->getCode(), $e->getMessage() );
- } catch( Exception $e ) {
- $this->fault( $e->getCode(), $e->getMessage() );
- }
- }
-
- return $this;
- }
-
- /**
- * Dispatch webservice fault
- *
- * @param int $code
- * @param string $message
- */
- public function fault($code, $message)
- {
- if ($this->_extensionLoaded()) {
- throw new SoapFault($code, $message);
- } else {
- die('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <faultcode>' . $code . '</faultcode>
- <faultstring>' . $message . '</faultstring>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>');
- }
-
- }
-
- /**
- * Check whether Soap extension is loaded
- *
- * @return boolean
- */
- protected function _extensionLoaded()
- {
- return class_exists('SoapServer', false);
- }
-
- /**
- * Transform wsdl url if $_SERVER["PHP_AUTH_USER"] is set
- *
- * @param array
- * @return String
- */
- protected function getWsdlUrl($params = null, $withAuth = true)
- {
- $urlModel = Mage::getModel('Mage_Core_Model_Url')
- ->setUseSession(false);
-
- $wsdlUrl = $params !== null
- ? $urlModel->getUrl('*/*/*', array('_current' => true, '_query' => $params))
- : $urlModel->getUrl('*/*/*');
-
- if( $withAuth ) {
- $phpAuthUser = $this->getController()->getRequest()->getServer('PHP_AUTH_USER', false);
- $phpAuthPw = $this->getController()->getRequest()->getServer('PHP_AUTH_PW', false);
-
- if ($phpAuthUser && $phpAuthPw) {
- $wsdlUrl = sprintf("http://%s:%s@%s", $phpAuthUser, $phpAuthPw, str_replace('http://', '', $wsdlUrl ));
- }
- }
-
- return $wsdlUrl;
- }
-
- /**
- * Try to instantiate Zend_Soap_Server
- * If schema import error is caught, it will retry in 1 second.
- *
- * @throws Zend_Soap_Server_Exception
- */
- protected function _instantiateServer()
- {
- $apiConfigCharset = Mage::getStoreConfig('api/config/charset');
- $wsdlCacheEnabled = (bool) Mage::getStoreConfig('api/config/wsdl_cache_enabled');
-
- if ($wsdlCacheEnabled) {
- ini_set('soap.wsdl_cache_enabled', '1');
- } else {
- ini_set('soap.wsdl_cache_enabled', '0');
- }
-
- $tries = 0;
- do {
- $retry = false;
- try {
- $this->_soap = new Zend_Soap_Server($this->getWsdlUrl(array("wsdl" => 1)),
- array('encoding' => $apiConfigCharset));
- } catch (SoapFault $e) {
- if (false !== strpos($e->getMessage(),
- "can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'")
- ) {
- $retry = true;
- sleep(1);
- } else {
- throw $e;
- }
- $tries++;
- }
- } while ($retry && $tries < 5);
- use_soap_error_handler(false);
- $this->_soap
- ->setReturnResponse(true)
- ->setClass($this->getHandler());
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php b/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php
deleted file mode 100644
index c9bcfed..0000000
--- a/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice XmlRpc adapter
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_Adapter_Xmlrpc
- extends Varien_Object
- implements Mage_Api_Model_Server_Adapter_Interface
-{
- /**
- * XmlRpc Server
- *
- * @var Zend_XmlRpc_Server
- */
- protected $_xmlRpc = null;
-
- /**
- * Set handler class name for webservice
- *
- * @param string $handler
- * @return Mage_Api_Model_Server_Adapter_Xmlrpc
- */
- public function setHandler($handler)
- {
- $this->setData('handler', $handler);
- return $this;
- }
-
- /**
- * Retrive handler class name for webservice
- *
- * @return string
- */
- public function getHandler()
- {
- return $this->getData('handler');
- }
-
- /**
- * Set webservice api controller
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Xmlrpc
- */
- public function setController(Mage_Api_Controller_Action $controller)
- {
- $this->setData('controller', $controller);
- return $this;
- }
-
- /**
- * Retrive webservice api controller. If no controller have been set - emulate it by the use of Varien_Object
- *
- * @return Mage_Api_Controller_Action|Varien_Object
- */
- public function getController()
- {
- $controller = $this->getData('controller');
-
- if (null === $controller) {
- $controller = new Varien_Object(
- array('request' => Mage::app()->getRequest(), 'response' => Mage::app()->getResponse())
- );
-
- $this->setData('controller', $controller);
- }
- return $controller;
- }
-
- /**
- * Run webservice
- *
- * @return Mage_Api_Model_Server_Adapter_Xmlrpc
- */
- public function run()
- {
- $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
-
- $this->_xmlRpc = new Zend_XmlRpc_Server();
- $this->_xmlRpc->setEncoding($apiConfigCharset)
- ->setClass($this->getHandler());
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody($this->_xmlRpc->handle());
- return $this;
- }
-
- /**
- * Dispatch webservice fault
- *
- * @param int $code
- * @param string $message
- */
- public function fault($code, $message)
- {
- throw new Zend_XmlRpc_Server_Exception($message, $code);
- }
-} // Class Mage_Api_Model_Server_Adapter_Xmlrpc End
diff --git a/app/code/core/Mage/Api/Model/Server/Handler.php b/app/code/core/Mage/Api/Model/Server/Handler.php
deleted file mode 100644
index 8b1044a..0000000
--- a/app/code/core/Mage/Api/Model/Server/Handler.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservices default server handler
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_Handler extends Mage_Api_Model_Server_Handler_Abstract
-{
-
-} // Class Mage_Api_Model_Server_Handler End
diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
deleted file mode 100644
index a398fed..0000000
--- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
+++ /dev/null
@@ -1,546 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice default handler
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-abstract class Mage_Api_Model_Server_Handler_Abstract
-{
- protected $_resourceSuffix = null;
-
- public function __construct()
- {
- set_error_handler(array($this, 'handlePhpError'), E_ALL);
- Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMIN, Mage_Core_Model_App_Area::PART_EVENTS);
- }
-
- public function handlePhpError($errorCode, $errorMessage, $errorFile)
- {
- Mage::log($errorMessage . $errorFile);
- if (in_array($errorCode, array(E_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR))) {
- $this->_fault('internal');
- }
- return true;
- }
-
-
- /**
- * Retrive webservice session
- *
- * @return Mage_Api_Model_Session
- */
- protected function _getSession()
- {
- return Mage::getSingleton('Mage_Api_Model_Session');
- }
-
- /**
- * Retrive webservice configuration
- *
- * @return Mage_Api_Model_Config
- */
- protected function _getConfig()
- {
- return Mage::getSingleton('Mage_Api_Model_Config');
- }
-
- /**
- * Retrive webservice server
- *
- * @return Mage_Api_Model_Server
- */
- protected function _getServer()
- {
- return Mage::getSingleton('Mage_Api_Model_Server');
- }
-
- /**
- * Start webservice session
- *
- * @param string $sessionId
- * @return Mage_Api_Model_Server_Handler_Abstract
- */
- protected function _startSession($sessionId=null)
- {
- $this->_getSession()->setSessionId($sessionId);
- $this->_getSession()->init('api', 'api');
- return $this;
- }
-
- /**
- * Check current user permission on resource and privilege
- *
- *
- * @param string $resource
- * @param string $privilege
- * @return bool
- */
- protected function _isAllowed($resource, $privilege=null)
- {
- return $this->_getSession()->isAllowed($resource, $privilege);
- }
-
- /**
- * Check session expiration
- *
- * @return boolean
- */
- protected function _isSessionExpired ()
- {
- return $this->_getSession()->isSessionExpired();
- }
-
- /**
- * Dispatch webservice fault
- *
- * @param string $faultName
- * @param string $resourceName
- * @param string $customMessage
- */
- protected function _fault($faultName, $resourceName=null, $customMessage=null)
- {
- $faults = $this->_getConfig()->getFaults($resourceName);
- if (!isset($faults[$faultName]) && !is_null($resourceName)) {
- $this->_fault($faultName);
- return;
- } elseif (!isset($faults[$faultName])) {
- $this->_fault('unknown');
- return;
- }
- $this->_getServer()->getAdapter()->fault(
- $faults[$faultName]['code'],
- (is_null($customMessage) ? $faults[$faultName]['message'] : $customMessage)
- );
- }
-
- /**
- * Retrive webservice fault as array
- *
- * @param string $faultName
- * @param string $resourceName
- * @param string $customMessage
- * @return array
- */
- protected function _faultAsArray($faultName, $resourceName=null, $customMessage=null)
- {
- $faults = $this->_getConfig()->getFaults($resourceName);
- if (!isset($faults[$faultName]) && !is_null($resourceName)) {
- return $this->_faultAsArray($faultName);
- } elseif (!isset($faults[$faultName])) {
- return $this->_faultAsArray('unknown');
- }
-
- return array(
- 'isFault' => true,
- 'faultCode' => $faults[$faultName]['code'],
- 'faultMessage' => (is_null($customMessage) ? $faults[$faultName]['message'] : $customMessage)
- );
- }
-
- /**
- * Start web service session
- *
- * @return string
- */
- public function startSession()
- {
- $this->_startSession();
- return $this->_getSession()->getSessionId();
- }
-
-
- /**
- * End web service session
- *
- * @param string $sessionId
- * @return boolean
- */
- public function endSession($sessionId)
- {
- $this->_startSession($sessionId);
- $this->_getSession()->clear();
- return true;
- }
-
- /**
- * Enter description here...
- *
- * @param string $resource
- * @return string
- */
- protected function _prepareResourceModelName($resource)
- {
- if (null !== $this->_resourceSuffix) {
- return $resource . $this->_resourceSuffix;
- }
- return $resource;
- }
-
- /**
- * Login user and Retrieve session id
- *
- * @param string $username
- * @param string $apiKey
- * @return string
- */
- public function login($username, $apiKey = null)
- {
- if (empty($username) || empty($apiKey)) {
- return $this->_fault('invalid_request_param');
- }
-
- try {
- $this->_startSession();
- $this->_getSession()->login($username, $apiKey);
- } catch (Exception $e) {
- return $this->_fault('access_denied');
- }
- return $this->_getSession()->getSessionId();
- }
-
- /**
- * Call resource functionality
- *
- * @param string $sessionId
- * @param string $apiPath
- * @param array $args
- * @return mixed
- */
- public function call($sessionId, $apiPath, $args = array())
- {
- $this->_startSession($sessionId);
-
- if (!$this->_getSession()->isLoggedIn($sessionId)) {
- return $this->_fault('session_expired');
- }
-
- list($resourceName, $methodName) = explode('.', $apiPath);
-
- if (empty($resourceName) || empty($methodName)) {
- return $this->_fault('resource_path_invalid');
- }
-
- $resourcesAlias = $this->_getConfig()->getResourcesAlias();
- $resources = $this->_getConfig()->getResources();
- if (isset($resourcesAlias->$resourceName)) {
- $resourceName = (string) $resourcesAlias->$resourceName;
- }
-
- if (!isset($resources->$resourceName)
- || !isset($resources->$resourceName->methods->$methodName)) {
- return $this->_fault('resource_path_invalid');
- }
-
- if (!isset($resources->$resourceName->public)
- && isset($resources->$resourceName->acl)
- && !$this->_isAllowed((string)$resources->$resourceName->acl)) {
- return $this->_fault('access_denied');
-
- }
-
-
- if (!isset($resources->$resourceName->methods->$methodName->public)
- && isset($resources->$resourceName->methods->$methodName->acl)
- && !$this->_isAllowed((string)$resources->$resourceName->methods->$methodName->acl)) {
- return $this->_fault('access_denied');
- }
-
- $methodInfo = $resources->$resourceName->methods->$methodName;
-
- try {
- $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName);
-
- $modelName = $this->_prepareResourceModelName((string) $resources->$resourceName->model);
- try {
- $model = Mage::getModel($modelName);
- if ($model instanceof Mage_Api_Model_Resource_Abstract) {
- $model->setResourceConfig($resources->$resourceName);
- }
- } catch (Exception $e) {
- throw new Mage_Api_Exception('resource_path_not_callable');
- }
-
- if (method_exists($model, $method)) {
- if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
- return $model->$method((is_array($args) ? $args : array($args)));
- } elseif (!is_array($args)) {
- return $model->$method($args);
- } else {
- return call_user_func_array(array(&$model, $method), $args);
- }
- } else {
- throw new Mage_Api_Exception('resource_path_not_callable');
- }
- } catch (Mage_Api_Exception $e) {
- return $this->_fault($e->getMessage(), $resourceName, $e->getCustomMessage());
- } catch (Exception $e) {
- Mage::logException($e);
- return $this->_fault('internal', null, $e->getMessage());
- }
- }
-
- /**
- * Multiple calls of resource functionality
- *
- * @param string $sessionId
- * @param array $calls
- * @param array $options
- * @return array
- */
- public function multiCall($sessionId, array $calls = array(), $options = array())
- {
- $this->_startSession($sessionId);
-
- if (!$this->_getSession()->isLoggedIn($sessionId)) {
- return $this->_fault('session_expired');
- }
-
- $result = array();
-
- $resourcesAlias = $this->_getConfig()->getResourcesAlias();
- $resources = $this->_getConfig()->getResources();
-
- foreach ($calls as $call) {
- if (!isset($call[0])) {
- $result[] = $this->_faultAsArray('resource_path_invalid');
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- }
-
- $apiPath = $call[0];
- $args = (isset($call[1]) ? $call[1] : array());
-
- list($resourceName, $methodName) = explode('.', $apiPath);
-
- if (empty($resourceName) || empty($methodName)) {
- $result[] = $this->_faultAsArray('resource_path_invalid');
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- }
-
- if (isset($resourcesAlias->$resourceName)) {
- $resourceName = (string) $resourcesAlias->$resourceName;
- }
-
- if (!isset($resources->$resourceName)
- || !isset($resources->$resourceName->methods->$methodName)) {
- $result[] = $this->_faultAsArray('resource_path_invalid');
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- }
-
- if (!isset($resources->$resourceName->public)
- && isset($resources->$resourceName->acl)
- && !$this->_isAllowed((string)$resources->$resourceName->acl)) {
- $result[] = $this->_faultAsArray('access_denied');
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- }
-
-
- if (!isset($resources->$resourceName->methods->$methodName->public)
- && isset($resources->$resourceName->methods->$methodName->acl)
- && !$this->_isAllowed((string)$resources->$resourceName->methods->$methodName->acl)) {
- $result[] = $this->_faultAsArray('access_denied');
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- }
-
- $methodInfo = $resources->$resourceName->methods->$methodName;
-
- try {
- $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName);
-
- $modelName = $this->_prepareResourceModelName((string) $resources->$resourceName->model);
- try {
- $model = Mage::getModel($modelName);
- } catch (Exception $e) {
- throw new Mage_Api_Exception('resource_path_not_callable');
- }
-
- if (method_exists($model, $method)) {
- if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') {
- $result[] = $model->$method((is_array($args) ? $args : array($args)));
- } elseif (!is_array($args)) {
- $result[] = $model->$method($args);
- } else {
- $result[] = call_user_func_array(array(&$model, $method), $args);
- }
- } else {
- throw new Mage_Api_Exception('resource_path_not_callable');
- }
- } catch (Mage_Api_Exception $e) {
- $result[] = $this->_faultAsArray($e->getMessage(), $resourceName, $e->getCustomMessage());
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- } catch (Exception $e) {
- Mage::logException($e);
- $result[] = $this->_faultAsArray('internal');
- if (isset($options['break']) && $options['break']==1) {
- break;
- } else {
- continue;
- }
- }
- }
-
- return $result;
- }
-
- /**
- * List of available resources
- *
- * @param string $sessionId
- * @return array
- */
- public function resources($sessionId)
- {
- $this->_startSession($sessionId);
-
- if (!$this->_getSession()->isLoggedIn($sessionId)) {
- return $this->_fault('session_expired');
- }
-
- $resources = array();
-
- $resourcesAlias = array();
- foreach ($this->_getConfig()->getResourcesAlias() as $alias => $resourceName) {
- $resourcesAlias[(string) $resourceName][] = $alias;
- }
-
-
- foreach ($this->_getConfig()->getResources() as $resourceName => $resource) {
- if (isset($resource->acl) && !$this->_isAllowed((string) $resource->acl)) {
- continue;
- }
-
- $methods = array();
- foreach ($resource->methods->children() as $methodName => $method) {
- if (isset($method->acl) && !$this->_isAllowed((string) $method->acl)) {
- continue;
- }
- $methodAliases = array();
- if (isset($resourcesAlias[$resourceName])) {
- foreach ($resourcesAlias[$resourceName] as $alias) {
- $methodAliases[] = $alias . '.' . $methodName;
- }
- }
-
- $methods[] = array(
- 'title' => (string) $method->title,
- 'description' => (isset($method->description) ? (string)$method->description : null),
- 'path' => $resourceName . '.' . $methodName,
- 'name' => $methodName,
- 'aliases' => $methodAliases
- );
- }
-
- if (count($methods) == 0) {
- continue;
- }
-
- $resources[] = array(
- 'title' => (string) $resource->title,
- 'description' => (isset($resource->description) ? (string)$resource->description : null),
- 'name' => $resourceName,
- 'aliases' => (isset($resourcesAlias[$resourceName]) ? $resourcesAlias[$resourceName] : array()),
- 'methods' => $methods
- );
- }
-
- return $resources;
- }
-
- /**
- * List of resource faults
- *
- * @param string $sessionId
- * @param string $resourceName
- * @return array
- */
- public function resourceFaults($sessionId, $resourceName)
- {
- $this->_startSession($sessionId);
-
- if (!$this->_getSession()->isLoggedIn($sessionId)) {
- return $this->_fault('session_expired');
- }
-
- $resourcesAlias = $this->_getConfig()->getResourcesAlias();
- $resources = $this->_getConfig()->getResources();
-
- if (isset($resourcesAlias->$resourceName)) {
- $resourceName = (string) $resourcesAlias->$resourceName;
- }
-
-
- if (empty($resourceName)
- || !isset($resources->$resourceName)) {
- return $this->_fault('resource_path_invalid');
- }
-
- if (isset($resources->$resourceName->acl)
- && !$this->_isAllowed((string)$resources->$resourceName->acl)) {
- return $this->_fault('access_denied');
- }
-
- return array_values($this->_getConfig()->getFaults($resourceName));
- }
-
- /**
- * List of global faults
- *
- * @param string $sessionId
- * @return array
- */
- public function globalFaults($sessionId)
- {
- $this->_startSession($sessionId);
- return array_values($this->_getConfig()->getFaults());
- }
-} // Class Mage_Api_Model_Server_Handler_Abstract End
diff --git a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php
deleted file mode 100644
index c4176cc..0000000
--- a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice soap adapter
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
-{
- /**
- * Run webservice
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Soap
- */
- public function run()
- {
- $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
-
- if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
- $wsdlConfig = Mage::getModel('Mage_Api_Model_Wsdl_Config');
- $wsdlConfig->setHandler($this->getHandler())
- ->init();
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody(
- preg_replace(
- '/<\?xml version="([^\"]+)"([^\>]+)>/i',
- '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
- $wsdlConfig->getWsdlContent()
- )
- );
- } else {
- try {
- $this->_instantiateServer();
-
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody(
- preg_replace(
- '/<\?xml version="([^\"]+)"([^\>]+)>/i',
- '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
- $this->_soap->handle()
- )
- );
- } catch( Zend_Soap_Server_Exception $e ) {
- $this->fault( $e->getCode(), $e->getMessage() );
- } catch( Exception $e ) {
- $this->fault( $e->getCode(), $e->getMessage() );
- }
- }
-
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Server/V2/Handler.php b/app/code/core/Mage/Api/Model/Server/V2/Handler.php
deleted file mode 100644
index 6a1d563..0000000
--- a/app/code/core/Mage/Api/Model/Server/V2/Handler.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservices server handler v2
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_V2_Handler extends Mage_Api_Model_Server_Handler_Abstract
-{
- protected $_resourceSuffix = '_v2';
-
- /**
- * Interceptor for all interfaces
- *
- * @param sttring $function
- * @param array $args
- */
-
- public function __call( $function, $args )
- {
- $sessionId = array_shift( $args );
- $apiKey = '';
- $nodes = Mage::getSingleton('Mage_Api_Model_Config')->getNode('v2/resources_function_prefix')->children();
- foreach ($nodes as $resource => $prefix) {
- $prefix = $prefix->asArray();
- if (false !== strpos($function, $prefix)) {
- $method = substr($function, strlen($prefix));
- $apiKey = $resource . '.' . strtolower($method[0]).substr($method, 1);
- }
- }
- return $this->call($sessionId, $apiKey, $args);
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php
deleted file mode 100644
index 9102900..0000000
--- a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice soap adapter
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_Wsi_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
-{
- /**
- * Run webservice
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Soap
- */
- public function run()
- {
- $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
-
- if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
- $wsdlConfig = Mage::getModel('Mage_Api_Model_Wsdl_Config');
- $wsdlConfig->setHandler($this->getHandler())
- ->init();
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody(
- preg_replace(
- '/(\>\<)/i',
- ">\n<",
- str_replace(
- '<soap:operation soapAction=""></soap:operation>',
- "<soap:operation soapAction=\"\" />\n",
- str_replace(
- '<soap:body use="literal"></soap:body>',
- "<soap:body use=\"literal\" />\n",
- preg_replace(
- '/<\?xml version="([^\"]+)"([^\>]+)>/i',
- '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
- $wsdlConfig->getWsdlContent()
- )
- )
- )
- )
- );
- } else {
- try {
- $this->_instantiateServer();
-
- $this->getController()->getResponse()
- ->clearHeaders()
- ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
- ->setBody(
- str_replace(
- '<soap:operation soapAction=""></soap:operation>',
- "<soap:operation soapAction=\"\" />\n",
- str_replace(
- '<soap:body use="literal"></soap:body>',
- "<soap:body use=\"literal\" />\n",
- preg_replace(
- '/<\?xml version="([^\"]+)"([^\>]+)>/i',
- '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
- $this->_soap->handle()
- )
- )
- )
- );
- } catch( Zend_Soap_Server_Exception $e ) {
- $this->fault( $e->getCode(), $e->getMessage() );
- } catch( Exception $e ) {
- $this->fault( $e->getCode(), $e->getMessage() );
- }
- }
-
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php
deleted file mode 100644
index e7deb22..0000000
--- a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservices server handler WSI
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Server_Wsi_Handler extends Mage_Api_Model_Server_Handler_Abstract
-{
- protected $_resourceSuffix = '_v2';
-
- /**
- * Interceptor for all interfaces
- *
- * @param string $function
- * @param array $args
- */
-
- public function __call ($function, $args)
- {
- $args = $args[0];
-
- /** @var Mage_Api_Helper_Data */
- $helper = Mage::helper('Mage_Api_Helper_Data');
-
- $helper->wsiArrayUnpacker($args);
- $args = get_object_vars($args);
-
- if(isset($args['sessionId'])){
- $sessionId = $args['sessionId'];
- unset($args['sessionId']);
- } else {
- // Was left for backward compatibility.
- $sessionId = array_shift( $args );
- }
-
- $apiKey = '';
- $nodes = Mage::getSingleton('Mage_Api_Model_Config')->getNode('v2/resources_function_prefix')->children();
- foreach ($nodes as $resource => $prefix) {
- $prefix = $prefix->asArray();
- if (false !== strpos($function, $prefix)) {
- $method = substr($function, strlen($prefix));
- $apiKey = $resource . '.' . strtolower($method[0]).substr($method, 1);
- }
- }
-
- list($modelName, $methodName) = $this->_getResourceName($apiKey);
- $methodParams = $this->getMethodParams($modelName, $methodName);
-
- $args = $this->prepareArgs($methodParams, $args);
-
- $res = $this->call($sessionId, $apiKey, $args);
-
- $obj = $helper->wsiArrayPacker($res);
- $stdObj = new stdClass();
- $stdObj->result = $obj;
-
- return $stdObj;
- }
-
- /**
- * Login user and Retrieve session id
- *
- * @param string $username
- * @param string $apiKey
- * @return string
- */
- public function login($username, $apiKey = null)
- {
- if (is_object($username)) {
- $apiKey = $username->apiKey;
- $username = $username->username;
- }
-
- $stdObject = new stdClass();
- $stdObject->result = parent::login($username, $apiKey);
- return $stdObject;
- }
-
- /**
- * Return called class and method names
- *
- * @param String $apiPath
- * @return Array
- */
- protected function _getResourceName($apiPath){
-
- list($resourceName, $methodName) = explode('.', $apiPath);
-
- if (empty($resourceName) || empty($methodName)) {
- return $this->_fault('resource_path_invalid');
- }
-
- $resourcesAlias = $this->_getConfig()->getResourcesAlias();
- $resources = $this->_getConfig()->getResources();
- if (isset($resourcesAlias->$resourceName)) {
- $resourceName = (string) $resourcesAlias->$resourceName;
- }
-
- $methodInfo = $resources->$resourceName->methods->$methodName;
-
- $modelName = $this->_prepareResourceModelName((string) $resources->$resourceName->model);
-
- $modelClass = Mage::getConfig()->getModelClassName($modelName);
-
- $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName);
-
- return array($modelClass, $method);
- }
-
- /**
- * Return an array of parameters for the callable method.
- *
- * @param String $modelName
- * @param String $methodName
- * @return Array of ReflectionParameter
- */
- public function getMethodParams($modelName, $methodName) {
-
- $method = new ReflectionMethod($modelName, $methodName);
-
- return $method->getParameters();
- }
-
- /**
- * Prepares arguments for the method calling. Sort in correct order, set default values for omitted parameters.
- *
- * @param Array $params
- * @param Array $args
- * @return Array
- */
- public function prepareArgs($params, $args) {
-
- $callArgs = array();
-
- /** @var $parameter ReflectionParameter */
- foreach($params AS $parameter){
- $pName = $parameter->getName();
- if( isset( $args[$pName] ) ){
- $callArgs[$pName] = $args[$pName];
- } else {
- if($parameter->isOptional()){
- $callArgs[$pName] = $parameter->getDefaultValue();
- } else {
- Mage::logException(new Exception("Required parameter \"$pName\" is missing.", 0));
- $this->_fault('invalid_request_param');
- }
- }
- }
- return $callArgs;
- }
-
-}
diff --git a/app/code/core/Mage/Api/Model/Session.php b/app/code/core/Mage/Api/Model/Session.php
deleted file mode 100644
index 4e77988..0000000
--- a/app/code/core/Mage/Api/Model/Session.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice api session
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Session extends Mage_Core_Model_Session_Abstract
-{
- public $sessionIds = array();
- protected $_currentSessId = null;
-
- public function start($sessionName=null)
- {
-// parent::start($sessionName=null);
- $this->_currentSessId = md5(time() . uniqid('', true) . $sessionName);
- $this->sessionIds[] = $this->getSessionId();
- return $this;
- }
-
- public function init($namespace, $sessionName=null)
- {
- if (is_null($this->_currentSessId)) {
- $this->start();
- }
- return $this;
- }
-
- public function getSessionId()
- {
- return $this->_currentSessId;
- }
-
- public function setSessionId($sessId = null)
- {
- if (!is_null($sessId)) {
- $this->_currentSessId = $sessId;
- }
- return $this;
- }
-
- public function revalidateCookie()
- {
- // In api we don't use cookies
- }
-
- public function clear() {
- if ($sessId = $this->getSessionId()) {
- try {
- Mage::getModel('Mage_Api_Model_User')->logoutBySessId($sessId);
- } catch (Exception $e) {
- return false;
- }
- }
- return true;
- }
-
- public function login($username, $apiKey)
- {
- $user = Mage::getModel('Mage_Api_Model_User')
- ->setSessid($this->getSessionId())
- ->login($username, $apiKey);
-
- if ( $user->getId() && $user->getIsActive() != '1' ) {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Your account has been deactivated.'));
- } elseif (!Mage::getModel('Mage_Api_Model_User')->hasAssigned2Role($user->getId())) {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Access denied.'));
- } else {
- if ($user->getId()) {
- $this->setUser($user);
- $this->setAcl(Mage::getResourceModel('Mage_Api_Model_Resource_Acl')->loadAcl());
- } else {
- Mage::throwException(Mage::helper('Mage_Api_Helper_Data')->__('Unable to login.'));
- }
- }
-
- return $user;
- }
-
- public function refreshAcl($user=null)
- {
- if (is_null($user)) {
- $user = $this->getUser();
- }
- if (!$user) {
- return $this;
- }
- if (!$this->getAcl() || $user->getReloadAclFlag()) {
- $this->setAcl(Mage::getResourceModel('Mage_Api_Model_Resource_Acl')->loadAcl());
- }
- if ($user->getReloadAclFlag()) {
- $user->unsetData('api_key');
- $user->setReloadAclFlag('0')->save();
- }
- return $this;
- }
-
- /**
- * Check current user permission on resource and privilege
- *
- *
- * @param string $resource
- * @param string $privilege
- * @return bool
- */
- public function isAllowed($resource, $privilege=null)
- {
- $user = $this->getUser();
- $acl = $this->getAcl();
-
- if ($user && $acl) {
- try {
- if ($acl->isAllowed($user->getAclRole(), 'all', null)){
- return true;
- }
- } catch (Exception $e) {}
-
- try {
- return $acl->isAllowed($user->getAclRole(), $resource, $privilege);
- } catch (Exception $e) {
- return false;
- }
- }
- return false;
- }
-
- /**
- * Check session expiration
- *
- * @return boolean
- */
- public function isSessionExpired ($user)
- {
- if (!$user->getId()) {
- return true;
- }
- $timeout = strtotime( now() ) - strtotime( $user->getLogdate() );
- return $timeout > Mage::getStoreConfig('api/config/session_timeout');
- }
-
-
- public function isLoggedIn($sessId = false)
- {
- $userExists = $this->getUser() && $this->getUser()->getId();
-
- if (!$userExists && $sessId !== false) {
- return $this->_renewBySessId($sessId);
- }
-
- if ($userExists) {
- Mage::register('isSecureArea', true, true);
- }
- return $userExists;
- }
-
- /**
- * Renew user by session ID if session not expired
- *
- * @param string $sessId
- * @return boolean
- */
- protected function _renewBySessId ($sessId)
- {
- $user = Mage::getModel('Mage_Api_Model_User')->loadBySessId($sessId);
- if (!$user->getId() || !$user->getSessid()) {
- return false;
- }
-
- if ($user->getSessid() == $sessId && !$this->isSessionExpired($user)) {
- $this->setUser($user);
- $this->setAcl(Mage::getResourceModel('Mage_Api_Model_Resource_Acl')->loadAcl());
-
- $user->getResource()->recordLogin($user)
- ->recordSession($user);
-
- return true;
- }
- return false;
- }
-
-} // Class Mage_Api_Model_Session End
diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php
deleted file mode 100644
index cd119b8..0000000
--- a/app/code/core/Mage/Api/Model/User.php
+++ /dev/null
@@ -1,254 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Enter description here ...
- *
- * @method Mage_Api_Model_Resource_User _getResource()
- * @method Mage_Api_Model_Resource_User getResource()
- * @method string getFirstname()
- * @method Mage_Api_Model_User setFirstname(string $value)
- * @method string getLastname()
- * @method Mage_Api_Model_User setLastname(string $value)
- * @method string getEmail()
- * @method Mage_Api_Model_User setEmail(string $value)
- * @method string getUsername()
- * @method Mage_Api_Model_User setUsername(string $value)
- * @method string getApiKey()
- * @method Mage_Api_Model_User setApiKey(string $value)
- * @method string getCreated()
- * @method Mage_Api_Model_User setCreated(string $value)
- * @method string getModified()
- * @method Mage_Api_Model_User setModified(string $value)
- * @method int getLognum()
- * @method Mage_Api_Model_User setLognum(int $value)
- * @method int getReloadAclFlag()
- * @method Mage_Api_Model_User setReloadAclFlag(int $value)
- * @method int getIsActive()
- * @method Mage_Api_Model_User setIsActive(int $value)
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_User extends Mage_Core_Model_Abstract
-{
- /**
- * Prefix of model events names
- *
- * @var string
- */
- protected $_eventPrefix = 'api_user';
-
- protected function _construct()
- {
- $this->_init('Mage_Api_Model_Resource_User');
- }
-
- public function save()
- {
- $this->_beforeSave();
- $data = array(
- 'firstname' => $this->getFirstname(),
- 'lastname' => $this->getLastname(),
- 'email' => $this->getEmail(),
- 'modified' => Mage::getSingleton('Mage_Core_Model_Date')->gmtDate()
- );
-
- if($this->getId() > 0) {
- $data['user_id'] = $this->getId();
- }
-
- if( $this->getUsername() ) {
- $data['username'] = $this->getUsername();
- }
-
- if ($this->getApiKey()) {
- $data['api_key'] = $this->_getEncodedApiKey($this->getApiKey());
- }
-
- if ($this->getNewApiKey()) {
- $data['api_key'] = $this->_getEncodedApiKey($this->getNewApiKey());
- }
-
- if ( !is_null($this->getIsActive()) ) {
- $data['is_active'] = intval($this->getIsActive());
- }
-
- $this->setData($data);
- $this->_getResource()->save($this);
- $this->_afterSave();
- return $this;
- }
-
- public function delete()
- {
- $this->_beforeDelete();
- $this->_getResource()->delete($this);
- $this->_afterDelete();
- return $this;
- }
-
- public function saveRelations()
- {
- $this->_getResource()->_saveRelations($this);
- return $this;
- }
-
- public function getRoles()
- {
- return $this->_getResource()->_getRoles($this);
- }
-
- public function deleteFromRole()
- {
- $this->_getResource()->deleteFromRole($this);
- return $this;
- }
-
- public function roleUserExists()
- {
- $result = $this->_getResource()->roleUserExists($this);
- return ( is_array($result) && count($result) > 0 ) ? true : false;
- }
-
- public function add()
- {
- $this->_getResource()->add($this);
- return $this;
- }
-
- public function userExists()
- {
- $result = $this->_getResource()->userExists($this);
- return ( is_array($result) && count($result) > 0 ) ? true : false;
- }
-
- public function getCollection() {
- return Mage::getResourceModel('Mage_Api_Model_Resource_User_Collection');
- }
-
- public function getName($separator=' ')
- {
- return $this->getFirstname().$separator.$this->getLastname();
- }
-
- public function getId()
- {
- return $this->getUserId();
- }
-
- /**
- * Get user ACL role
- *
- * @return string
- */
- public function getAclRole()
- {
- return 'U'.$this->getUserId();
- }
-
- /**
- * Authenticate user name and api key and save loaded record
- *
- * @param string $username
- * @param string $apiKey
- * @return boolean
- */
- public function authenticate($username, $apiKey)
- {
- $this->loadByUsername($username);
- if (!$this->getId()) {
- return false;
- }
- $auth = Mage::helper('Mage_Core_Helper_Data')->validateHash($apiKey, $this->getApiKey());
- if ($auth) {
- return true;
- } else {
- $this->unsetData();
- return false;
- }
- }
-
- /**
- * Login user
- *
- * @param string $login
- * @param string $apiKey
- * @return Mage_Api_Model_User
- */
- public function login($username, $apiKey)
- {
- $sessId = $this->getSessid();
- if ($this->authenticate($username, $apiKey)) {
- $this->setSessid($sessId);
- $this->getResource()->cleanOldSessions($this)
- ->recordLogin($this)
- ->recordSession($this);
- Mage::dispatchEvent('api_user_authenticated', array(
- 'model' => $this,
- 'api_key' => $apiKey,
- ));
- }
-
- return $this;
- }
-
- public function reload()
- {
- $this->load($this->getId());
- return $this;
- }
-
- public function loadByUsername($username)
- {
- $this->setData($this->getResource()->loadByUsername($username));
- return $this;
- }
-
- public function loadBySessId ($sessId)
- {
- $this->setData($this->getResource()->loadBySessId($sessId));
- return $this;
- }
-
- public function logoutBySessId($sessid)
- {
- $this->getResource()->clearBySessId($sessid);
- return $this;
- }
-
- public function hasAssigned2Role($user)
- {
- return $this->getResource()->hasAssigned2Role($user);
- }
-
- protected function _getEncodedApiKey($apiKey)
- {
- return Mage::helper('Mage_Core_Helper_Data')->getHash($apiKey, 2);
- }
-
-}
diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config.php b/app/code/core/Mage/Api/Model/Wsdl/Config.php
deleted file mode 100644
index 45df22c..0000000
--- a/app/code/core/Mage/Api/Model/Wsdl/Config.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Wsdl config model
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Wsdl_Config extends Mage_Api_Model_Wsdl_Config_Base
-{
- protected static $_namespacesPrefix = null;
-
- public function __construct($sourceData=null)
- {
- $this->setCacheId('wsdl_config_global');
- parent::__construct($sourceData);
- }
-
- /**
- * Return wsdl content
- *
- * @return string
- */
- public function getWsdlContent()
- {
- return $this->_xml->asXML();
- }
-
- /**
- * Return namespaces with their prefix
- *
- * @return array
- */
- public static function getNamespacesPrefix()
- {
- if (is_null(self::$_namespacesPrefix)) {
- self::$_namespacesPrefix = array();
- $config = Mage::getSingleton('Mage_Api_Model_Config')->getNode('v2/wsdl/prefix')->children();
- foreach ($config as $prefix => $namespace) {
- self::$_namespacesPrefix[$namespace->asArray()] = $prefix;
- }
- }
- return self::$_namespacesPrefix;
- }
-
- public function getCache()
- {
- return Mage::app()->getCache();
- }
-
- protected function _loadCache($id)
- {
- return Mage::app()->loadCache($id);
- }
-
- protected function _saveCache($data, $id, $tags=array(), $lifetime=false)
- {
- return Mage::app()->saveCache($data, $id, $tags, $lifetime);
- }
-
- protected function _removeCache($id)
- {
- return Mage::app()->removeCache($id);
- }
-
- public function init()
- {
- $this->setCacheChecksum(null);
- $saveCache = true;
-
- if (Mage::app()->useCache('config')) {
- $loaded = $this->loadCache();
- if ($loaded) {
- return $this;
- }
- }
-
- $mergeWsdl = new Mage_Api_Model_Wsdl_Config_Base();
- $mergeWsdl->setHandler($this->getHandler());
-
- if(Mage::helper('Mage_Api_Helper_Data')->isComplianceWSI()){
- /**
- * Exclude Mage_Api wsdl xml file because it used for previous version
- * of API wsdl declaration
- */
- $mergeWsdl->addLoadedFile(Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsi.xml');
-
- $baseWsdlFile = Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsi.xml';
- $this->loadFile($baseWsdlFile);
- Mage::getConfig()->loadModulesConfiguration('wsi.xml', $this, $mergeWsdl);
- } else {
- /**
- * Exclude Mage_Api wsdl xml file because it used for previous version
- * of API wsdl declaration
- */
- $mergeWsdl->addLoadedFile(Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsdl.xml');
-
- $baseWsdlFile = Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsdl2.xml';
- $this->loadFile($baseWsdlFile);
- Mage::getConfig()->loadModulesConfiguration('wsdl.xml', $this, $mergeWsdl);
- }
-
- if (Mage::app()->useCache('config')) {
- $this->saveCache(array('config'));
- }
-
- return $this;
- }
-
- /**
- * Return Xml of node as string
- *
- * @return string
- */
- public function getXmlString()
- {
- return $this->getNode()->asXML();
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php
deleted file mode 100644
index cce9b12..0000000
--- a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Wsdl base config
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_Model_Wsdl_Config_Base extends Varien_Simplexml_Config
-{
- protected $_handler = '';
-
- /**
- * @var Varien_Object
- */
- protected $_wsdlVariables = null;
-
- protected $_loadedFiles = array();
-
- public function __construct($sourceData=null)
- {
- $this->_elementClass = 'Mage_Api_Model_Wsdl_Config_Element';
-
- // remove wsdl parameter from query
- $queryParams = Mage::app()->getRequest()->getQuery();
- unset($queryParams['wsdl']);
-
- // set up default WSDL template variables
- $this->_wsdlVariables = new Varien_Object(
- array(
- 'name' => 'Magento',
- 'url' => htmlspecialchars(Mage::getUrl('*/*/*', array('_query' => $queryParams)))
- )
- );
- parent::__construct($sourceData);
- }
-
- /**
- * Set handler
- *
- * @param string $handler
- * @return Mage_Api_Model_Wsdl_Config_Base
- */
- public function setHandler($handler)
- {
- $this->_handler = $handler;
- return $this;
- }
-
- /**
- * Get handler
- *
- * @return string
- */
- public function getHandler()
- {
- return $this->_handler;
- }
-
- /**
- * Processing file data
- *
- * @param string $text
- * @return string
- */
- public function processFileData($text)
- {
- /** @var $template Mage_Core_Model_Email_Template_Filter */
- $template = Mage::getModel('Mage_Core_Model_Email_Template_Filter');
-
- $this->_wsdlVariables->setHandler($this->getHandler());
-
- $template->setVariables(array('wsdl'=>$this->_wsdlVariables));
-
- return $template->filter($text);
- }
-
- public function addLoadedFile($file)
- {
- if (!in_array($file, $this->_loadedFiles)) {
- $this->_loadedFiles[] = $file;
- }
- return $this;
- }
-
- public function loadFile($file)
- {
- if (in_array($file, $this->_loadedFiles)) {
- return false;
- }
- $res = parent::loadFile($file);
- if ($res) {
- $this->addLoadedFile($file);
- }
- return $this;
- }
-
- /**
- * Set variable to be used in WSDL template processing
- *
- * @param string $key Varible key
- * @param string $value Variable value
- * @return Mage_Api_Model_Wsdl_Config_Base
- */
- public function setWsdlVariable($key, $value)
- {
- $this->_wsdlVariables->setData($key, $value);
-
- return $this;
- }
-}
diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php
deleted file mode 100644
index 861adc0..0000000
--- a/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php
+++ /dev/null
@@ -1,265 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Wsdl element model
- *
- * @category Mage
- * @package Mage_Core
- */
-class Mage_Api_Model_Wsdl_Config_Element extends Varien_Simplexml_Element
-{
- public function extend($source, $overwrite=false)
- {
- if (!$source instanceof Varien_Simplexml_Element) {
- return $this;
- }
-
- foreach ($this->getChildren($source) as $namespace => $children) {
- foreach ($children as $child) {
- $this->extendChild($child, $overwrite, $namespace);
- }
- }
-
- return $this;
- }
-
- /**
- * Extends one node
- *
- * @param Varien_Simplexml_Element $source
- * @param boolean $overwrite
- * @return Varien_Simplexml_Element
- */
- public function extendChild($source, $overwrite=false, $elmNamespace = '')
- {
- // this will be our new target node
- $targetChild = null;
-
- // name of the source node
- $sourceName = $source->getName();
-
- // here we have children of our source node
- $sourceChildren = $this->getChildren($source);
-
- if ($elmNamespace == '') {
- $elmNamespace = null;
- }
-
- if (!$source->hasChildren()) {
- // handle string node
- $elm = $this->getElementByName($source, $elmNamespace);
- if (!is_null($elm)) {
-
- // if target already has children return without regard
- if ($this->getChildren($elm)) {
- return $this;
- }
- if ($overwrite) {
-// unset($this->$sourceName);
- unset($elm);
- } else {
- return $this;
- }
- }
- $targetChild = $this->addChild($sourceName, $source->xmlentities(), $elmNamespace);
- $targetChild->setParent($this);
- foreach ($this->getAttributes($source) as $namespace => $attributes) {
- foreach ($attributes as $key => $value) {
- $_namespacesPrefix = Mage_Api_Model_Wsdl_Config::getNamespacesPrefix();
- if ($namespace == '') {
- $namespace = null;
- } elseif (array_key_exists($namespace, $_namespacesPrefix)) {
- $key = $_namespacesPrefix[$namespace] . ':' . $key;
- }
-
- $targetChild->addAttribute($key, $this->xmlentities($value), $namespace);
- }
- }
- return $this;
- }
-
- $elm = $this->getElementByName($source, $elmNamespace);
- if (!is_null($elm)) {
- $targetChild = $elm;
- }
- if (is_null($targetChild)) {
- // if child target is not found create new and descend
- $targetChild = $this->addChild($sourceName, null, $elmNamespace);
- $targetChild->setParent($this);
- foreach ($this->getAttributes($source) as $namespace => $attributes) {
- foreach ($attributes as $key => $value) {
- $_namespacesPrefix = Mage_Api_Model_Wsdl_Config::getNamespacesPrefix();
- if ($namespace == '') {
- $namespace = null;
- } elseif (array_key_exists($namespace, $_namespacesPrefix)) {
- $key = $_namespacesPrefix[$namespace] . ':' . $key;
- }
- $targetChild->addAttribute($key, $this->xmlentities($value), $namespace);
- }
- }
- }
-
- foreach ($sourceChildren as $elmNamespace => $children) {
- foreach ($children as $childKey => $childNode) {
- $targetChild->extendChild($childNode, $overwrite, $elmNamespace);
- }
- }
-
- return $this;
- }
-
- /**
- * Return attributes of all namespaces
- *
- * array(
- * namespace => array(
- * attribute_key => attribute_value,
- * ...
- * )
- * )
- *
- * @param Varien_Simplexml_Element $source
- * @return array
- */
- public function getAttributes($source, $namespace = null)
- {
- $attributes = array();
- if (!is_null($namespace)) {
- $attributes[$namespace] = $source->attributes($namespace);
- return $attributes;
- }
- $namespaces = $source->getNamespaces(true);
- $attributes[''] = $source->attributes('');
- foreach ($namespaces as $key => $value) {
- if ($key == '' || $key == 'soap') {
- continue;
- }
- $attributes[$value] = $source->attributes($value);
- }
- return $attributes;
- }
-
- /**
- * Return children of all namespaces
- *
- * @param Varien_Simplexml_Element $source
- */
- public function getChildren($source)
- {
- $children = array();
- $namespaces = $source->getNamespaces(true);
-
- $isWsi = Mage::helper('Mage_Api_Helper_Data')->isComplianceWSI();
-
- foreach ($namespaces as $key => $value) {
- if ($key == '' || (!$isWsi && $key == 'wsdl')) {
- continue;
- }
- $children[$value] = $source->children($value);
- }
- $children[''] = $source->children('');
- return $children;
- }
-
- /**
- * Return if has children
- *
- * @return boolean
- */
- public function hasChildren()
- {
- if (!$this->getChildren($this)) {
- return false;
- }
-
- // simplexml bug: @attributes is in children() but invisible in foreach
- foreach ($this->getChildren($this) as $namespace => $children) {
- foreach ($children as $k => $child) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return element by tag name, and checking attributes with namespaces
- *
- * @param Varien_Simplexml_Element $source
- * @param string $namespace
- * @return null|Varien_Simplexml_Element
- */
- public function getElementByName($source, $elmNamespace = '')
- {
- $sourceName = $source->getName();
- $extendElmAttributes = $this->getAttributes($source);
- foreach ($this->children($elmNamespace) as $k => $child) {
- if ($child->getName() == $sourceName) {
- $elm = true;
- foreach ($extendElmAttributes as $namespace => $attributes) {
- /**
- * if count of attributes of extend element is 0 in $namespace,
- * and current element has attributes in $namespace - different elements
- */
-// if (!count($attributes) && count($this->getAttributes($child, $namespace))) {
-// foreach ($this->getAttributes($child, $namespace) as $attribute) {
-// $elm = false;
-// break;
-// }
-// }
- foreach ($attributes as $key => $value) {
- if (is_null($child->getAttribute($key, $namespace)) || $child->getAttribute($key, $namespace) != $value) {
- $elm = false;
- }
- }
- }
- /**
- * if count of namespaces attributes of element to extend is 0,
- * but current element has namespaces attributes - different elements
- */
- if (!count($extendElmAttributes) && count($this->getAttributes($child))) {
- $elm = false;
- }
- if ($elm) {
- return $child;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns attribute value by attribute name
- *
- * @return string
- */
- public function getAttribute($name, $namespace = ''){
- $attrs = $this->attributes($namespace);
- return isset($attrs[$name]) ? (string)$attrs[$name] : null;
- }
-
-}
diff --git a/app/code/core/Mage/Api/controllers/IndexController.php b/app/code/core/Mage/Api/controllers/IndexController.php
deleted file mode 100644
index 174536a..0000000
--- a/app/code/core/Mage/Api/controllers/IndexController.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice main controller
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_IndexController extends Mage_Api_Controller_Action
-{
- public function indexAction()
- {
- /* @var $server Mage_Api_Model_Server */
- $this->_getServer()->init($this)
- ->run();
- }
-} // Class Mage_Api_IndexController End
diff --git a/app/code/core/Mage/Api/controllers/SoapController.php b/app/code/core/Mage/Api/controllers/SoapController.php
deleted file mode 100644
index 0ee01d1..0000000
--- a/app/code/core/Mage/Api/controllers/SoapController.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice main controller
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_SoapController extends Mage_Api_Controller_Action
-{
- public function indexAction()
- {
- /* @var $server Mage_Api_Model_Server */
- $this->_getServer()->init($this, 'soap')
- ->run();
- }
-} // Class Mage_Api_IndexController End
diff --git a/app/code/core/Mage/Api/controllers/V2/SoapController.php b/app/code/core/Mage/Api/controllers/V2/SoapController.php
deleted file mode 100644
index 8b89473..0000000
--- a/app/code/core/Mage/Api/controllers/V2/SoapController.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice main controller
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_V2_SoapController extends Mage_Api_Controller_Action
-{
- public function indexAction()
- {
- if(Mage::helper('Mage_Api_Helper_Data')->isComplianceWSI()){
- $handler_name = 'soap_wsi';
- } else {
- $handler_name = 'soap_v2';
- }
-
- /* @var $server Mage_Api_Model_Server */
- $this->_getServer()->init($this, $handler_name, $handler_name)
- ->run();
- }
-} // Class Mage_Api_IndexController End
diff --git a/app/code/core/Mage/Api/controllers/XmlrpcController.php b/app/code/core/Mage/Api/controllers/XmlrpcController.php
deleted file mode 100644
index 2a66e1b..0000000
--- a/app/code/core/Mage/Api/controllers/XmlrpcController.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Xml Rpc webservice controller
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api_XmlrpcController extends Mage_Api_Controller_Action
-{
- public function indexAction()
- {
- $this->_getServer()->init($this, 'xmlrpc')
- ->run();
- }
-} // Class Mage_Api_XmlrpcController End
diff --git a/app/code/core/Mage/Api/etc/adminhtml/acl.xml b/app/code/core/Mage/Api/etc/adminhtml/acl.xml
deleted file mode 100644
index eece5a0..0000000
--- a/app/code/core/Mage/Api/etc/adminhtml/acl.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
--->
-<config>
- <acl>
- <resources>
- <resource id="Mage_Adminhtml::admin">
- <resource id="Mage_Adminhtml::system">
- <resource id="Mage_Api::api" module="Mage_Api" title="Web Services" sortOrder="0">
- <resource id="Mage_Api::users" title="SOAP/XML-RPC - Users" sortOrder="10" />
- <resource id="Mage_Api::roles" title="SOAP/XML-RPC - Roles" sortOrder="20" />
- </resource>
- <resource id="Mage_Adminhtml::config">
- <resource id="Mage_Api::config_api" module="Mage_Api" title="Magento Core API Section" />
- </resource>
- </resource>
- </resource>
- </resources>
- </acl>
-</config>
diff --git a/app/code/core/Mage/Api/etc/adminhtml/menu.xml b/app/code/core/Mage/Api/etc/adminhtml/menu.xml
deleted file mode 100644
index 77d3a67..0000000
--- a/app/code/core/Mage/Api/etc/adminhtml/menu.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
--->
-<config>
- <menu>
- <add id="Mage_Api::system_api" title="Web Services" module="Mage_Api" sortOrder="25" parent="Mage_Adminhtml::system" resource="Mage_Api::api"/>
- <add id="Mage_Api::system_api_users" title="SOAP/XML-RPC - Users" module="Mage_Api" sortOrder="10" parent="Mage_Api::system_api" action="adminhtml/api_user" resource="Mage_Api::users"/>
- <add id="Mage_Api::system_api_roles" title="SOAP/XML-RPC - Roles" module="Mage_Api" sortOrder="20" parent="Mage_Api::system_api" action="adminhtml/api_role" resource="Mage_Api::roles"/>
- </menu>
-</config>
diff --git a/app/code/core/Mage/Api/etc/adminhtml/system.xml b/app/code/core/Mage/Api/etc/adminhtml/system.xml
deleted file mode 100644
index 336985d..0000000
--- a/app/code/core/Mage/Api/etc/adminhtml/system.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
--->
-<config>
- <system>
- <section id="api" translate="label" module="Mage_Api" type="text" sortOrder="101" showInDefault="1" showInWebsite="1" showInStore="1">
- <label>Magento Core API</label>
- <tab>service</tab>
- <resource>Mage_Api::config_api</resource>
- <group id="config" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
- <label>General Settings</label>
- <field id="charset" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
- <label>Default Response Charset</label>
- </field>
- <field id="session_timeout" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
- <label>Client Session Timeout (sec.)</label>
- </field>
- <field id="compliance_wsi" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
- <label>WS-I Compliance</label>
- <source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
- <backend_model>Mage_Backend_Model_Config_Backend_Store</backend_model>
- </field>
- <field id="wsdl_cache_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
- <label>Enable WSDL Cache</label>
- <source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
- <backend_model>Mage_Backend_Model_Config_Backend_Store</backend_model>
- </field>
- </group>
- </section>
- </system>
-</config>
diff --git a/app/code/core/Mage/Api/etc/api.xml b/app/code/core/Mage/Api/etc/api.xml
deleted file mode 100644
index 59ab04d..0000000
--- a/app/code/core/Mage/Api/etc/api.xml
+++ /dev/null
@@ -1,287 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
--->
-<config>
- <api>
- <adapter_aliases>
- <v2_soap>
- <suggest_class>Mage_Api_Helper_Data</suggest_class>
- <suggest_method>getV2AdapterCode</suggest_method>
- </v2_soap>
- </adapter_aliases>
- <adapters>
- <soap>
- <model>Mage_Api_Model_Server_Adapter_Soap</model>
- <handler>default</handler>
- <active>1</active>
- <required>
- <extensions>
- <soap />
- </extensions>
- </required>
- </soap>
- <soap_v2>
- <model>Mage_Api_Model_Server_V2_Adapter_Soap</model>
- <handler>soap_v2</handler>
- <active>1</active>
- <required>
- <extensions>
- <soap />
- </extensions>
- </required>
- </soap_v2>
- <soap_wsi>
- <model>Mage_Api_Model_Server_Wsi_Adapter_Soap</model>
- <handler>soap_wsi</handler>
- <active>1</active>
- <required>
- <extensions>
- <soap />
- </extensions>
- </required>
- </soap_wsi>
- <xmlrpc>
- <model>Mage_Api_Model_Server_Adapter_Xmlrpc</model>
- <handler>default</handler>
- <active>1</active>
- </xmlrpc>
- <default>
- <use>soap</use>
- </default>
- </adapters>
- <handlers>
- <default>
- <model>Mage_Api_Model_Server_Handler</model>
- </default>
- <soap_v2>
- <model>Mage_Api_Model_Server_V2_Handler</model>
- </soap_v2>
- <soap_wsi>
- <model>Mage_Api_Model_Server_Wsi_Handler</model>
- </soap_wsi>
- </handlers>
- <resources>
- </resources>
- <resources_alias>
- </resources_alias>
- <v2>
- <wsdl>
- <prefix>
- <wsdl>http://schemas.xmlsoap.org/wsdl/</wsdl>
- </prefix>
- </wsdl>
- </v2>
- <faults>
- <unknown>
- <code>0</code>
- <message>Unknown Error</message>
- </unknown>
- <internal>
- <code>1</code>
- <message>Internal Error. Please see log for details.</message>
- </internal>
- <access_denied>
- <code>2</code>
- <message>Access denied.</message>
- </access_denied>
- <resource_path_invalid>
- <code>3</code>
- <message>Invalid api path.</message>
- </resource_path_invalid>
- <resource_path_not_callable>
- <code>4</code>
- <message>Resource path is not callable.</message>
- </resource_path_not_callable>
- <session_expired>
- <code>5</code>
- <message>Session expired. Try to relogin.</message>
- </session_expired>
- <invalid_request_param>
- <code>6</code>
- <message>Required parameter is missing, for more details see "exception.log".</message>
- </invalid_request_param>
- </faults>
- <acl>
- <resources>
- <all>
- </all>
- </resources>
-
- <privilegeSets>
- <default>
- <view descr="View entity"/>
- <edit descr="Edit entity"/>
- <delete descr="Delete entity"/>
- <create descr="Create entity"/>
- </default>
- </privilegeSets>
- </acl>
-
- <domain_messages>
- <!-- module name -->
- <core>
- <!-- 200 -->
- <success>
- <ok>Request is executed.</ok>
- </success>
- <!-- 201 -->
- <created>
- <created>Request is executed. Created new resource.</created>
- </created>
- <!-- 202 -->
- <processing>
- <processing>Request is carried out.</processing>
- </processing>
- <!-- 400 -->
- <validation>
- <invalid_param>Parameter "%s" is not valid.</invalid_param>
- </validation>
- <!-- 400 -->
- <request_error>
- <!-- Client sent wrong API version -->
- <invalid_api_version>API version "%s" not found.</invalid_api_version>
- </request_error>
- <!-- 401 -->
- <authentication>
- <protect_resource>You must provide an authenticated user for this method.</protect_resource>
- <invalid_token>Token in request is not valid.</invalid_token>
- </authentication>
- <!-- 403 -->
- <forbidden>
- <api_key_invalid>Invalid API key</api_key_invalid>
- </forbidden>
- <!-- 404 -->
- <not_found>
- <item_not_found>Requested item %s not found.</item_not_found>
- <resource_not_found>Requested resource %s not found.</resource_not_found>
- </not_found>
- <!-- 405 -->
- <not_allowed>
- <method_not_allowed>Method "%s" is not allowed.</method_not_allowed>
- </not_allowed>
- <!-- 406 -->
- <not_acceptable>
- <api_version_required>Api version is required.</api_version_required>
- </not_acceptable>
- <!-- 410 -->
- <gone>
- <!-- Message when client trying sent the API version which no longer maintained -->
- <api_deprecated>API version "%s" is deprecated.</api_deprecated>
- <!-- Message when client trying request the resource which no longer maintained -->
- <deprecated>Resource "%s" is deprecated.</deprecated>
- </gone>
-
- <!-- 500 -->
- <internal_error>
- <!-- Code error message not found or not exist -->
- <unknown_error>There was unknown error while processing your request.</unknown_error>
- <!-- Internal error when server catch some exception or language error -->
- <internal_error>There was internal error while processing your request.</internal_error>
- <!-- Developer mode message about error -->
- <code_error>Server has internal error. %s: %s</code_error>
- </internal_error>
- <!-- 501 -->
- <not_implemented>
- <resource_not_implemented>This resource is not implemented so far.</resource_not_implemented>
- <method_not_implemented>This method is not implemented so far.</method_not_implemented>
- </not_implemented>
- </core>
- </domain_messages>
-
- <!-- Message Domains with relation to HTTP codes -->
- <!-- The priority for domains is the HTTP code -->
- <domain_codes>
- <!-- All success messages except "entry_created", "processing" -->
- <success>
- <http_code>200</http_code>
- <type>notification</type>
- </success>
- <!-- Messages when created new entry -->
- <created>
- <http_code>201</http_code>
- <type>notification</type>
- </created>
- <!-- Processing messages -->
- <processing>
- <http_code>202</http_code>
- <type>notification</type>
- </processing>
-
- <!-- Validation messages -->
- <validation>
- <http_code>400</http_code>
- <type>error</type>
- </validation>
- <!-- Messages when the request from a client has an error -->
- <request_error>
- <http_code>400</http_code>
- <type>error</type>
- </request_error>
- <!-- Authentication error messages -->
- <authentication>
- <http_code>401</http_code>
- <type>error</type>
- </authentication>
- <!-- Messages when post request is accepted but cannot performed -->
- <forbidden>
- <http_code>403</http_code>
- <type>error</type>
- </forbidden>
- <!-- Messages when some data not found -->
- <not_found>
- <http_code>404</http_code>
- <type>error</type>
- </not_found>
- <!-- Messages when some method is not allowed -->
- <not_allowed>
- <http_code>405</http_code>
- <type>error</type>
- </not_allowed>
- <!-- Messages when some is not acceptable -->
- <not_acceptable>
- <http_code>406</http_code>
- <type>error</type>
- </not_acceptable>
- <!-- Messages when some resource are gone -->
- <gone>
- <http_code>410</http_code>
- <type>error</type>
- </gone>
- <!-- All messages related with internal errors -->
- <internal_error>
- <http_code>500</http_code>
- <type>error</type>
- </internal_error>
- <!-- Messages when something not implemented -->
- <not_implemented>
- <http_code>501</http_code>
- <type>error</type>
- </not_implemented>
- </domain_codes>
-
- </api>
-</config>
diff --git a/app/code/core/Mage/Api/etc/config.xml b/app/code/core/Mage/Api/etc/config.xml
deleted file mode 100644
index 3ece14a..0000000
--- a/app/code/core/Mage/Api/etc/config.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
--->
-<config>
- <modules>
- <Mage_Api>
- <version>1.6.0.0</version>
- <active>true</active>
- <codePool>core</codePool>
- <depends>
- <Mage_Core />
- </depends>
- </Mage_Api>
- </modules>
- <global>
- <ignoredModules>
- <entities>
- <api/>
- </entities>
- </ignoredModules>
- <cache>
- <types>
- <config_api translate="label,description" module="Mage_Api">
- <label>Web Services Configuration</label>
- <description>Web Services definition files (api.xml).</description>
- <tags>CONFIG_API</tags>
- </config_api>
- </types>
- </cache>
- <resources>
- <api_setup>
- <setup>
- <module>Mage_Api</module>
- </setup>
- </api_setup>
- </resources>
- <request>
- <direct_front_name>
- <api/>
- </direct_front_name>
- </request>
- </global>
- <frontend>
- <routers>
- <api>
- <use>standard</use>
- <args>
- <module>Mage_Api</module>
- <frontName>api</frontName>
- </args>
- </api>
- </routers>
- <translate>
- <modules>
- <Mage_Api>
- <files>
- <default>Mage_Api.csv</default>
- </files>
- </Mage_Api>
- </modules>
- </translate>
- </frontend>
- <adminhtml>
- <translate>
- <modules>
- <Mage_Api>
- <files>
- <default>Mage_Api.csv</default>
- </files>
- </Mage_Api>
- </modules>
- </translate>
- </adminhtml>
- <default>
- <api>
- <config>
- <charset>UTF-8</charset>
- <session_timeout>3600</session_timeout>
- <compliance_wsi>0</compliance_wsi>
- <wsdl_cache_enabled>0</wsdl_cache_enabled>
- </config>
- </api>
- </default>
-</config>
diff --git a/app/code/core/Mage/Api/etc/wsdl.xml b/app/code/core/Mage/Api/etc/wsdl.xml
deleted file mode 100644
index 6b24d0d..0000000
--- a/app/code/core/Mage/Api/etc/wsdl.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
- name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
-<!-- <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />-->
- <complexType name="FixedArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]" />
- </restriction>
- </complexContent>
- </complexType>
- </schema>
- </types>
- <message name="call">
- <part name="sessionId" type="xsd:string" />
- <part name="resourcePath" type="xsd:string" />
- <part name="args" type="xsd:anyType" />
- </message>
- <message name="callResponse">
- <part name="callReturn" type="xsd:anyType" />
- </message>
- <message name="multiCall">
- <part name="sessionId" type="xsd:string" />
- <part name="calls" type="typens:FixedArray" />
- <part name="options" type="xsd:anyType" />
- </message>
- <message name="multiCallResponse">
- <part name="multiCallReturn" type="typens:FixedArray" />
- </message>
- <message name="endSession">
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="endSessionResponse">
- <part name="endSessionReturn" type="xsd:boolean" />
- </message>
- <message name="login">
- <part name="username" type="xsd:string" />
- <part name="apiKey" type="xsd:string" />
- </message>
- <message name="loginResponse">
- <part name="loginReturn" type="xsd:string" />
- </message>
- <message name="resources">
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="resourcesResponse">
- <part name="resourcesReturn" type="typens:FixedArray" />
- </message>
- <message name="globalFaults">
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="globalFaultsResponse">
- <part name="globalFaultsReturn" type="typens:FixedArray" />
- </message>
- <message name="resourceFaults">
- <part name="resourceName" type="xsd:string" />
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="resourceFaultsResponse">
- <part name="resourceFaultsReturn" type="typens:FixedArray" />
- </message>
- <message name="startSession" />
- <message name="startSessionResponse">
- <part name="startSessionReturn" type="xsd:string" />
- </message>
- <portType name="{{var wsdl.handler}}PortType">
- <operation name="call">
- <documentation>Call api functionality</documentation>
- <input message="typens:call" />
- <output message="typens:callResponse" />
- </operation>
- <operation name="multiCall">
- <documentation>Multiple calls of resource functionality</documentation>
- <input message="typens:multiCall" />
- <output message="typens:multiCallResponse" />
- </operation>
- <operation name="endSession">
- <documentation>End web service session</documentation>
- <input message="typens:endSession" />
- <output message="typens:endSessionResponse" />
- </operation>
- <operation name="login">
- <documentation>Login user and retrive session id</documentation>
- <input message="typens:login" />
- <output message="typens:loginResponse" />
- </operation>
- <operation name="startSession">
- <documentation>Start web service session</documentation>
- <input message="typens:startSession" />
- <output message="typens:startSessionResponse" />
- </operation>
- <operation name="resources">
- <documentation>List of available resources</documentation>
- <input message="typens:resources" />
- <output message="typens:resourcesResponse" />
- </operation>
- <operation name="globalFaults">
- <documentation>List of resource faults</documentation>
- <input message="typens:globalFaults" />
- <output message="typens:globalFaultsResponse" />
- </operation>
- <operation name="resourceFaults">
- <documentation>List of global faults</documentation>
- <input message="typens:resourceFaults" />
- <output message="typens:resourceFaultsResponse" />
- </operation>
- </portType>
- <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="call">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="multiCall">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="endSession">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="login">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="startSession">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="resources">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="globalFaults">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="resourceFaults">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- </binding>
- <service name="{{var wsdl.name}}Service">
- <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
- <soap:address location="{{var wsdl.url}}" />
- </port>
- </service>
-</definitions>
diff --git a/app/code/core/Mage/Api/etc/wsdl2.xml b/app/code/core/Mage/Api/etc/wsdl2.xml
deleted file mode 100644
index fd9fe0d..0000000
--- a/app/code/core/Mage/Api/etc/wsdl2.xml
+++ /dev/null
@@ -1,242 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
- name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
- <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="associativeEntity">
- <all>
- <element name="key" type="xsd:string" />
- <element name="value" type="xsd:string" />
- </all>
- </complexType>
- <complexType name="associativeArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:associativeEntity[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="associativeMultiEntity">
- <all>
- <element name="key" type="xsd:string" />
- <element name="value" type="typens:ArrayOfString" />
- </all>
- </complexType>
- <complexType name="associativeMultiArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:associativeMultiEntity[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="filters">
- <all>
- <element name="filter" type="typens:associativeArray" minOccurs="0" />
- <element name="complex_filter" type="typens:complexFilterArray" minOccurs="0" />
- </all>
- </complexType>
- <complexType name="complexFilterArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:complexFilter[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="complexFilter">
- <all>
- <element name="key" type="xsd:string" />
- <element name="value" type="typens:associativeEntity" />
- </all>
- </complexType>
- <complexType name="ArrayOfString">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="ArrayOfInt">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="apiMethodEntity">
- <all>
- <element name="title" type="xsd:string" />
- <element name="path" type="xsd:string" />
- <element name="name" type="xsd:string" />
- <element name="aliases" type="typens:ArrayOfString" />
- </all>
- </complexType>
- <complexType name="ArrayOfApiMethods">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:apiMethodEntity[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="apiEntity">
- <all>
- <element name="title" type="xsd:string" />
- <element name="name" type="xsd:string" />
- <element name="aliases" type="typens:ArrayOfString" />
- <element name="methods" type="typens:ArrayOfApiMethods" />
- </all>
- </complexType>
- <complexType name="ArrayOfApis">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:apiEntity[]" />
- </restriction>
- </complexContent>
- </complexType>
- <complexType name="existsFaltureEntity">
- <all>
- <element name="code" type="xsd:string" />
- <element name="message" type="xsd:string" />
- </all>
- </complexType>
- <complexType name="ArrayOfExistsFaltures">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:existsFaltureEntity[]" />
- </restriction>
- </complexContent>
- </complexType>
- </schema>
- </types>
- <message name="endSession">
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="endSessionResponse">
- <part name="endSessionReturn" type="xsd:boolean" />
- </message>
- <message name="login">
- <part name="username" type="xsd:string" />
- <part name="apiKey" type="xsd:string" />
- </message>
- <message name="loginResponse">
- <part name="loginReturn" type="xsd:string" />
- </message>
- <message name="resourcesRequest">
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="resourcesResponse">
- <part name="resourcesReturn" type="typens:ArrayOfApis" />
- </message>
- <message name="globalFaults">
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="globalFaultsResponse">
- <part name="globalFaultsReturn" type="typens:ArrayOfExistsFaltures" />
- </message>
- <message name="resourceFaults">
- <part name="resourceName" type="xsd:string" />
- <part name="sessionId" type="xsd:string" />
- </message>
- <message name="resourceFaultsResponse">
- <part name="resourceFaultsReturn" type="typens:ArrayOfExistsFaltures" />
- </message>
- <message name="startSession" />
- <message name="startSessionResponse">
- <part name="startSessionReturn" type="xsd:string" />
- </message>
- <portType name="{{var wsdl.handler}}PortType">
- <operation name="endSession">
- <documentation>End web service session</documentation>
- <input message="typens:endSession" />
- <output message="typens:endSessionResponse" />
- </operation>
- <operation name="login">
- <documentation>Login user and retrive session id</documentation>
- <input message="typens:login" />
- <output message="typens:loginResponse" />
- </operation>
- <operation name="startSession">
- <documentation>Start web service session</documentation>
- <input message="typens:startSession" />
- <output message="typens:startSessionResponse" />
- </operation>
- <operation name="resources">
- <documentation>List of available resources</documentation>
- <input message="typens:resourcesRequest" />
- <output message="typens:resourcesResponse" />
- </operation>
- <operation name="globalFaults">
- <documentation>List of global faults</documentation>
- <input message="typens:globalFaults" />
- <output message="typens:globalFaultsResponse" />
- </operation>
- <operation name="resourceFaults">
- <documentation>List of resource faults</documentation>
- <input message="typens:resourceFaults" />
- <output message="typens:resourceFaultsResponse" />
- </operation>
- </portType>
- <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="endSession">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="login">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="startSession">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="resources">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="globalFaults">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- <operation name="resourceFaults">
- <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
- <input>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </input>
- <output>
- <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
- </output>
- </operation>
- </binding>
- <service name="{{var wsdl.name}}Service">
- <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
- <soap:address location="{{var wsdl.url}}" />
- </port>
- </service>
-</definitions>
diff --git a/app/code/core/Mage/Api/etc/wsi.xml b/app/code/core/Mage/Api/etc/wsi.xml
deleted file mode 100644
index 0db28ab..0000000
--- a/app/code/core/Mage/Api/etc/wsi.xml
+++ /dev/null
@@ -1,381 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- name="{{var wsdl.name}}"
- targetNamespace="urn:{{var wsdl.name}}">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
- <xsd:complexType name="associativeEntity">
- <xsd:sequence>
- <xsd:element name="key" type="xsd:string" />
- <xsd:element name="value" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="associativeArray">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:associativeEntity" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="associativeMultiEntity">
- <xsd:sequence>
- <xsd:element name="key" type="xsd:string" />
- <xsd:element name="value" type="typens:ArrayOfString" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="associativeMultiArray">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:associativeMultiEntity" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="complexFilter">
- <xsd:sequence>
- <xsd:element name="key" type="xsd:string" />
- <xsd:element name="value" type="typens:associativeEntity" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="complexFilterArray">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:complexFilter" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="filters">
- <xsd:sequence>
- <xsd:element name="filter" type="typens:associativeArray" minOccurs="0" />
- <xsd:element name="complex_filter" type="typens:complexFilterArray" minOccurs="0" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfString">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfInt">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="xsd:int" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="apiMethodEntity">
- <xsd:sequence>
- <xsd:element name="title" type="xsd:string" />
- <xsd:element name="path" type="xsd:string" />
- <xsd:element name="name" type="xsd:string" />
- <xsd:element name="aliases" type="typens:ArrayOfString" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfApiMethods">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:apiMethodEntity" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="apiEntity">
- <xsd:sequence>
- <xsd:element name="title" type="xsd:string" />
- <xsd:element name="name" type="xsd:string" />
- <xsd:element name="aliases" type="typens:ArrayOfString" />
- <xsd:element name="methods" type="typens:ArrayOfApiMethods" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfApis">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:apiEntity" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="existsFaltureEntity">
- <xsd:sequence>
- <xsd:element name="code" type="xsd:string" />
- <xsd:element name="message" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="ArrayOfExistsFaltures">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:existsFaltureEntity" />
- </xsd:sequence>
- </xsd:complexType>
-
-
-
- <xsd:element name="callParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
- <xsd:element minOccurs="1" maxOccurs="1" name="apiPath" type="xsd:string" />
- <xsd:element minOccurs="1" maxOccurs="1" name="args" type="xsd:anyType" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="callResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:anyType" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="multiCallParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
- <xsd:element minOccurs="1" maxOccurs="1" name="calls" type="xsd:anyType" />
- <xsd:element minOccurs="1" maxOccurs="1" name="options" type="xsd:anyType" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="multiCallResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:anyType" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="endSessionParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="endSessionResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="loginParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="username" type="xsd:string" />
- <xsd:element minOccurs="1" maxOccurs="1" name="apiKey" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="loginResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resourcesRequestParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resourcesResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:ArrayOfApis" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="globalFaultsParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="globalFaultsResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:ArrayOfExistsFaltures" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resourceFaultsParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
- <xsd:element minOccurs="1" maxOccurs="1" name="resourceName" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resourceFaultsResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:ArrayOfExistsFaltures" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="startSessionResponseParam">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="call">
- <wsdl:part name="parameters" element="typens:callParam" />
- </wsdl:message>
- <wsdl:message name="callResponse">
- <wsdl:part name="parameters" element="typens:callResponseParam" />
- </wsdl:message>
- <wsdl:message name="multiCall">
- <wsdl:part name="parameters" element="typens:multiCallParam" />
- </wsdl:message>
- <wsdl:message name="multiCallResponse">
- <wsdl:part name="parameters" element="typens:multiCallResponseParam" />
- </wsdl:message>
- <wsdl:message name="endSession">
- <wsdl:part name="parameters" element="typens:endSessionParam" />
- </wsdl:message>
- <wsdl:message name="endSessionResponse">
- <wsdl:part name="parameters" element="typens:endSessionResponseParam" />
- </wsdl:message>
- <wsdl:message name="login">
- <wsdl:part name="parameters" element="typens:loginParam" />
- </wsdl:message>
- <wsdl:message name="loginResponse">
- <wsdl:part name="parameters" element="typens:loginResponseParam" />
- </wsdl:message>
- <wsdl:message name="resourcesRequest">
- <wsdl:part name="parameters" element="typens:resourcesRequestParam" />
- </wsdl:message>
- <wsdl:message name="resourcesResponse">
- <wsdl:part name="parameters" element="typens:resourcesResponseParam" />
- </wsdl:message>
- <wsdl:message name="globalFaults">
- <wsdl:part name="parameters" element="typens:globalFaultsParam" />
- </wsdl:message>
- <wsdl:message name="globalFaultsResponse">
- <wsdl:part name="parameters" element="typens:globalFaultsResponseParam" />
- </wsdl:message>
- <wsdl:message name="resourceFaults">
- <wsdl:part name="parameters" element="typens:resourceFaultsParam" />
- </wsdl:message>
- <wsdl:message name="resourceFaultsResponse">
- <wsdl:part name="parameters" element="typens:resourceFaultsResponseParam" />
- </wsdl:message>
- <wsdl:message name="startSession" />
- <wsdl:message name="startSessionResponse">
- <wsdl:part name="parameters" element="typens:startSessionResponseParam" />
- </wsdl:message>
- <wsdl:portType name="{{var wsdl.handler}}PortType">
- <wsdl:operation name="call">
- <wsdl:documentation>Call api functionality</wsdl:documentation>
- <wsdl:input message="typens:call" />
- <wsdl:output message="typens:callResponse" />
- </wsdl:operation>
- <wsdl:operation name="multiCall">
- <wsdl:documentation>Multiple calls of resource functionality</wsdl:documentation>
- <wsdl:input message="typens:multiCall" />
- <wsdl:output message="typens:multiCallResponse" />
- </wsdl:operation>
- <wsdl:operation name="endSession">
- <wsdl:documentation>End web service session</wsdl:documentation>
- <wsdl:input message="typens:endSession" />
- <wsdl:output message="typens:endSessionResponse" />
- </wsdl:operation>
- <wsdl:operation name="login">
- <wsdl:documentation>Login user and retrive session id</wsdl:documentation>
- <wsdl:input message="typens:login" />
- <wsdl:output message="typens:loginResponse" />
- </wsdl:operation>
- <wsdl:operation name="startSession">
- <wsdl:documentation>Start web service session</wsdl:documentation>
- <wsdl:input message="typens:startSession" />
- <wsdl:output message="typens:startSessionResponse" />
- </wsdl:operation>
- <wsdl:operation name="resources">
- <wsdl:documentation>List of available resources</wsdl:documentation>
- <wsdl:input message="typens:resourcesRequest" />
- <wsdl:output message="typens:resourcesResponse" />
- </wsdl:operation>
- <wsdl:operation name="globalFaults">
- <wsdl:documentation>List of global faults</wsdl:documentation>
- <wsdl:input message="typens:globalFaults" />
- <wsdl:output message="typens:globalFaultsResponse" />
- </wsdl:operation>
- <wsdl:operation name="resourceFaults">
- <wsdl:documentation>List of resource faults</wsdl:documentation>
- <wsdl:input message="typens:resourceFaults" />
- <wsdl:output message="typens:resourceFaultsResponse" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
- <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="call">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="multiCall">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="endSession">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="login">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="startSession">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="resources">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="globalFaults">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="resourceFaults">
- <soap:operation soapAction="" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="{{var wsdl.name}}Service">
- <wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
- <soap:address location="{{var wsdl.url}}" />
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/app/code/core/Mage/Api/locale/de_DE/Mage_Api.csv b/app/code/core/Mage/Api/locale/de_DE/Mage_Api.csv
deleted file mode 100644
index 4d060c6..0000000
--- a/app/code/core/Mage/Api/locale/de_DE/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","Zugang verweigert."
-"Client Session Timeout (sec.)","Kunde Session-Timeout (in Sekunden)"
-"Default Response Charset","Standard-Schriftsatz für Antwort"
-"Email","E-Mail"
-"General Settings","Allgemeine Einstellungen"
-"Invalid webservice adapter specified.","Ungültiger Webservice Adapter angegeben."
-"Invalid webservice handler specified.","Ungültiger Webservice Handler angegeben."
-"Magento Core API","Magento Core API"
-"Magento Core API Section","Magento Core API Sektion"
-"Roles","Rollen"
-"Unable to login.","Einloggen nicht möglich."
-"User Name","Benutzername"
-"Users","Benutzer"
-"WS-I Compliance","WS-I Übereinstimmung"
-"Web Services","Webdienste"
-"Your account has been deactivated.","Ihr Benutzerkonto wurde deaktiviert."
diff --git a/app/code/core/Mage/Api/locale/en_US/Mage_Api.csv b/app/code/core/Mage/Api/locale/en_US/Mage_Api.csv
deleted file mode 100644
index 5c6674a..0000000
--- a/app/code/core/Mage/Api/locale/en_US/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","Access denied."
-"Client Session Timeout (sec.)","Client Session Timeout (sec.)"
-"Default Response Charset","Default Response Charset"
-"Email","Email"
-"General Settings","General Settings"
-"Invalid webservice adapter specified.","Invalid webservice adapter specified."
-"Invalid webservice handler specified.","Invalid webservice handler specified."
-"Magento Core API","Magento Core API"
-"Magento Core API Section","Magento Core API Section"
-"Roles","Roles"
-"Unable to login.","Unable to login."
-"User Name","User Name"
-"Users","Users"
-"WS-I Compliance","WS-I Compliance"
-"Web Services","Web Services"
-"Your account has been deactivated.","Your account has been deactivated."
diff --git a/app/code/core/Mage/Api/locale/es_ES/Mage_Api.csv b/app/code/core/Mage/Api/locale/es_ES/Mage_Api.csv
deleted file mode 100644
index 972a0ac..0000000
--- a/app/code/core/Mage/Api/locale/es_ES/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","Acceso denegado"
-"Client Session Timeout (sec.)","Plazo límite de la sesión cliente (seg.)"
-"Default Response Charset","Conjunto de caracteres de respuesta por omisión"
-"Email","Correo electrónico"
-"General Settings","Opciones generales"
-"Invalid webservice adapter specified.","Adaptador de servicio web especificado inválido"
-"Invalid webservice handler specified.","Controlador de servicio web especificado inválido"
-"Magento Core API","API del núcleo de Magento"
-"Magento Core API Section","Apartado de la API (interfaz de programación de aplicaciones) del núcleo de Magento"
-"Roles","Roles"
-"Unable to login.","No es posible entrar al sistema."
-"User Name","Nombre de usuario"
-"Users","Usuarios"
-"WS-I Compliance","Conformidad con WS-I"
-"Web Services","Servicios web"
-"Your account has been deactivated.","Se ha desactivado su cuenta."
diff --git a/app/code/core/Mage/Api/locale/fr_FR/Mage_Api.csv b/app/code/core/Mage/Api/locale/fr_FR/Mage_Api.csv
deleted file mode 100644
index 9389383..0000000
--- a/app/code/core/Mage/Api/locale/fr_FR/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","Accès refusé."
-"Client Session Timeout (sec.)","Expiration de la session client (secondes)"
-"Default Response Charset","Table de caractères de la réponse par défaut"
-"Email","Email"
-"General Settings","Réglages généraux"
-"Invalid webservice adapter specified.","Adaptateur de service web invalide."
-"Invalid webservice handler specified.","Gérant de service web invalide."
-"Magento Core API","Magento Core API"
-"Magento Core API Section","Magento Core API Section"
-"Roles","Rôles"
-"Unable to login.","Connexion impossible."
-"User Name","Nom d'utilisateur"
-"Users","Utilisateurs"
-"WS-I Compliance","Conforme à WS-I"
-"Web Services","Services Web"
-"Your account has been deactivated.","Votre compte a été désactivé."
diff --git a/app/code/core/Mage/Api/locale/nl_NL/Mage_Api.csv b/app/code/core/Mage/Api/locale/nl_NL/Mage_Api.csv
deleted file mode 100644
index 62570ad..0000000
--- a/app/code/core/Mage/Api/locale/nl_NL/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","Toegang geweigerd."
-"Client Session Timeout (sec.)","Klant Sessie Time out (sec.)"
-"Default Response Charset","Karakterset standaard antwoord"
-"Email","Email"
-"General Settings","Algemene instellingen"
-"Invalid webservice adapter specified.","Ongeldige webdienst adapter gespecificeerd."
-"Invalid webservice handler specified.","Ongeldige webservice handler gespecificeerd."
-"Magento Core API","Magento Core API"
-"Magento Core API Section","Magento Core API Sectie"
-"Roles","Rollen"
-"Unable to login.","Kan niet inloggen."
-"User Name","Gebruikersnaam"
-"Users","Gebruikers"
-"WS-I Compliance","WS-I naleving"
-"Web Services","Web Diensten"
-"Your account has been deactivated.","Uw account is gedeactiveerd."
diff --git a/app/code/core/Mage/Api/locale/pt_BR/Mage_Api.csv b/app/code/core/Mage/Api/locale/pt_BR/Mage_Api.csv
deleted file mode 100644
index bebef0b..0000000
--- a/app/code/core/Mage/Api/locale/pt_BR/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","Acesso negado."
-"Client Session Timeout (sec.)","Tempo Limite da Sessão de Cliente (seg.)"
-"Default Response Charset","Conjunto de Caracteres Predefinido de Resposta"
-"Email","E-mail"
-"General Settings","Definições Gerais"
-"Invalid webservice adapter specified.","Adaptador de serviço de rede especificado inválido."
-"Invalid webservice handler specified.","Processador de serviço de rede especificado inválido."
-"Magento Core API","Núcleo Magento API"
-"Magento Core API Section","Seção Núcleo Magento API"
-"Roles","Funções"
-"Unable to login.","Incapaz de entrar."
-"User Name","Nome do Usuário"
-"Users","Usuários"
-"WS-I Compliance","Conformidade WS-I"
-"Web Services","Serviços Web"
-"Your account has been deactivated.","Sua conta foi desativada."
diff --git a/app/code/core/Mage/Api/locale/zh_CN/Mage_Api.csv b/app/code/core/Mage/Api/locale/zh_CN/Mage_Api.csv
deleted file mode 100644
index 9130432..0000000
--- a/app/code/core/Mage/Api/locale/zh_CN/Mage_Api.csv
+++ /dev/null
@@ -1,16 +0,0 @@
-"Access denied.","访问被拒绝"
-"Client Session Timeout (sec.)","客户端会话超时(秒。)"
-"Default Response Charset","默认响应字符集"
-"Email","电子邮件"
-"General Settings","常规设置"
-"Invalid webservice adapter specified.","指定的Web服务适配器无效。"
-"Invalid webservice handler specified.","指定的Web服务处理程序无效。"
-"Magento Core API","Magento Core API"
-"Magento Core API Section","Magento Core API 部分"
-"Roles","角色"
-"Unable to login.","无法登录。"
-"User Name","用户名"
-"Users","用户"
-"WS-I Compliance","WS-I 兼容"
-"Web Services","Web服务"
-"Your account has been deactivated.","您的帐户已被撤销。"
diff --git a/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php b/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php
deleted file mode 100644
index 479c250..0000000
--- a/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Api install
- *
- * @category Mage
- * @package Mage_Api
- * @author Magento Core Team <core@magentocommerce.com>
- */
-$installer = $this;
-/* @var $installer Mage_Core_Model_Resource_Setup */
-
-$installer->startSetup();
-
-/**
- * Create table 'api_assert'
- */
-$table = $installer->getConnection()
- ->newTable($installer->getTable('api_assert'))
- ->addColumn('assert_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'identity' => true,
- 'unsigned' => true,
- 'nullable' => false,
- 'primary' => true,
- ), 'Assert id')
- ->addColumn('assert_type', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array(
- ), 'Assert type')
- ->addColumn('assert_data', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
- ), 'Assert additional data')
- ->setComment('Api ACL Asserts');
-$installer->getConnection()->createTable($table);
-
-/**
- * Create table 'api_role'
- */
-$table = $installer->getConnection()
- ->newTable($installer->getTable('api_role'))
- ->addColumn('role_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'identity' => true,
- 'unsigned' => true,
- 'nullable' => false,
- 'primary' => true,
- ), 'Role id')
- ->addColumn('parent_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'Parent role id')
- ->addColumn('tree_level', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'Role level in tree')
- ->addColumn('sort_order', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'Sort order to display on admin area')
- ->addColumn('role_type', Varien_Db_Ddl_Table::TYPE_TEXT, 1, array(
- 'nullable' => false,
- 'default' => '0',
- ), 'Role type')
- ->addColumn('user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'User id')
- ->addColumn('role_name', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
- ), 'Role name')
- ->addIndex($installer->getIdxName('api_role', array('parent_id', 'sort_order')),
- array('parent_id', 'sort_order'))
- ->addIndex($installer->getIdxName('api_role', array('tree_level')),
- array('tree_level'))
- ->setComment('Api ACL Roles');
-$installer->getConnection()->createTable($table);
-
-/**
- * Create table 'api_rule'
- */
-$table = $installer->getConnection()
- ->newTable($installer->getTable('api_rule'))
- ->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'identity' => true,
- 'unsigned' => true,
- 'nullable' => false,
- 'primary' => true,
- ), 'Api rule Id')
- ->addColumn('role_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'Api role Id')
- ->addColumn('resource_id', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
- ), 'Module code')
- ->addColumn('api_privileges', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array(
- ), 'Privileges')
- ->addColumn('assert_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'Assert id')
- ->addColumn('role_type', Varien_Db_Ddl_Table::TYPE_TEXT, 1, array(
- ), 'Role type')
- ->addColumn('api_permission', Varien_Db_Ddl_Table::TYPE_TEXT, 10, array(
- ), 'Permission')
- ->addIndex($installer->getIdxName('api_rule', array('resource_id', 'role_id')),
- array('resource_id', 'role_id'))
- ->addIndex($installer->getIdxName('api_rule', array('role_id', 'resource_id')),
- array('role_id', 'resource_id'))
- ->addForeignKey($installer->getFkName('api_rule', 'role_id', 'api_role', 'role_id'),
- 'role_id', $installer->getTable('api_role'), 'role_id',
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
- ->setComment('Api ACL Rules');
-$installer->getConnection()->createTable($table);
-
-/**
- * Create table 'api_user'
- */
-$table = $installer->getConnection()
- ->newTable($installer->getTable('api_user'))
- ->addColumn('user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'identity' => true,
- 'unsigned' => true,
- 'nullable' => false,
- 'primary' => true,
- ), 'User id')
- ->addColumn('firstname', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
- ), 'First name')
- ->addColumn('lastname', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
- ), 'Last name')
- ->addColumn('email', Varien_Db_Ddl_Table::TYPE_TEXT, 128, array(
- ), 'Email')
- ->addColumn('username', Varien_Db_Ddl_Table::TYPE_TEXT, 40, array(
- ), 'Nickname')
- ->addColumn('api_key', Varien_Db_Ddl_Table::TYPE_TEXT, 40, array(
- ), 'Api key')
- ->addColumn('created', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
- 'nullable' => false,
- ), 'User record create date')
- ->addColumn('modified', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
- ), 'User record modify date')
- ->addColumn('lognum', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'default' => '0',
- ), 'Quantity of log ins')
- ->addColumn('reload_acl_flag', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
- 'nullable' => false,
- 'default' => '0',
- ), 'Refresh ACL flag')
- ->addColumn('is_active', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
- 'nullable' => false,
- 'default' => '1',
- ), 'Account status')
- ->setComment('Api Users');
-$installer->getConnection()->createTable($table);
-
-/**
- * Create table 'api_session'
- */
-$table = $installer->getConnection()
- ->newTable($installer->getTable('api_session'))
- ->addColumn('user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- ), 'User id')
- ->addColumn('logdate', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
- 'nullable' => false,
- ), 'Login date')
- ->addColumn('sessid', Varien_Db_Ddl_Table::TYPE_TEXT, 40, array(
- ), 'Sessioin id')
- ->addIndex($installer->getIdxName('api_session', array('user_id')),
- array('user_id'))
- ->addIndex($installer->getIdxName('api_session', array('sessid')),
- array('sessid'))
- ->addForeignKey($installer->getFkName('api_session', 'user_id', 'api_user', 'user_id'),
- 'user_id', $installer->getTable('api_user'), 'user_id',
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
- ->setComment('Api Sessions');
-$installer->getConnection()->createTable($table);
-
-
-
-$installer->endSetup();
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute.php
deleted file mode 100644
index 8c75133..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API2 attributes grid container block
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Attribute extends Mage_Adminhtml_Block_Widget_Grid_Container
-{
- /**
- * Construct grid container
- */
- public function _construct()
- {
- parent::_construct();
-
- $this->_blockGroup = 'Mage_Api2';
- $this->_controller = 'adminhtml_attribute';
- $this->_headerText = $this->__('REST Attributes');
- $this->_removeButton('add');
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Buttons.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Buttons.php
deleted file mode 100644
index 33786f0..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Buttons.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block for rendering buttons
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Attribute_Buttons extends Mage_Adminhtml_Block_Template
-{
- /**
- * Construct
- */
- public function __construct()
- {
- parent::__construct();
- $this->setTemplate('api2/attribute/buttons.phtml');
- }
-
- /**
- * Prepare global layout
- *
- * @return Mage_Core_Block_Abstract
- */
- protected function _prepareLayout()
- {
- $buttons = array(
- 'backButton' => array(
- 'label' => $this->__('Back'),
- 'onclick' => sprintf("window.location.href='%s';", $this->getUrl('*/*/')),
- 'class' => 'back'
- ),
- 'saveButton' => array(
- 'label' => $this->__('Save'),
- 'onclick' => 'form.submit(); return false;',
- 'class' => 'save'
- ),
- );
-
- foreach ($buttons as $name => $data) {
- $button = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')->setData($data);
- $this->setChild($name, $button);
- }
-
- return parent::_prepareLayout();
- }
-
- /**
- * Get back button HTML
- *
- * @return string
- */
- public function getBackButtonHtml()
- {
- return $this->getChildHtml('backButton');
- }
-
- /**
- * Get reset button HTML
- *
- * @return string
- */
- public function getResetButtonHtml()
- {
- return $this->getChildHtml('resetButton');
- }
-
- /**
- * Get save button HTML
- *
- * @return string
- */
- public function getSaveButtonHtml()
- {
- return $this->getChildHtml('saveButton');
- }
-
- /**
- * Get block caption
- *
- * @return string
- */
- public function getCaption()
- {
- return $this->__('Edit');
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit.php
deleted file mode 100644
index 9d55b89..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Attribute Edit block
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Attribute_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
-{
- /**
- * Initialize edit form container
- */
- public function _construct()
- {
- $this->_objectId = 'id';
- $this->_blockGroup = 'Mage_Api2';
- $this->_controller = 'adminhtml_attribute';
-
- parent::_construct();
-
- $this->_updateButton('save', 'label', $this->__('Save'))
- ->_removeButton('delete');
- }
-
- /**
- * Retrieve text for header element depending on loaded page
- *
- * @return string
- */
- public function getHeaderText()
- {
- $userTypes = Mage_Api2_Model_Auth_User::getUserTypes();
- return $this->__('Edit attribute rules for %s Role', $userTypes[$this->getRequest()->getParam('type')]);
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php
deleted file mode 100644
index 4b961a6..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Attribute edit form block
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Attribute_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
-{
- /**
- * Prepare form before rendering HTML
- *
- * @return Mage_Api2_Block_Adminhtml_Attribute_Edit_Form
- */
- protected function _prepareForm()
- {
- $form = new Varien_Data_Form(array(
- 'id' => 'edit_form',
- 'action' => $this->getData('action'),
- 'method' => 'post'
- ));
-
-
- $form->setAction($this->getUrl('*/*/save', array('type' => $this->getRequest()->getParam('type'))))
- ->setUseContainer(true);
-
- $this->setForm($form);
-
- return parent::_prepareForm();
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Grid.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Grid.php
deleted file mode 100644
index 0816e4d..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Grid.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API2 attributes grid block
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Attribute_Grid extends Mage_Adminhtml_Block_Widget_Grid
-{
- /**
- * Set grid ID
- *
- * @param array $attributes
- */
- public function _construct()
- {
- parent::_construct();
- $this->setId('api2_attributes');
- }
-
- /**
- * Collection object set up
- */
- protected function _prepareCollection()
- {
- $collection = new Varien_Data_Collection();
-
- foreach (Mage_Api2_Model_Auth_User::getUserTypes() as $type => $label) {
- $collection->addItem(
- new Varien_Object(array('user_type_name' => $label, 'user_type_code' => $type))
- );
- }
-
- $this->setCollection($collection);
- }
-
- /**
- * Prepare grid columns
- *
- * @return Mage_Api2_Block_Adminhtml_Attribute_Grid
- */
- protected function _prepareColumns()
- {
- $this->addColumn('user_type_name', array(
- 'header' => $this->__('User Type'),
- 'index' => 'user_type_name'
- ));
-
- return parent::_prepareColumns();
- }
-
- /**
- * Disable unnecessary functionality
- *
- * @return Mage_Api2_Block_Adminhtml_Attribute_Grid
- */
- public function _prepareLayout()
- {
- $this->setFilterVisibility(false);
- $this->setPagerVisibility(false);
-
- return $this;
- }
-
- /**
- * Get row URL
- *
- * @param Varien_Object $row
- * @return string|null
- */
- public function getRowUrl($row)
- {
- if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Api2::rest_attributes_edit')) {
- return $this->getUrl('*/*/edit', array('type' => $row->getUserTypeCode()));
- }
-
- return null;
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Tab/Resource.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Tab/Resource.php
deleted file mode 100644
index 6fb02a4..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Tab/Resource.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block for rendering attributes tree list tab
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Model_Acl_Global_Role getRole()
- * @method Mage_Api2_Block_Adminhtml_Attribute_Tab_Resource setRole(Mage_Api2_Model_Acl_Global_Role $role)
- */
-class Mage_Api2_Block_Adminhtml_Attribute_Tab_Resource extends Mage_Adminhtml_Block_Widget_Form
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
-{
- /**
- * Tree model
- *
- * @var Mage_Api2_Model_Acl_Global_Rule_Tree
- */
- protected $_treeModel = false;
-
- /**
- * Constructor
- */
- public function _construct()
- {
- parent::_construct();
-
- $this->setId('api2_attribute_section_resources')
- ->setData('default_dir', Varien_Db_Select::SQL_ASC)
- ->setData('default_sort', 'sort_order')
- ->setData('title', $this->__('Attribute Rules Information'))
- ->setData('use_ajax', true);
-
- $options = array('type' => Mage_Api2_Model_Acl_Global_Rule_Tree::TYPE_ATTRIBUTE);
- $this->_treeModel = Mage::getModel(
- 'Mage_Api2_Model_Acl_Global_Rule_Tree',
- array('options' => $options)
- );
-
- /** @var $permissions Mage_Api2_Model_Acl_Filter_Attribute_ResourcePermission */
- $permissions = Mage::getModel('Mage_Api2_Model_Acl_Filter_Attribute_ResourcePermission');
- $permissions->setFilterValue($this->getRequest()->getParam('type'));
- $this->_treeModel->setResourcesPermissions($permissions->getResourcesPermissions())
- ->setHasEntityOnlyAttributes($permissions->getHasEntityOnlyAttributes());
- }
-
- /**
- * Get Json Representation of Resource Tree
- *
- * @return string
- */
- public function getResTreeJson()
- {
- /** @var $helper Mage_Core_Helper_Data */
- $helper = Mage::helper('Mage_Core_Helper_Data');
- return $helper->jsonEncode($this->_treeModel->getTreeResources());
- }
-
- /**
- * Check if everything is allowed
- *
- * @return boolean
- */
- public function getEverythingAllowed()
- {
- return $this->_treeModel->getEverythingAllowed();
- }
-
- /**
- * Check if tree has entity only attributes
- *
- * @return bool
- */
- public function hasEntityOnlyAttributes()
- {
- return $this->_treeModel->getHasEntityOnlyAttributes();
- }
-
- /**
- * Get tab label
- *
- * @return string
- */
- public function getTabLabel()
- {
- return $this->__('ACL Attribute Rules');
- }
-
- /**
- * Get tab title
- *
- * @return string
- */
- public function getTabTitle()
- {
- return $this->getTabLabel();
- }
-
- /**
- * Whether tab is available
- *
- * @return bool
- */
- public function canShowTab()
- {
- return true;
- }
-
- /**
- * Whether tab is hidden
- *
- * @return bool
- */
- public function isHidden()
- {
- return false;
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Tabs.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Tabs.php
deleted file mode 100644
index bde404b..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Tabs.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block tabs for attributes edit page
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Attribute_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
-{
- /**
- * Constructor
- */
- public function _construct()
- {
- parent::_construct();
-
- $this->setId('api2_attribute_section_main')
- ->setDestElementId('edit_form')
- ->setData('title', $this->__('ACL Attributes Information'));
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Permissions/User/Edit/Tab/Roles.php b/app/code/core/Mage/Api2/Block/Adminhtml/Permissions/User/Edit/Tab/Roles.php
deleted file mode 100644
index ef85a97..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Permissions/User/Edit/Tab/Roles.php
+++ /dev/null
@@ -1,203 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API2 role list for admin user permissions
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Permissions_User_Edit_Tab_Roles
- extends Mage_Adminhtml_Block_Widget_Grid
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
-{
- /**
- * Selected API2 roles for grid
- *
- * @var array
- */
- protected $_selectedRoles;
-
- /**
- * Constructor
- * Prepare grid parameters
- */
- public function _construct()
- {
- parent::_construct();
-
- $this->setId('api2_roles_section')
- ->setDefaultSort('sort_order')
- ->setDefaultDir(Varien_Db_Select::SQL_ASC)
- ->setTitle($this->__('REST Roles Information'))
- ->setUseAjax(true);
- }
-
- /**
- * Prepare grid collection object
- *
- * @return Mage_Api2_Block_Adminhtml_Permissions_User_Edit_Tab_Roles
- */
- protected function _prepareCollection()
- {
- /** @var $collection Mage_Api2_Model_Resource_Acl_Global_Role_Collection */
- $collection = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Global_Role_Collection');
- $collection->addFieldToFilter('entity_id', array('nin' => Mage_Api2_Model_Acl_Global_Role::getSystemRoles()));
-
- $this->setCollection($collection);
-
- return parent::_prepareCollection();
- }
-
- /**
- * Prepare grid columns
- *
- * @return Mage_Api2_Block_Adminhtml_Permissions_User_Edit_Tab_Roles
- */
- protected function _prepareColumns()
- {
- $this->addColumn('assigned_user_role', array(
- 'header_css_class' => 'a-center',
- 'header' => $this->__('Assigned'),
- 'type' => 'radio',
- 'html_name' => 'api2_roles[]',
- 'values' => $this->_getSelectedRoles(),
- 'align' => 'center',
- 'index' => 'entity_id'
- ));
-
- $this->addColumn('role_name', array(
- 'header' => $this->__('Role Name'),
- 'index' => 'role_name'
- ));
-
- return parent::_prepareColumns();
- }
-
- /**
- * Add custom column filter to collection
- *
- * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
- * @return Mage_Api2_Block_Adminhtml_Permissions_User_Edit_Tab_Roles
- */
- protected function _addColumnFilterToCollection($column)
- {
- if ($column->getId() == 'assigned_user_role') {
- $userRoles = $this->_getSelectedRoles();
- if ($column->getFilter()->getValue()) {
- $this->getCollection()->addFieldToFilter('entity_id', array('in' => $userRoles));
- } elseif (!empty($userRoles)) {
- $this->getCollection()->addFieldToFilter('entity_id', array('nin' => $userRoles));
- } else {
- $this->getCollection();
- }
- } else {
- parent::_addColumnFilterToCollection($column);
- }
-
- return $this;
- }
-
- /**
- * Get selected API2 roles for grid
- *
- * @return array
- */
- protected function _getSelectedRoles()
- {
- if (null === $this->_selectedRoles) {
- $userRoles = array();
-
- /* @var $user Mage_User_Model_User */
- $user = Mage::registry('permissions_user');
- if ($user->getId()) {
- /** @var $collection Mage_Api2_Model_Resource_Acl_Global_Role_Collection */
- $collection = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Global_Role_Collection');
- $collection->addFilterByAdminId($user->getId());
-
- $userRoles = $collection->getAllIds();
- }
-
- $this->_selectedRoles = $userRoles;
- }
-
- return $this->_selectedRoles;
- }
-
- /**
- * Prepare label for tab
- *
- * @return string
- */
- public function getTabLabel()
- {
- return $this->__('REST Role');
- }
-
- /**
- * Prepare title for tab
- *
- * @return string
- */
- public function getTabTitle()
- {
- return $this->__('REST Role');
- }
-
- /**
- * Returns status flag about this tab can be shown or not
- *
- * @return true
- */
- public function canShowTab()
- {
- return true;
- }
-
- /**
- * Returns status flag about this tab hidden or not
- *
- * @return true
- */
- public function isHidden()
- {
- return false;
- }
-
- /**
- * Get controller action url for grid ajax actions
- *
- * @return string
- */
- public function getGridUrl()
- {
- return $this->getUrl(
- '*/api2_role/rolesGrid',
- array('user_id' => Mage::registry('permissions_user')->getUserId())
- );
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php
deleted file mode 100644
index 6898577..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Roles grid container block
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Roles extends Mage_Adminhtml_Block_Widget_Grid_Container
-{
- /**
- * Construct grid container
- */
- public function _construct()
- {
- parent::_construct();
-
- $this->_blockGroup = 'Mage_Api2';
- $this->_controller = 'adminhtml_roles';
- $this->_headerText = Mage::helper('Mage_Adminhtml_Helper_Data')->__('REST Roles');
-
- //check allow edit
- if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Api2::rest_roles_add')) {
- $this->_updateButton('add', 'label', $this->__('Add Admin Role'));
- } else {
- $this->_removeButton('add');
- }
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php
deleted file mode 100644
index 925c9ce..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block for rendering buttons
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Block_Adminhtml_Roles_Buttons setRole(Mage_Api2_Model_Acl_Global_Role $role)
- * @method Mage_Api2_Model_Acl_Global_Role getRole()
- */
-class Mage_Api2_Block_Adminhtml_Roles_Buttons extends Mage_Adminhtml_Block_Template
-{
- /**
- * Construct
- */
- public function _construct()
- {
- parent::_construct();
- $this->setTemplate('role/buttons.phtml');
- }
-
- /**
- * Preparing global layout
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Buttons
- */
- protected function _prepareLayout()
- {
- $buttons = array(
- 'backButton' => array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Back'),
- 'onclick' => sprintf("window.location.href='%s';", $this->getUrl('*/*/')),
- 'class' => 'back'
- ),
- 'resetButton' => array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Reset'),
- 'onclick' => 'window.location.reload()'
- ),
- 'saveButton' => array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Save Role'),
- 'class' => 'save',
- 'data_attr' => array(
- 'widget-button' => array('event' => 'save', 'related' => '#role-edit-form')
- )
- ),
- 'deleteButton' => array(
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Delete Role'),
- 'onclick' => '', //roleId is not set at this moment, so we set script later
- 'class' => 'delete'
- ),
- );
-
- foreach ($buttons as $name=>$data) {
- $button = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Widget_Button')->setData($data);
- $this->setChild($name, $button);
- }
-
- return parent::_prepareLayout();
- }
-
- /**
- * Get back button HTML
- *
- * @return string
- */
- public function getBackButtonHtml()
- {
- return $this->getChildHtml('backButton');
- }
-
- /**
- * Get reset button HTML
- *
- * @return string
- */
- public function getResetButtonHtml()
- {
- return $this->getChildHtml('resetButton');
- }
-
- /**
- * Get save button HTML
- *
- * @return string
- */
- public function getSaveButtonHtml()
- {
- return $this->getChildHtml('saveButton');
- }
-
- /**
- * Get delete button HTML
- *
- * @return string
- */
- public function getDeleteButtonHtml()
- {
- if(!$this->getRole() || !$this->getRole()->getId()
- || Mage_Api2_Model_Acl_Global_Role::isSystemRole($this->getRole())) {
-
- return '';
- }
-
- $this->getChildBlock('deleteButton')->setData('onclick', sprintf("deleteConfirm('%s', '%s')",
- Mage::helper('Mage_Adminhtml_Helper_Data')->__('Are you sure you want to do this?'),
- $this->getUrl('*/*/delete', array('id' => $this->getRole()->getId()))
- ));
-
- return $this->getChildHtml('deleteButton');
- }
-
- /**
- * Get block caption
- *
- * @return string
- */
- public function getCaption()
- {
- return $this->getRole() && $this->getRole()->getId()
- ? ($this->__('Edit Role') . " '{$this->escapeHtml($this->getRole()->getRoleName())}'")
- : $this->__('Add New Role');
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php
deleted file mode 100644
index a1048ed..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Roles grid block
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Block_Adminhtml_Roles_Grid extends Mage_Adminhtml_Block_Widget_Grid
-{
- /**
- * Construct grid block
- */
- public function _construct()
- {
- parent::_construct();
- $this->setId('rolesGrid');
- $this->setUseAjax(true);
- $this->setSaveParametersInSession(true);
- $this->setDefaultSort('entity_id')
- ->setDefaultDir(Varien_Db_Select::SQL_DESC);
- }
-
- /**
- * Prepare collection
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Grid
- */
- protected function _prepareCollection()
- {
- /** @var $collection Mage_Api2_Model_Resource_Acl_Global_Role_Collection */
- $collection = Mage::getModel('Mage_Api2_Model_Acl_Global_Role')->getCollection();
- $this->setCollection($collection);
- parent::_prepareCollection();
- return $this;
- }
-
- /**
- * Prepare columns
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Grid
- */
- protected function _prepareColumns()
- {
- $this->addColumn('entity_id', array(
- 'header' => Mage::helper('Mage_Oauth_Helper_Data')->__('ID'),
- 'index' => 'entity_id',
- 'align' => 'right',
- 'width' => '50px',
- ));
-
- $this->addColumn('role_name', array(
- 'header' => Mage::helper('Mage_Oauth_Helper_Data')->__('Role Name'),
- 'index' => 'role_name',
- 'escape' => true,
- ));
-
- $this->addColumn('tole_user_type', array(
- 'header' => Mage::helper('Mage_Oauth_Helper_Data')->__('User Type'),
- 'sortable' => false,
- 'frame_callback' => array($this, 'decorateUserType')
- ));
-
- $this->addColumn('created_at', array(
- 'header' => Mage::helper('Mage_Oauth_Helper_Data')->__('Created At'),
- 'index' => 'created_at'
- ));
-
- parent::_prepareColumns();
- return $this;
- }
-
- /**
- * Get grid URL
- *
- * @return string
- */
- public function getGridUrl()
- {
- return $this->getUrl('*/*/grid', array('_current' => true));
- }
-
- /**
- * Get row URL
- *
- * @param Mage_Api2_Model_Acl_Global_Role $row
- * @return string|null
- */
- public function getRowUrl($row)
- {
- if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Api2::rest_roles_edit')) {
- return $this->getUrl('*/*/edit', array('id' => $row->getId()));
- }
- return null;
- }
-
- /**
- * Decorate 'User Type' column
- *
- * @param string $renderedValue Rendered value
- * @param Mage_Api2_Model_Acl_Global_Role $row
- * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
- * @param bool $isExport
- * @return string
- */
- public function decorateUserType($renderedValue, $row, $column, $isExport)
- {
- switch ($row->getEntityId()) {
- case Mage_Api2_Model_Acl_Global_Role::ROLE_GUEST_ID:
- $userType = Mage::helper('Mage_Api2_Helper_Data')->__('Guest');
- break;
- case Mage_Api2_Model_Acl_Global_Role::ROLE_CUSTOMER_ID:
- $userType = Mage::helper('Mage_Api2_Helper_Data')->__('Customer');
- break;
- default:
- $userType = Mage::helper('Mage_Api2_Helper_Data')->__('Admin');
- break;
- }
- return $userType;
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Info.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Info.php
deleted file mode 100644
index a42158b..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Info.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-
-/**
- * Block for rendering role info tab
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Model_Acl_Global_Role getRole()
- * @method Mage_Api2_Block_Adminhtml_Roles_Tab_Info setRole(Mage_Api2_Model_Acl_Global_Role $role)
- */
-class Mage_Api2_Block_Adminhtml_Roles_Tab_Info extends Mage_Adminhtml_Block_Widget_Form
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
-{
- /**
- * Prepare form object
- */
- protected function _prepareForm()
- {
- $form = new Varien_Data_Form();
-
- $fieldset = $form->addFieldset('base_fieldset', array(
- 'legend' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Information')
- ));
-
- $data = array(
- 'name' => 'role_name',
- 'label' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Role Name'),
- 'id' => 'role_name',
- 'class' => 'required-entry',
- 'required' => true,
- );
-
- if ($this->isHidden()) {
- /** @var $helper Mage_Core_Helper_Data */
- $helper = Mage::helper('Mage_Core_Helper_Data');
-
- $data['note'] = Mage::helper('Mage_Api2_Helper_Data')->__(
- '%s role is protected.',
- $helper->escapeHtml($this->getRole()->getRoleName())
- );
- $data['readonly'] = 'readonly';
- }
- $fieldset->addField('role_name', 'text', $data);
-
- $fieldset->addField('entity_id', 'hidden',
- array(
- 'name' => 'id',
- )
- );
-
- $fieldset->addField('in_role_users', 'hidden',
- array(
- 'name' => 'in_role_users',
- 'id' => 'in_role_userz',
- )
- );
-
- $fieldset->addField('in_role_users_old', 'hidden', array('name' => 'in_role_users_old'));
-
- if ($this->getRole()) {
- $form->setValues($this->getRole()->getData());
- }
- $this->setForm($form);
- }
-
- /**
- * Get tab label
- *
- * @return string
- */
- public function getTabLabel()
- {
- return Mage::helper('Mage_Api2_Helper_Data')->__('Role Info');
- }
-
- /**
- * Get tab title
- *
- * @return string
- */
- public function getTabTitle()
- {
- return $this->getTabLabel();
- }
-
- /**
- * Whether tab is available
- *
- * @return bool
- */
- public function canShowTab()
- {
- return true;
- }
-
- /**
- * Whether tab is hidden
- *
- * @return bool
- */
- public function isHidden()
- {
- return $this->getRole() && Mage_Api2_Model_Acl_Global_Role::isSystemRole($this->getRole());
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Resources.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Resources.php
deleted file mode 100644
index 0988b22..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Resources.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block for rendering resources list tab
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Model_Acl_Global_Role getRole()
- * @method Mage_Api2_Block_Adminhtml_Roles_Tab_Resources setRole(Mage_Api2_Model_Acl_Global_Role $role)
- */
-class Mage_Api2_Block_Adminhtml_Roles_Tab_Resources extends Mage_Adminhtml_Block_Widget_Form
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
-{
- /**
- * Role model
- *
- * @var Mage_Api2_Model_Acl_Global_Role
- */
- protected $_role;
-
- /**
- * Tree model
- *
- * @var Mage_Api2_Model_Acl_Global_Rule_Tree
- */
- protected $_treeModel = false;
-
- /**
- * Constructor
- */
- public function _construct()
- {
- parent::_construct();
-
- $this->setId('api2_role_section_resources')
- ->setData('default_dir', Varien_Db_Select::SQL_ASC)
- ->setData('default_sort', 'sort_order')
- ->setData('title', Mage::helper('Mage_Api2_Helper_Data')->__('Api Rules Information'))
- ->setData('use_ajax', true);
-
- $options = array('type' => Mage_Api2_Model_Acl_Global_Rule_Tree::TYPE_PRIVILEGE);
- $this->_treeModel = Mage::getModel(
- 'Mage_Api2_Model_Acl_Global_Rule_Tree', array('options' => $options)
- );
- }
-
- /**
- * Get Json Representation of Resource Tree
- *
- * @return string
- */
- public function getResTreeJson()
- {
- $this->_prepareTreeModel();
- /** @var $helper Mage_Core_Helper_Data */
- $helper = Mage::helper('Mage_Core_Helper_Data');
- return $helper->jsonEncode($this->_treeModel->getTreeResources());
- }
-
- /**
- * Prepare tree model
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Tab_Resources
- */
- public function _prepareTreeModel()
- {
- $role = $this->getRole();
- if ($role) {
- $permissionModel = $role->getPermissionModel();
- $permissionModel->setFilterValue($role);
- $this->_treeModel->setResourcesPermissions($permissionModel->getResourcesPermissions());
- } else {
- $role = Mage::getModel('Mage_Api2_Model_Acl_Global_Role');
- }
- $this->_treeModel->setRole($role);
- return $this;
- }
-
- /**
- * Check if everything is allowed
- *
- * @return boolean
- */
- public function getEverythingAllowed()
- {
- $this->_prepareTreeModel();
- return $this->_treeModel->getEverythingAllowed();
- }
-
- /**
- * Get tab label
- *
- * @return string
- */
- public function getTabLabel()
- {
- return Mage::helper('Mage_Api2_Helper_Data')->__('Role API Resources');
- }
-
- /**
- * Get tab title
- *
- * @return string
- */
- public function getTabTitle()
- {
- return $this->getTabLabel();
- }
-
- /**
- * Whether tab is available
- *
- * @return bool
- */
- public function canShowTab()
- {
- return true;
- }
-
- /**
- * Whether tab is hidden
- *
- * @return bool
- */
- public function isHidden()
- {
- return false;
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Users.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Users.php
deleted file mode 100644
index 28e3975..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Users.php
+++ /dev/null
@@ -1,239 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block for rendering users list tab
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Model_Acl_Global_Role getRole()
- * @method Mage_Api2_Block_Adminhtml_Roles_Tab_Users setRole(Mage_Api2_Model_Acl_Global_Role $role)
- * @method Mage_Api2_Block_Adminhtml_Roles_Tab_Users setUsers(array $users)
- * @method Mage_User_Model_Resource_User_Collection getCollection()
- */
-class Mage_Api2_Block_Adminhtml_Roles_Tab_Users extends Mage_Adminhtml_Block_Widget_Grid
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
-{
- /**
- * Construct grid block
- */
- public function _construct()
- {
- parent::_construct();
- $this->setId('roleUsersGrid');
- $this->setData('use_ajax', true);
- $this->setSaveParametersInSession(true);
- $this->setDefaultSort('user_id')
- ->setDefaultDir(Varien_Db_Select::SQL_DESC);
- $this->setDefaultFilter(array('filter_in_role_users'=>1));
- }
-
- /**
- * Prepare collection
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Tab_Users
- */
- protected function _prepareCollection()
- {
- /** @var $collection Mage_User_Model_Resource_User_Collection */
- $collection = Mage::getModel('Mage_User_Model_User')->getCollection();
- $collection->getSelect()->joinLeft(
- array('acl' => $collection->getTable('api2_acl_user')),
- 'acl.admin_id = main_table.user_id',
- 'role_id'
- );
- if ($this->getRole() && $this->getRole()->getId()) {
- $collection->addFilter('acl.role_id', $this->getRole()->getId());
- }
-
- $this->setCollection($collection);
- parent::_prepareCollection();
- return $this;
- }
-
- /**
- * Prepare columns
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Tab_Users
- */
- protected function _prepareColumns()
- {
- $this->addColumn('filter_in_role_users', array(
- 'header_css_class' => 'a-center',
- 'type' => 'checkbox',
- 'name' => 'filter_in_role_users',
- 'values' => $this->getUsers(),
- 'align' => 'center',
- 'index' => 'user_id'
- ));
-
- $this->addColumn('user_id', array(
- 'header' => Mage::helper('Mage_Api2_Helper_Data')->__('ID'), 'index' => 'user_id', 'align' => 'right', 'width' => '50px',
- ));
-
- $this->addColumn('username', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('User Name'), 'align' => 'left', 'index' => 'username'
- ));
-
- $this->addColumn('firstname', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('First Name'), 'align' => 'left', 'index' => 'firstname'
- ));
-
- $this->addColumn('lastname', array(
- 'header' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Last Name'), 'align' => 'left', 'index' => 'lastname'
- ));
-
- return parent::_prepareColumns();
- }
-
- /**
- * Get grid URL
- *
- * @return string
- */
- public function getGridUrl()
- {
- return $this->getUrl('*/*/usersGrid', array('_current' => true));
- }
-
- /**
- * Get row URL
- *
- * @param Mage_Api2_Model_Acl_Global_Role $row
- * @return string|null
- */
- public function getRowUrl($row)
- {
- return null;
- }
-
- /**
- * Get tab label
- *
- * @return string
- */
- public function getTabLabel()
- {
- return Mage::helper('Mage_Api2_Helper_Data')->__('Role Users');
- }
-
- /**
- * Get tab title
- *
- * @return string
- */
- public function getTabTitle()
- {
- return $this->getTabLabel();
- }
-
- /**
- * Whether tab is available
- *
- * @return bool
- */
- public function canShowTab()
- {
- return !$this->isHidden();
- }
-
- /**
- * Whether tab is hidden
- *
- * @return bool
- */
- public function isHidden()
- {
- return $this->getRole() && Mage_Api2_Model_Acl_Global_Role::isSystemRole($this->getRole());
- }
-
- /**
- * Render block only when not hidden
- *
- * @return string
- */
- public function _toHtml()
- {
- if (!$this->isHidden()) {
- return parent::_toHtml();
- }
- return '';
- }
-
- /**
- * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
- * @return Mage_Api2_Block_Adminhtml_Roles_Tab_Users
- */
- protected function _addColumnFilterToCollection($column)
- {
- if ($column->getId() == 'filter_in_role_users') {
- $inRoleIds = $this->getUsers();
- if (empty($inRoleIds)) {
- $inRoleIds = 0;
- }
-
- if ($column->getFilter()->getValue()) {
- $this->getCollection()->addFieldToFilter('user_id', array('in' => $inRoleIds));
- } else {
- if($inRoleIds) {
- $this->getCollection()->addFieldToFilter('user_id', array('nin' => $inRoleIds));
- }
- }
- } else {
- parent::_addColumnFilterToCollection($column);
- }
- return $this;
- }
-
- /**
- * Get users
- *
- * @param bool $json
- * @return array|string
- */
- public function getUsers($json = false)
- {
- $users = $this->getData('users');
-
- if ($json) {
- if ($users === array()) {
- return '{}';
- }
- $jsonUsers = array();
- foreach($users as $usrId) {
- $jsonUsers[$usrId] = 0;
- }
- /** @var $helper Mage_Core_Helper_Data */
- $helper = Mage::helper('Mage_Core_Helper_Data');
- $result = $helper->jsonEncode((object) $jsonUsers);
- } else {
- $result = array_values($users);
- }
-
- return $result;
- }
-}
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tabs.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tabs.php
deleted file mode 100644
index be27d91..0000000
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tabs.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Block tabs for role edit page
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Block_Adminhtml_Roles_Tabs setRole(Mage_Api2_Model_Acl_Global_Role $role)
- * @method Mage_Api2_Model_Acl_Global_Role getRole()
- */
-class Mage_Api2_Block_Adminhtml_Roles_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
-{
-
- /**
- * Constructor
- */
- public function _construct()
- {
- parent::_construct();
- $this->setId('role_info_tabs');
- $this->setDestElementId('role-edit-form');
- $this->setData('title', Mage::helper('Mage_Api2_Helper_Data')->__('Role Information'));
- }
-
- /**
- * Hook before html rendering
- *
- * @return Mage_Api2_Block_Adminhtml_Roles_Tabs
- */
- protected function _beforeToHtml()
- {
- $role = $this->getRole();
- if ($role && Mage_Api2_Model_Acl_Global_Role::isSystemRole($role)) {
- $this->setActiveTab('api2_role_section_resources');
- } else {
- $this->setActiveTab('api2_role_section_info');
- }
- return parent::_beforeToHtml();
- }
-}
diff --git a/app/code/core/Mage/Api2/Exception.php b/app/code/core/Mage/Api2/Exception.php
deleted file mode 100644
index 9de45b2..0000000
--- a/app/code/core/Mage/Api2/Exception.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API exception
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Exception extends Exception
-{
- /**
- * Exception constructor
- *
- * @param string $message
- * @param int $code
- */
- public function __construct($message, $code)
- {
- if ($code <= 100 || $code >= 599) {
- throw new Exception(sprintf('Invalid Exception code "%d"', $code));
- }
-
- parent::__construct($message, $code);
- }
-}
diff --git a/app/code/core/Mage/Api2/Helper/Data.php b/app/code/core/Mage/Api2/Helper/Data.php
deleted file mode 100644
index 40a623e..0000000
--- a/app/code/core/Mage/Api2/Helper/Data.php
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Webservice API2 data helper
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Helper_Data extends Mage_Core_Helper_Abstract
-{
- /**
- * Request interpret adapters
- */
- const XML_PATH_API2_REQUEST_INTERPRETERS = 'global/api2/request/interpreters';
-
- /**
- * Response render adapters
- */
- const XML_PATH_API2_RESPONSE_RENDERS = 'global/api2/response/renders';
-
- /**#@+
- * Config paths
- */
- const XML_PATH_AUTH_ADAPTERS = 'global/api2/auth_adapters';
- const XML_PATH_USER_TYPES = 'global/api2/user_types';
- /**#@- */
-
- /**
- * Compare order to be used in adapters list sort
- *
- * @param int $a
- * @param int $b
- * @return int
- */
- protected static function _compareOrder($a, $b)
- {
- if ($a['order'] == $b['order']) {
- return 0;
- }
- return ($a['order'] < $b['order']) ? -1 : 1;
- }
-
- /**
- * Retrieve Auth adapters info from configuration file as array
- *
- * @param bool $enabledOnly
- * @return array
- */
- public function getAuthAdapters($enabledOnly = false)
- {
- $adapters = Mage::getConfig()->getNode(self::XML_PATH_AUTH_ADAPTERS);
-
- if (!$adapters) {
- return array();
- }
- $adapters = $adapters->asArray();
-
- if ($enabledOnly) {
- foreach ($adapters as $adapter) {
- if (empty($adapter['enabled'])) {
- unset($adapters);
- }
- }
- $adapters = (array) $adapters;
- }
- uasort($adapters, array('Mage_Api2_Helper_Data', '_compareOrder'));
-
- return $adapters;
- }
-
- /**
- * Retrieve enabled user types in form of user type => user model pairs
- *
- * @return array
- */
- public function getUserTypes()
- {
- $userModels = array();
- $types = Mage::getConfig()->getNode(self::XML_PATH_USER_TYPES);
-
- if ($types) {
- foreach ($types->asArray() as $type => $params) {
- if (!empty($params['allowed'])) {
- $userModels[$type] = $params['model'];
- }
- }
- }
- return $userModels;
- }
-
- /**
- * Get interpreter type for Request body according to Content-type HTTP header
- *
- * @return array
- */
- public function getRequestInterpreterAdapters()
- {
- return (array) Mage::app()->getConfig()->getNode(self::XML_PATH_API2_REQUEST_INTERPRETERS);
- }
-
- /**
- * Get interpreter type for Request body according to Content-type HTTP header
- *
- * @return array
- */
- public function getResponseRenderAdapters()
- {
- return (array) Mage::app()->getConfig()->getNode(self::XML_PATH_API2_RESPONSE_RENDERS);
- }
-
- /**
- * Check API type support
- *
- * @param string $type
- * @return bool
- */
- public function isApiTypeSupported($type)
- {
- return in_array($type, Mage_Api2_Model_Server::getApiTypes());
- }
-
- /**
- * Get allowed attributes of a rule
- *
- * @param string $userType
- * @param string $resourceId
- * @param string $operation One of Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_... constant
- * @return array
- */
- public function getAllowedAttributes($userType, $resourceId, $operation)
- {
- /** @var $resource Mage_Api2_Model_Resource_Acl_Filter_Attribute */
- $resource = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Filter_Attribute');
-
- $attributes = $resource->getAllowedAttributes($userType, $resourceId, $operation);
-
- return ($attributes === false || $attributes === null ? array() : explode(',', $attributes));
- }
-
- /**
- * Check if ALL attributes are allowed
- *
- * @param string $userType
- * @return bool
- */
- public function isAllAttributesAllowed($userType)
- {
- /** @var $resource Mage_Api2_Model_Resource_Acl_Filter_Attribute */
- $resource = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Filter_Attribute');
-
- return $resource->isAllAttributesAllowed($userType);
- }
-
- /**
- * Get operation type for specified operation
- *
- * @param string $operation One of Mage_Api2_Model_Resource::OPERATION_... constant
- * @return string One of Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_... constant
- * @throws Exception
- */
- public function getTypeOfOperation($operation)
- {
- if (Mage_Api2_Model_Resource::OPERATION_RETRIEVE === $operation) {
- return Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_READ;
- } elseif (Mage_Api2_Model_Resource::OPERATION_CREATE === $operation) {
- return Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_WRITE;
- } elseif (Mage_Api2_Model_Resource::OPERATION_UPDATE === $operation) {
- return Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_WRITE;
- } else {
- throw new Exception('Can not determine operation type');
- }
- }
-}
diff --git a/app/code/core/Mage/Api2/Model/Acl.php b/app/code/core/Mage/Api2/Model/Acl.php
deleted file mode 100644
index eb3f1a3..0000000
--- a/app/code/core/Mage/Api2/Model/Acl.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API User ACL model
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Model_Acl extends Zend_Acl
-{
- /**
- * REST ACL roles collection
- *
- * @var Mage_Api2_Model_Resource_Acl_Global_Role_Collection
- */
- protected $_rolesCollection;
-
- /**
- * API2 config model instance
- *
- * @var Mage_Api2_Model_Config
- */
- protected $_config;
-
- /**
- * Resource type of request
- *
- * @var string
- */
- protected $_resourceType;
-
- /**
- * Operation of request
- *
- * @var string
- */
- protected $_operation;
-
- /**
- * Constructor
- *
- * @param array $options
- */
- public function __construct($options)
- {
- if (!isset($options['resource_type']) || empty($options['resource_type'])) {
- throw new Exception("Passed parameter 'resource_type' is wrong.");
- }
- if (!isset($options['operation']) || empty($options['operation'])) {
- throw new Exception("Passed parameter 'operation' is wrong.");
- }
- $this->_resourceType = $options['resource_type'];
- $this->_operation = $options['operation'];
-
- $this->_setResources();
- $this->_setRoles();
- $this->_setRules();
- }
-
- /**
- * Retrieve REST ACL roles collection
- *
- * @return Mage_Api2_Model_Resource_Acl_Global_Role_Collection
- */
- protected function _getRolesCollection()
- {
- if (null === $this->_rolesCollection) {
- $this->_rolesCollection = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Global_Role_Collection');
- }
- return $this->_rolesCollection;
- }
-
- /**
- * Retrieve API2 config model instance
- *
- * @return Mage_Api2_Model_Config
- */
- protected function _getConfig()
- {
- if (null === $this->_config) {
- $this->_config = Mage::getModel('Mage_Api2_Model_Config');
- }
- return $this->_config;
- }
-
- /**
- * Retrieve resources types and set into ACL
- *
- * @return Mage_Api2_Model_Acl
- */
- protected function _setResources()
- {
- foreach ($this->_getConfig()->getResourcesTypes() as $type) {
- $this->addResource($type);
- }
- return $this;
- }
-
- /**
- * Retrieve roles from DB and set into ACL
- *
- * @return Mage_Api2_Model_Acl
- */
- protected function _setRoles()
- {
- /** @var $role Mage_Api2_Model_Acl_Global_Role */
- foreach ($this->_getRolesCollection() as $role) {
- $this->addRole($role->getId());
- }
- return $this;
- }
-
- /**
- * Retrieve rules data from DB and inject it into ACL
- *
- * @return Mage_Api2_Model_Acl
- */
- protected function _setRules()
- {
- /** @var $rulesCollection Mage_Api2_Model_Resource_Acl_Global_Rule_Collection */
- $rulesCollection = Mage::getResourceModel('Mage_Api2_Model_Resource_Acl_Global_Rule_Collection');
-
- /** @var $rule Mage_Api2_Model_Acl_Global_Rule */
- foreach ($rulesCollection as $rule) {
- if (Mage_Api2_Model_Acl_Global_Rule::RESOURCE_ALL === $rule->getResourceId()) {
- if (in_array($rule->getRoleId(), Mage_Api2_Model_Acl_Global_Role::getSystemRoles())) {
- /** @var $role Mage_Api2_Model_Acl_Global_Role */
- $role = $this->_getRolesCollection()->getItemById($rule->getRoleId());
- $privileges = $this->_getConfig()->getResourceUserPrivileges(
- $this->_resourceType,
- $role->getConfigNodeName()
- );
-
- if (!array_key_exists($this->_operation, $privileges)) {
- continue;
- }
- }
-
- $this->allow($rule->getRoleId());
- } else {
- $this->allow($rule->getRoleId(), $rule->getResourceId(), $rule->getPrivilege());
- }
- }
- return $this;
- }
-
- /**
- * Adds a Role having an identifier unique to the registry
- * OVERRIDE to allow numeric roles identifiers
- *
- * @param int $roleId Role identifier
- * @param Zend_Acl_Role_Interface|string|array $parents
- * @return Zend_Acl Provides a fluent interface
- */
- public function addRole($roleId, $parents = null)
- {
- if (!is_numeric($roleId)) {
- throw new Exception('Invalid role identifier');
- }
- return parent::addRole((string) $roleId);
- }
-}
diff --git a/app/code/core/Mage/Api2/Model/Acl/Filter.php b/app/code/core/Mage/Api2/Model/Acl/Filter.php
deleted file mode 100644
index 50d5f04..0000000
--- a/app/code/core/Mage/Api2/Model/Acl/Filter.php
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API ACL filter
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Api2_Model_Acl_Filter
-{
- /**
- * Attributes allowed for use
- *
- * @var array
- */
- protected $_allowedAttributes;
-
- /**
- * A list of attributes to be included into output
- *
- * @var array
- */
- protected $_attributesToInclude;
-
- /**
- * Associated resource model
- *
- * @var Mage_Api2_Model_Resource
- */
- protected $_resource;
-
- /**
- * Object constructor
- *
- * @param Mage_Api2_Model_Resource $resource
- */
- public function __construct(Mage_Api2_Model_Resource $resource)
- {
- $this->_resource = $resource;
- }
-
- /**
- * Return only the data which keys are allowed
- *
- * @param array $allowedAttributes List of attributes available to use
- * @param array $data Associative array attribute to value
- * @return array
- */
- protected function _filter(array $allowedAttributes, array $data)
- {
- foreach ($data as $attribute => $value) {
- if (!in_array($attribute, $allowedAttributes)) {
- unset($data[$attribute]);
- }
- }
- return $data;
- }
-
- /**
- * Strip attributes in of collection items
- *
- * @param array $items
- * @return array
- */
- public function collectionIn($items)
- {
- foreach ($items as &$data) {
- $data = is_array($data) ? $this->in($data) : array();
- }
- return $items;
- }
-
- /**
- * Strip attributes out of collection items
- *
- * @param array $items
- * @return array
- */
- public function collectionOut($items)
- {
- foreach ($items as &$data) {
- $data = $this->out($data);
- }
- return $items;
- }
-
- /**
- * 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('Mage_Api2_Helper_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;
- }
-
- /**
- * Retrieve a list of attributes to be included in output based on available and requested attributes
- *
- * @return array
- */
- public function getAttributesToInclude()
- {
- if (null === $this->_attributesToInclude) {
- $allowedAttrs = $this->getAllowedAttributes(Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_READ);
- $requestedAttrs = $this->_resource->getRequest()->getRequestedAttributes();
-
- if ($requestedAttrs) {
- foreach ($allowedAttrs as $allowedAttr) {
- if (in_array($allowedAttr, $requestedAttrs)) {
- $this->_attributesToInclude[] = $allowedAttr;
- }
- }
- } else {
- $this->_attributesToInclude = $allowedAttrs;
- }
- }
- return $this->_attributesToInclude;
- }
-
- /**
- * Filter data for write operations
- *
- * @param array $requestData
- * @return array
- */
- public function in(array $requestData)
- {
- $allowedAttributes = $this->getAllowedAttributes(Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_WRITE);
-
- return $this->_filter($allowedAttributes, $requestData);
- }
-
- /**
- * Filter data before output
- *
- * @param array $retrievedData
- * @return array
- */
- public function out(array $retrievedData)
- {
- return $this->_filter($this->getAttributesToInclude(), $retrievedData);
- }
-}
diff --git a/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute.php b/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute.php
deleted file mode 100644
index 9d63fb7..0000000
--- a/app/code/core/Mage/Api2/Model/Acl/Filter/Attribute.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Api2
- * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * API2 filter ACL attribute model
- *
- * @category Mage
- * @package Mage_Api2
- * @author Magento Core Team <core@magentocommerce.com>
- * @method Mage_Api2_Model_Resource_Acl_Filter_Attribute_Collection getCollection()
- * @method Mage_Api2_Model_Resource_Acl_Filter_Attribute_Collection getResourceCollection()
- * @method Mage_Api2_Model_Resource_Acl_Filter_Attribute getResource()
- * @method Mage_Api2_Model_Resource_Acl_Filter_Attribute _getResource()
- * @method string getUserType()
- * @method Mage_Api2_Model_Acl_Filter_Attribute setUserType() setUserType(string $type)
- * @method string getResourceId()
- * @method Mage_Api2_Model_Acl_Filter_Attribute setResourceId() setResourceId(string $resource)
- * @method string getOperation()
- * @method Mage_Api2_Model_Acl_Filter_Attribute setOperation() setOperation(string $operation)
- * @method string getAllowedAttributes()
- * @method Mage_Api2_Model_Acl_Filter_Attribute setAllowedAttributes() setAllowedAttributes(string $attributes)
- */
-class Mage_Api2_Model_Acl_Filter_Attribute extends Mage_Core_Model_Abstract
-{
- /**
- * Permissions model
- *
- * @var Mage_Api2_Model_Acl_Filter_Attribute_ResourcePermission
- */
- protected $_permissionModel;
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('Mage_Api2_Model_Resource_Acl_Filter_Attribute');
- }
-
- /**
- * Get pairs resources-permissions for current attribute
- *
- * @return Mage_Api2_Model_Acl_Filter_Attribute_ResourcePermission
- */
- pu