CakePHP - how to grant public permission on the homepage
I've set up a basic authentication / authorization setup, but now the problem is that every time I try to access http: // localhost: 1234 / it requires a login.
How / Where can I do Auth-> ("index") authorization on the home page?
0
a source to share
3 answers
In the beforeFilter () of your controller
add the following piece of code
> $this->Auth->allow('actionname');
Suppose if I want to allow adding / registering a user without logging in, I would do it in the beforeFilter () function of the users_controller.php file.
> $this->Auth->allow('add');
+4
a source to share
for cakephp 1.3 you should do it now like this:
var $components = array(
'Auth' => array(
'authorize' => 'controller',
'allowedActions' => array('index','**display**');
)
);
And remember, you can also configure your router:
Router::connect('/facebook', array('controller' => 'pages', 'action' => '**display**', 'facebook'));
0
a source to share