2013-03-04 36 views
0

我正在YII建设一个站点。 我做了一个功能像我的控制器之一删除。 我已经定义了像这样的访问规则。删除功能不起作用 - 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) 

有谁能告诉我我做错了吗?

回答

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