RbacController::actionInit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: zmievskaya
5
 * Date: 18.11.16
6
 * Time: 10:59
7
 */
8
9
namespace app\commands;
10
11
use Yii;
12
use yii\console\Controller;
13
14
class RbacController extends Controller
15
{
16
    public function actionInit()
17
    {
18
        $auth = Yii::$app->authManager;
19
20
        $user = $auth->createRole('user');
21
        $auth->add($user);
22
23
        $admin = $auth->createRole('admin');
24
        $auth->add($admin);
25
        $auth->addChild($admin, $user);
26
    }
27
}