public function beforeAction($action) { if ($this->checkAccess()) { return parent::beforeAction($action); } else { throw new ForbiddenHttpException('You are not allowed to access this page.'); } }