CakePHP: Disable Security Component site wide

2019-07-25 08:30发布

I have lot of AJAX functionality in my site and a component we freelanced was using CakePHP Security Component very tightly with the forms and this is lot of trouble.

How to disable Security Component site-wide in CakePHP? Just disabling it the app_controller.php is not helping because it is tightly coupled with some validation and black-hole stuff.

Any ideas?

1条回答
迷人小祖宗
2楼-- · 2019-07-25 08:55

Even if you disable it in your app_controller your individual controller may have that security enabled.As my wild guess says this is what you want to do.If not let me know more about it.

function beforeFilter(){
    parent::beforeFilter();

    if(isset($this->Security) && $this->RequestHandler->isAjax() && $this->action = 'add'){

        $this->Security->enabled = false;

    }

}

you can read more about this here .Hope this will solve your problem

查看更多
登录 后发表回答