我正在YII建立一个网站。 我为我的一个控制器制作了一个删除功能。 我已经定义了这样的访问规则。
public function accessRules()
{
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('index', 'create', 'delete', 'update'),
'users'=>array('*'),
),
array('deny',
'users' => array('*'),
),
);
}
仍然如果我在登录后尝试访问删除功能,它会给我这个错误。
CHttpException
You are not authorized to perform this action. (C:\xampp\htdocs\framework\web\auth\CAccessControlFilter.php:170)
谁能告诉我这里做错了什么?
答案 0 :(得分:2)
public function accessRules()
{
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('index', 'create', 'delete', 'update'),
'users'=>array('@'),
),
array('deny',
'users' => array('*'),
),
);
}
Simple Thing you are allowing for all user and also deny for all user then how it will be work now login with demo/demo or admin/admin you can delete