Commit ed3084c8 by Alexander Makarov

Added $auth = Yii::$app->authManager; to authorization guide to show where $auth is coming from

parent 0b4b2b13
...@@ -342,6 +342,8 @@ The rule above checks if the `post` is created by `$user`. We'll create a specia ...@@ -342,6 +342,8 @@ The rule above checks if the `post` is created by `$user`. We'll create a specia
command we've used previously: command we've used previously:
```php ```php
$auth = Yii::$app->authManager;
// add the rule // add the rule
$rule = new \app\rbac\AuthorRule; $rule = new \app\rbac\AuthorRule;
$auth->add($rule); $auth->add($rule);
...@@ -444,6 +446,8 @@ class UserGroupRule extends Rule ...@@ -444,6 +446,8 @@ class UserGroupRule extends Rule
} }
} }
$auth = Yii::$app->authManager;
$rule = new \app\rbac\UserGroupRule; $rule = new \app\rbac\UserGroupRule;
$auth->add($rule); $auth->add($rule);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment