Mage_Api_Model_Acl_Role_Registry Class Reference

List of all members.

Public Member Functions

 addParent ($role, $parents)


Detailed Description

Definition at line 35 of file Registry.php.


Member Function Documentation

addParent ( role,
parents 
)

Add parent to the $role node

Parameters:
Zend_Acl_Role_Interface|string $role
array|Zend_Acl_Role_Interface|string $parents
Returns:
Mage_Auth_Model_Acl_Role_Registry

Definition at line 44 of file Registry.php.

00045     {
00046         try {
00047             if ($role instanceof Zend_Acl_Role_Interface) {
00048                 $roleId = $role->getRoleId();
00049             } else {
00050                 $roleId = $role;
00051                 $role = $this->get($role);
00052             }
00053         } catch (Zend_Acl_Role_Registry_Exception $e) {
00054             throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist");
00055         }
00056 
00057         if (!is_array($parents)) {
00058             $parents = array($parents);
00059         }
00060         foreach ($parents as $parent) {
00061             try {
00062                 if ($parent instanceof Zend_Acl_Role_Interface) {
00063                     $roleParentId = $parent->getRoleId();
00064                 } else {
00065                     $roleParentId = $parent;
00066                 }
00067                 $roleParent = $this->get($roleParentId);
00068             } catch (Zend_Acl_Role_Registry_Exception $e) {
00069                 throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist");
00070             }
00071             $this->_roles[$roleId]['parents'][$roleParentId] = $roleParent;
00072             $this->_roles[$roleParentId]['children'][$roleId] = $role;
00073         }
00074         return $this;
00075     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:32 2009 for Magento by  doxygen 1.5.8