m160722_085418_init::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use yii2mod\rbac\migrations\Migration;
4
use yii2mod\rbac\rules\UserRule;
5
6
class m160722_085418_init extends Migration
7
{
8
    public function safeUp()
9
    {
10
        $this->createRule('user', UserRule::class);
11
12
        $this->createRole('admin', 'Admin has all available permissions.');
13
        $this->createRole('user', 'Authenticated user.', 'user');
14
    }
15
16
    public function safeDown()
17
    {
18
        $this->removeRule('user');
19
20
        $this->removeRole('admin');
21
        $this->removeRole('user');
22
    }
23
}
24