console/controllers/RbacController.php
/**
     * Create all default roles and permissions of the system
     * [Roles]
     * Root: Biggest role. It can do everything and manage role/permission
     * Admin: Can do everything in system without role/permission
     * User Manager: Manage user
     * Content Manager: Manage content
     *
     * [Permissions]
     * 
     * yii rbac/init
     */
Create all default roles and permissions of the system
[Roles]
Root: Biggest role. It can do everything and manage role/permission
Admin: Can do everything in system without role/permission
User Manager: Manage user
Content Manager: Manage content

[Permissions]

yii rbac/init
Create all default roles and permissions of the system [ Roles ] Root : Biggest role . It can do everything and manage role / permission Admin : Can do everything in system without role / permission User Manager : Manage user Content Manager : Manage content [ Permissions ] yii rbac / init
public function actionInit()
    {
        if (!$this->confirm("Are you sure? It will re-create permissions tree.")) {
            return self::EXIT_CODE_NORMAL;
        }
        $auth = Yii::$app->authManager;
        $auth->removeAll();
        $root = $auth->createRole('root');
        $root->description = 'Root Admin';
        $auth->add($root);
        $admin = $auth->createRole('admin');
        $admin->description = 'Admin';
        $auth->add($admin);
        $auth->addChild($root, $admin);
        $auth->assign($root, 1);
    }
public function actionInit ( ) { if ( ! $ this -> confirm ( " Are you sure? It will re-create permissions tree. " ) ) { return self :: EXIT_CODE_NORMAL ; } $ auth = Yii :: $ app -> authManager ; $ auth -> removeAll ( ) ; $ root = $ auth -> createRole ( 'root' ) ; $ root -> description = 'Root Admin' ; $ auth -> add ( $ root ) ; $ admin = $ auth -> createRole ( 'admin' ) ; $ admin -> description = 'Admin' ; $ auth -> add ( $ admin ) ; $ auth -> addChild ( $ root , $ admin ) ; $ auth -> assign ( $ root , 1 ) ; }
Create all default roles and permissions of the system
 [Roles]
 Root: Biggest role.
Create all default roles and permissions of the system [ Roles ] Root : Biggest role .
// Role: root // Role: admin // Init the first user