Skip to content

Commit

Permalink
modification to #using-default-roles section (yiisoft#16177)
Browse files Browse the repository at this point in the history
* modification to #using-default-roles section

It wasn't clear where put the "authmanager" initialization code.
I specify that the user need to create his command or migration script in a separate files

* Update security-authorization.md
minitia authored and cebe committed Apr 27, 2018
1 parent 65e39ea commit be2de34
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/guide/security-authorization.md
Original file line number Diff line number Diff line change
@@ -617,7 +617,7 @@ assign each user to an RBAC role. Let's use an example to show how this can be d

Assume in the user table, you have a `group` column which uses 1 to represent the administrator group and 2 the author group.
You plan to have two RBAC roles `admin` and `author` to represent the permissions for these two groups, respectively.
You can set up the RBAC data as follows,
You can set up the RBAC data as follows, first create a class:


```php
@@ -646,7 +646,11 @@ class UserGroupRule extends Rule
return false;
}
}
```

Then create your own command/migration as explained [in the previous section](#generating-rbac-data):

```php
$auth = Yii::$app->authManager;

$rule = new \app\rbac\UserGroupRule;

0 comments on commit be2de34

Please sign in to comment.