Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Api_Controller_Action
  • Mage_Api_Helper_Data
  • Mage_Api_IndexController
  • Mage_Api_Model_Acl
  • Mage_Api_Model_Acl_Assert_Ip
  • Mage_Api_Model_Acl_Assert_Time
  • Mage_Api_Model_Acl_Resource
  • Mage_Api_Model_Acl_Role
  • Mage_Api_Model_Acl_Role_Generic
  • Mage_Api_Model_Acl_Role_Group
  • Mage_Api_Model_Acl_Role_Registry
  • Mage_Api_Model_Acl_Role_User
  • Mage_Api_Model_Config
  • Mage_Api_Model_Mysql4_Acl
  • Mage_Api_Model_Mysql4_Acl_Role
  • Mage_Api_Model_Mysql4_Acl_Role_Collection
  • Mage_Api_Model_Mysql4_Permissions_Collection
  • Mage_Api_Model_Mysql4_Role
  • Mage_Api_Model_Mysql4_Role_Collection
  • Mage_Api_Model_Mysql4_Roles
  • Mage_Api_Model_Mysql4_Roles_Collection
  • Mage_Api_Model_Mysql4_Roles_User_Collection
  • Mage_Api_Model_Mysql4_Rules
  • Mage_Api_Model_Mysql4_Rules_Collection
  • Mage_Api_Model_Mysql4_User
  • Mage_Api_Model_Mysql4_User_Collection
  • Mage_Api_Model_Resource_Abstract
  • Mage_Api_Model_Resource_Acl
  • Mage_Api_Model_Resource_Acl_Role
  • Mage_Api_Model_Resource_Acl_Role_Collection
  • Mage_Api_Model_Resource_Permissions_Collection
  • Mage_Api_Model_Resource_Role
  • Mage_Api_Model_Resource_Role_Collection
  • Mage_Api_Model_Resource_Roles
  • Mage_Api_Model_Resource_Roles_Collection
  • Mage_Api_Model_Resource_Roles_User_Collection
  • Mage_Api_Model_Resource_Rules
  • Mage_Api_Model_Resource_Rules_Collection
  • Mage_Api_Model_Resource_User
  • Mage_Api_Model_Resource_User_Collection
  • Mage_Api_Model_Role
  • Mage_Api_Model_Roles
  • Mage_Api_Model_Rules
  • Mage_Api_Model_Server
  • Mage_Api_Model_Server_Adapter_Soap
  • Mage_Api_Model_Server_Adapter_Xmlrpc
  • Mage_Api_Model_Server_Handler
  • Mage_Api_Model_Server_Handler_Abstract
  • Mage_Api_Model_Server_V2_Adapter_Soap
  • Mage_Api_Model_Server_V2_Handler
  • Mage_Api_Model_Server_WSI_Adapter_Soap
  • Mage_Api_Model_Server_WSI_Handler
  • Mage_Api_Model_Session
  • Mage_Api_Model_User
  • Mage_Api_Model_Wsdl_Config
  • Mage_Api_Model_Wsdl_Config_Base
  • Mage_Api_SoapController
  • Mage_Api_V2_SoapController
  • Mage_Api_XmlrpcController

Interfaces

  • Mage_Api_Model_Server_Adapter_Interface

