Php 注册用户时,Yii权限表不存储数据

Php 注册用户时,Yii权限表不存储数据,php,yii,yii-extensions,Php,Yii,Yii Extensions,我做了很多尝试,因为查询是在用户模型中执行的。我的数据插入(用户、authassignment、authitem、authitemchild)这些表中,但不插入权限表中 public function afterSave() { if ($this->isNewRecord) { $model = User::model()->findByPk($this->id); echo $role = ucfirst($model->

我做了很多尝试,因为查询是在用户模型中执行的。我的数据插入(用户、authassignment、authitem、authitemchild)这些表中,但不插入权限表中

public function afterSave() {
    if ($this->isNewRecord) {
        $model = User::model()->findByPk($this->id);
        echo     $role = ucfirst($model->usertype); die;
        $authorizer = Yii::app()->getModule("rights")->getAuthorizer();
        $authorizer->authManager->assign($role, $this->id);
        return parent::afterSave();
    }
}

不需要
$model=User::model()->findByPk($this->id)
,因为
$model
=
$this
。您还有一个不必要的
die
。是的,我已经删除了die和User::model()->findByPk($this->id),但不起作用。您是否已将
权限设置为配置文件中的
authManager