I have a "Posts" and a "Users" controller. I use the Auth Component and I want that all users can visit "Post.index" but only logged in users can visit "User.index".
In my app_controller.php I have this
$this->Auth->allow('signup', 'confirm', 'index');
but with that all users can visit post.index and user.index. How can I specify a Controller in the allow-method?
This didn't work for me:
$this->Auth->allow('signup', 'confirm', 'Post.index');
update I removed 'index' from the app_controller.php and instead set it in the beforeFilter method in the post controller:
function beforeFilter()
{
parent::beforeFilter();
$this->Auth->allow('index');
}
I also set a variable "loggedIn" in app_controller, without calling "parent::beforeFilter();" I got an "undefined variable" notice.
thx sibidiba