简体   繁体   中英

Yii 1.1.14 access control specify actions

I want to apply accessControl filter to all actions in a controller except two ,

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

Note:- 'users'=>array('*') provides access to these actions to all the users

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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