/** * Display index - debug page, login page, or account page */ public function actionIndex() { if (defined('YII_DEBUG') && YII_DEBUG) { $actions = $this->module->getActions(); return $this->render('index', ["actions" => $actions]); } elseif (Yii::$app->user->isGuest) { return $this->redirect(["/user/login"]); } else { return $this->redirect(["/user/account"]); } }
/** * Display index - debug page, login page, or account page */ public function actionIndex() { if (defined('YII_DEBUG') && YII_DEBUG) { $actions = $this->module->getActions(); if (Yii::$app->user->can("admin")) { return $this->render('index', ["actions" => $actions]); } else { if (Yii::$app->user->can("index-user") || Yii::$app->user->can("user")) { $searchModel = $this->module->model("UserSearch"); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams()); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } else { throw new ForbiddenHttpException("Acesso negado!"); } } } elseif (Yii::$app->user->isGuest) { return $this->redirect(["/user/login"]); } else { return $this->redirect(["/user/account"]); } }