YII中You are not authorized to perform this action的解决方法

来源:互联网 发布:唐山的软件代理商 编辑:程序博客网 时间:2024/05/15 18:15

当访问: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('*'),),);}

0 0
原创粉丝点击