actionInit() * This command will fill the database with the authorisation data, like roles(e.g. admin, user), or * permissions (e.g. access to user validation or shopping cart) * */ public function actionInit() { $auth = Yii::$app->authManager; // // add "createPost" permission // $validateUser = $auth->createPermission('validateUser'); // $validateUser->description = 'Validate a user who wants to sign up'; // $auth->add($validateUser); // //add shopping permission // $shopping = $auth->createPermission('shopping'); // $shopping->description = 'Order samples from the database'; // $auth->add($shopping); // // add "user" role and give this role the "shopping" permission // $loggedInUser = $auth->createRole('user'); // $auth->add($loggedInUser); // $auth->addChild($loggedInUser, $shopping); // // add 'admin' role and give the admin the permission to validate users // $admin = $auth->createRole('admin'); // $auth->add($admin); // $auth->addChild($admin, $validateUser); // $auth->addChild($admin, $shopping); } /** * @inheritdoc */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction' ], ]; } }