CakePHP: Disable Site Security Component

I have many AJAX features on my site, and the component that we freelanced used CakePHP Security Component very heavily with forms, and this is a lot of trouble.

How to disable the security component on a site in CakePHP? Just disabling it, the app_controller.php application does not help, because it is closely related to some checks and the black hole.

Any ideas?

+1
source share
1 answer

Even if you disable it in your app_controller, your individual controller can enable this protection. Since my wild guess is that this is what you want to do. If not tell me more about this.

function beforeFilter(){ parent::beforeFilter(); if(isset($this->Security) && $this->RequestHandler->isAjax() && $this->action = 'add'){ $this->Security->enabled = false; } } 

You can read about it here . Hope this solves your problem.

+3
source

Source: https://habr.com/ru/post/1432417/


All Articles