“CDbAuthManager.AuthAssignment”是只读的

时间:2013-10-02 09:56:30

标签: yii rbac

我刚刚将我的网站上传到云端。它在localhost上运行正常。但它在包含RBAC的视图中给出了这个错误。我不确定为什么(见代码)。

我尝试将模型权限从644更改为777以获取AuthAssignment模型以查看是否有帮助。它没有。

当YII尝试在我的控制器中运行“CheckAccess”代码时出现错误。错误显示在下面代码的第220行。

有谁知道最新情况以及我可以采取哪些措施来解决这个问题?谢谢!

CException

Property "CDbAuthManager.AuthAssignment" is read only.
/var/www/vhosts/MYDOMAIN/yii/framework/YiiBase.php(220)

  208             {
  209                 unset($args[0]);
  210                 $class=new ReflectionClass($type);
  211                 // Note: ReflectionClass::newInstanceArgs() is available for PHP        5.1.3+
  212                 // $object=$class->newInstanceArgs($args);
  213                 $object=call_user_func_array(array($class,'newInstance'),$args);
  214             }
  215         }
  216         else
  217             $object=new $type;
  218 
  219         foreach($config as $key=>$value)
  220             $object->$key=$value;
  221 
  222         return $object;
  223     }
  224 
  225     /**
  226      * Imports a class or a directory.
  227      *
  228      * Importing a class is like including the corresponding class file.
  229      * The main difference is that importing a class is much lighter because it only
  230      * includes the class file when the class is referenced the first time.
  231      *
  232      * Importing a directory is equivalent to adding a directory into the PHP include path.

1 个答案:

答案 0 :(得分:1)

想出来了。这是一个愚蠢的错误。上传到linux服务器后,我试图解决RBAC表分配的问题,并且做错了。这是正确的方法。

//In config/main.php

'authManager'=>array(
        'class'=>'CDbAuthManager',
        'connectionID'=>'db',
        'assignmentTable'=>'authassignment',
        'itemTable'=>'authitem',
        'itemChildTable'=>'authitemchild',
        ),