Exceptions

  • Mage_Api_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Api
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Enter description here ...
 29:  *
 30:  * @method Mage_Api_Model_Resource_Roles _getResource()
 31:  * @method Mage_Api_Model_Resource_Roles getResource()
 32:  * @method int getParentId()
 33:  * @method Mage_Api_Model_Roles setParentId(int $value)
 34:  * @method int getTreeLevel()
 35:  * @method Mage_Api_Model_Roles setTreeLevel(int $value)
 36:  * @method int getSortOrder()
 37:  * @method Mage_Api_Model_Roles setSortOrder(int $value)
 38:  * @method string getRoleType()
 39:  * @method Mage_Api_Model_Roles setRoleType(string $value)
 40:  * @method int getUserId()
 41:  * @method Mage_Api_Model_Roles setUserId(int $value)
 42:  * @method string getRoleName()
 43:  * @method Mage_Api_Model_Roles setRoleName(string $value)
 44:  * @method string getName()
 45:  * @method Mage_Api_Model_Role setName() setName(string $name)
 46:  *
 47:  * @category    Mage
 48:  * @package     Mage_Api
 49:  * @author      Magento Core Team <core@magentocommerce.com>
 50:  */
 51: class Mage_Api_Model_Roles extends Mage_Core_Model_Abstract
 52: {
 53:     /**
 54:      * Filters
 55:      *
 56:      * @var array
 57:      */
 58:     protected $_filters;
 59: 
 60: 
 61:     protected function _construct()
 62:     {
 63:         $this->_init('api/roles');
 64:     }
 65: 
 66:     public function update()
 67:     {
 68:         $this->getResource()->update($this);
 69:         return $this;
 70:     }
 71: 
 72:     public function getUsersCollection()
 73:     {
 74:         return Mage::getResourceModel('api/roles_user_collection');
 75:     }
 76: 
 77:     public function getResourcesTree()
 78:     {
 79:         return $this->_buildResourcesArray(null, null, null, null, true);
 80:     }
 81: 
 82:     public function getResourcesList()
 83:     {
 84:         return $this->_buildResourcesArray();
 85:     }
 86: 
 87:     public function getResourcesList2D()
 88:     {
 89:         return $this->_buildResourcesArray(null, null, null, true);
 90:     }
 91: 
 92:     public function getRoleUsers()
 93:     {
 94:         return $this->getResource()->getRoleUsers($this);
 95:     }
 96: 
 97:     protected function _buildResourcesArray(
 98:         Varien_Simplexml_Element $resource = null, $parentName = null, $level = 0, $represent2Darray = null,
 99:         $rawNodes = false, $module = 'adminhtml'
100:     ) {
101:         static $result;
102: 
103:         if (is_null($resource)) {
104:             $resource = Mage::getSingleton('api/config')->getNode('acl/resources');
105:             $resourceName = null;
106:             $level = -1;
107:         } else {
108:             $resourceName = $parentName;
109:             if ($resource->getName()!='title' && $resource->getName()!='sort_order'
110:                 && $resource->getName() != 'children'
111:             ) {
112:                 $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName();
113: 
114:                 //assigning module for its' children nodes
115:                 if ($resource->getAttribute('module')) {
116:                     $module = (string)$resource->getAttribute('module');
117:                 }
118: 
119:                 if ($rawNodes) {
120:                     $resource->addAttribute("aclpath", $resourceName);
121:                 }
122: 
123:                 $resource->title = Mage::helper($module)->__((string)$resource->title);
124: 
125:                 if ( is_null($represent2Darray) ) {
126:                     $result[$resourceName]['name']  = (string)$resource->title;
127:                     $result[$resourceName]['level'] = $level;
128:                 } else {
129:                     $result[] = $resourceName;
130:                 }
131:             }
132:         }
133: 
134:         $children = $resource->children();
135:         if (empty($children)) {
136:             if ($rawNodes) {
137:                 return $resource;
138:             } else {
139:                 return $result;
140:             }
141:         }
142:         foreach ($children as $child) {
143:             $this->_buildResourcesArray($child, $resourceName, $level+1, $represent2Darray, $rawNodes, $module);
144:         }
145:         if ($rawNodes) {
146:             return $resource;
147:         } else {
148:             return $result;
149:         }
150:     }
151: 
152:     /**
153:      * Filter data before save
154:      *
155:      * @return Mage_Api_Model_Roles
156:      */
157:     protected function _beforeSave()
158:     {
159:         $this->filter();
160:         parent::_beforeSave();
161:         return $this;
162:     }
163: 
164:     /**
165:      * Filter set data
166:      *
167:      * @return Mage_Api_Model_Roles
168:      */
169:     public function filter()
170:     {
171:         $data = $this->getData();
172:         if (!$this->_filters || !$data) {
173:             return $this;
174:         }
175:         /** @var $filter Mage_Core_Model_Input_Filter */
176:         $filter = Mage::getModel('core/input_filter');
177:         $filter->setFilters($this->_filters);
178:         $this->setData($filter->filter($data));
179:         return $this;
180:     }
181: }
182: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0