Mage_Api_Model_Mysql4_Roles Class Reference

Inheritance diagram for Mage_Api_Model_Mysql4_Roles:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 getRoleUsers (Mage_Api_Model_Roles $role)

Protected Member Functions

 _construct ()
 _beforeSave (Mage_Core_Model_Abstract $role)
 _afterSave (Mage_Core_Model_Abstract $role)
 _afterDelete (Mage_Core_Model_Abstract $role)

Protected Attributes

 $_usersTable
 $_ruleTable


Detailed Description

Definition at line 27 of file Roles.php.


Member Function Documentation

_afterDelete ( Mage_Core_Model_Abstract object  )  [protected]

Perform actions after object delete

Parameters:
Varien_Object $object

Reimplemented from Mage_Core_Model_Mysql4_Abstract.

Definition at line 66 of file Roles.php.

00067     {
00068         $this->_getWriteAdapter()->delete($this->getMainTable(), "parent_id={$role->getId()}");
00069         $this->_getWriteAdapter()->delete($this->_ruleTable, "role_id={$role->getId()}");
00070         return $this;
00071     }

_afterSave ( Mage_Core_Model_Abstract object  )  [protected]

Perform actions after object save

Parameters:
Varien_Object $object

Reimplemented from Mage_Core_Model_Mysql4_Abstract.

Definition at line 59 of file Roles.php.

00060     {
00061         $this->_updateRoleUsersAcl($role);
00062         Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG);
00063         return $this;
00064     }

_beforeSave ( Mage_Core_Model_Abstract object  )  [protected]

Perform actions before object save

Parameters:
Varien_Object $object

Reimplemented from Mage_Core_Model_Mysql4_Abstract.

Definition at line 39 of file Roles.php.

00040     {
00041         if ($role->getId() == '') {
00042             if ($role->getIdFieldName()) {
00043                 $role->unsetData($role->getIdFieldName());
00044             } else {
00045                 $role->unsetData('id');
00046             }
00047         }
00048 
00049         if ($role->getPid() > 0) {
00050             $row = $this->load($role->getPid());
00051         } else {
00052             $row = array('tree_level' => 0);
00053         }
00054         $role->setTreeLevel($row['tree_level'] + 1);
00055         $role->setRoleName($role->getName());
00056         return $this;
00057     }

_construct (  )  [protected]

Resource initialization

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 32 of file Roles.php.

00032                                     {
00033         $this->_init('api/role', 'role_id');
00034 
00035         $this->_usersTable = $this->getTable('api/user');
00036         $this->_ruleTable = $this->getTable('api/rule');
00037     }

getRoleUsers ( Mage_Api_Model_Roles role  ) 

Definition at line 73 of file Roles.php.

00074     {
00075         $read   = $this->_getReadAdapter();
00076         $select = $read->select()->from($this->getMainTable(), array('user_id'))->where("(parent_id = '{$role->getId()}' AND role_type = 'U') AND user_id > 0");
00077         return $read->fetchCol($select);
00078     }


Member Data Documentation

$_ruleTable [protected]

Definition at line 30 of file Roles.php.

$_usersTable [protected]

Definition at line 29 of file Roles.php.


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