/** * Returns the authorization item with the specified name. * Overloads the parent method to allow for runtime caching. * @param string $name the name of the item. * @param boolean $allowCaching whether to accept cached data. * @return CAuthItem the authorization item. Null if the item cannot be found. */ public function getAuthItem($name, $allowCaching = true) { // Get all items if necessary and cache them. if ($allowCaching && $this->_items === array()) { $this->_items = $this->getAuthItems(); } // Get the items from cache if possible. if ($allowCaching && isset($this->_items[$name])) { return $this->_items[$name]; } else { if (($item = parent::getAuthItem($name)) !== null) { return $item; } } // Item does not exist. return null; }
public function getAuthItem($name) { if (array_key_exists($name, $this->_authItems)) { if ($this->_authItems[$name] == null) { return null; } return new CAuthItem($this, $this->_authItems[$name]['name'], $this->_authItems[$name]['type'], $this->_authItems[$name]['description'], $this->_authItems[$name]['bizrule'], $this->_authItems[$name]['data']); } $item = parent::getAuthItem($name); if ($item == null) { $this->_authItems[$name] = null; } else { $this->_authItems[$name]['name'] = $item->getName(); $this->_authItems[$name]['type'] = $item->getType(); $this->_authItems[$name]['description'] = $item->getDescription(); $this->_authItems[$name]['bizrule'] = $item->getBizRule(); $this->_authItems[$name]['data'] = $item->getData(); } return $item; }