简体   繁体   English

Yii 1.1.14访问控制指定动作

[英]Yii 1.1.14 access control specify actions

I want to apply accessControl filter to all actions in a controller except two , 我想将accessControl过滤器应用于控制器中除两个之外的所有操作,

so if i apply [-] as written in code, will that be okay.? 因此,如果我将[-]应用为代码编写的形式,那可以吗?

public function filters(){
    return array(
        'accessControl - actionId1, actionId2',
    );
}

Or there is some error in the code, and i do it in some other way? 还是代码中有错误,而我以其他方式做到了?

This will work but you should use 这将起作用,但是您应该使用

array(
'allow',
'actions'=>array('actionId1', 'actionId2'),
'users'=>array('*'),
)

in the acessRules() For the actions for which you do not want any rule acessRules()中,对于不需要任何规则的操作

Note:- 'users'=>array('*') provides access to these actions to all the users 注意:- 'users'=>array('*')为所有用户提供对这些操作的访问

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM