0

我正在 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)

谁能告诉我我在这里做错了什么?

4

1 回答 1

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
于 2013-03-04T06:07:26.363 回答