I’m trying to configure RBAC on my backend but CHttpException (403) appears without layout and styles, just plaintext on screen when user role is different from Admin. Here’s part of accessRules in AdminController (all Admin Pannel controllers extends base AdminController):
I have decided this problem by myself and our methods as it turned out are the same.
By default I have standard errorAction ‘core/default/error’. In protected/modules/core/views/layouts I made error.php layout which handles all system Exceptions. Finally I changed actionError in CoreController like this:
public function actionError() {
if ($error = Yii::app()->errorHandler->error) {
if (Yii::app()->request->isAjaxRequest) {
echo $error['message'];
} else {
$this->layout = 'core.views.layouts.eror'; // layout for frontend and backend Exceptions
$this->render('error', $error);
}
}
}