[ 'class' => AccessControl::className(), 'rules' => [ [ 'actions' => ['error'], 'allow' => true, ], [ 'actions' => ['index','userimport'], 'allow' => true, 'roles' => ['@'], ], ], ] ]; } //This method should be in every controller public function init(){ if (!Yii::$app->user->isGuest){ Yii::$app->language = Yii::$app->user->identity->lang; } } public function actionIndex() { return $this->render('index'); } public function actionUserimport() { return $this->render('userimport'); } }