Public Member Functions | |
update () | |
getUsersCollection () | |
getResourcesTree () | |
getResourcesList () | |
getResourcesList2D () | |
getRoleUsers () | |
Protected Member Functions | |
_construct () | |
_buildResourcesArray (Varien_Simplexml_Element $resource=null, $parentName=null, $level=0, $represent2Darray=null, $rawNodes=false, $module= 'adminhtml') |
Definition at line 27 of file Roles.php.
_buildResourcesArray | ( | Varien_Simplexml_Element $ | resource = null , |
|
$ | parentName = null , |
|||
$ | level = 0 , |
|||
$ | represent2Darray = null , |
|||
$ | rawNodes = false , |
|||
$ | module = 'adminhtml' | |||
) | [protected] |
Definition at line 65 of file Roles.php.
00066 { 00067 static $result; 00068 00069 if (is_null($resource)) { 00070 $resource = Mage::getSingleton('api/config')->getNode('acl/resources'); 00071 $resourceName = null; 00072 $level = -1; 00073 } else { 00074 $resourceName = $parentName; 00075 if ($resource->getName()!='title' && $resource->getName()!='sort_order' && $resource->getName() != 'children') { 00076 $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName(); 00077 00078 //assigning module for its' children nodes 00079 if ($resource->getAttribute('module')) { 00080 $module = (string)$resource->getAttribute('module'); 00081 } 00082 00083 if ($rawNodes) { 00084 $resource->addAttribute("aclpath", $resourceName); 00085 } 00086 00087 $resource->title = Mage::helper($module)->__((string)$resource->title); 00088 00089 if ( is_null($represent2Darray) ) { 00090 $result[$resourceName]['name'] = (string)$resource->title; 00091 $result[$resourceName]['level'] = $level; 00092 } else { 00093 $result[] = $resourceName; 00094 } 00095 } 00096 } 00097 00098 $children = $resource->children(); 00099 if (empty($children)) { 00100 if ($rawNodes) { 00101 return $resource; 00102 } else { 00103 return $result; 00104 } 00105 } 00106 foreach ($children as $child) { 00107 $this->_buildResourcesArray($child, $resourceName, $level+1, $represent2Darray, $rawNodes, $module); 00108 } 00109 if ($rawNodes) { 00110 return $resource; 00111 } else { 00112 return $result; 00113 } 00114 }
_construct | ( | ) | [protected] |
Enter description here...
Reimplemented from Varien_Object.
Definition at line 29 of file Roles.php.
00030 { 00031 $this->_init('api/roles'); 00032 }
getResourcesList | ( | ) |
Definition at line 50 of file Roles.php.
00051 { 00052 return $this->_buildResourcesArray(); 00053 }
getResourcesList2D | ( | ) |
Definition at line 55 of file Roles.php.
00056 { 00057 return $this->_buildResourcesArray(null, null, null, true); 00058 }
getResourcesTree | ( | ) |
Definition at line 45 of file Roles.php.
00046 { 00047 return $this->_buildResourcesArray(null, null, null, null, true); 00048 }
getRoleUsers | ( | ) |
Definition at line 60 of file Roles.php.
00061 { 00062 return $this->getResource()->getRoleUsers($this); 00063 }
getUsersCollection | ( | ) |
Definition at line 40 of file Roles.php.
00041 { 00042 return Mage::getResourceModel('api/roles_user_collection'); 00043 }
update | ( | ) |
Definition at line 34 of file Roles.php.
00035 { 00036 $this->getResource()->update($this); 00037 return $this; 00038 }