当访问:TblOrders/listdetial时
YII中出现You are not authorized to perform this action的提示,是因为当前用户没有访问这个控制器下面的actionlistdetial的权限,只要在accessRules下设置一下该action的访问控制就可以了。
代码如下:
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update','listdetial'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>array('admin','@'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
更多推荐
YII中You are not authorized to perform this action的解决方法
发布评论