/** * Управление Должностями. * * @return void */ public function actionIndex() { $roles = ['1', '4']; $role = \Yii::app()->user->role; if (array_intersect($role, $roles)) { $model = new RoleToUser('search'); $model->unsetAttributes(); // clear any default values if (Yii::app()->getRequest()->getParam('RoleToUser') !== null) { $model->setAttributes(Yii::app()->getRequest()->getParam('RoleToUser')); } $this->render('index', ['model' => $model]); } else { throw new CHttpException(403, 'Ошибка прав доступа.'); } }