/** * Removes cache before revoking auth item assignement * @param string $itemName the item name * @param mixed $userId the user ID (see {@link IWebUser::getId}) * @return boolean whether removal is successful * @throws CExeption if the application component could not be loaded. */ public function revoke($itemName, $userId) { if (Yii::app()->getComponent($this->cacheID) !== null) { Yii::app()->getComponent($this->cacheID)->delete($this->cacheID . '_' . $itemName . '_' . $userId); return parent::revoke($itemName, $userId); } else { throw new CException('Application component ' . $this->cacheID . ' could not be loaded.'); } }
/** * Revoce authorization assignment from a user * * @param string $itemName if null, all user assignments are revoked * @param int $userId * @return boolean */ public function revoke($itemName, $userId) { if ($itemName != NULL) { return parent::revoke($itemName, $userId); } else { $sql = "DELETE FROM {$this->assignmentTable} WHERE userid=:userid"; $command = $this->db->createCommand($sql); $command->bindValue(':userid', $userId); return $command->execute() > 0; } }