diff --git a/src/guide/security/authorization.md b/src/guide/security/authorization.md index e1b5a23c..853216ff 100644 --- a/src/guide/security/authorization.md +++ b/src/guide/security/authorization.md @@ -396,9 +396,10 @@ public function signup() $user->save(false); // the following three lines were added: - $auth = \Yii::$app->authManager; - $authorRole = $auth->getRole('author'); - $auth->assign($authorRole, $user->getId()); + $authorRole = $this->manager->getRole('author'); + if ($authorRole !== null) { + $this->manager->assign($authorRole->getName(), $user->getId()); + } return $user; } @@ -408,7 +409,7 @@ public function signup() ``` For applications that require complex access control with dynamically updated authorization data -(such as an admin panel), you many need to develop special user interfaces using APIs offered by `authManager`. +(such as an admin panel), you many need to develop special user interfaces using APIs offered by `Yiisoft\Rbac\Manager`. ### Using rules