CakePHP: Disable Security Component site wide

烂漫一生 提交于 2019-12-11 04:35:51

问题


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:


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



来源:https://stackoverflow.com/questions/9171227/cakephp-disable-security-component-site-wide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!