do I need $this-Auth-userModel = 'User'; in every controller beforefilter or not?

2011-02-09 Thread barricades
I'm new to learning cakephp so firstly thanks to the developers (esp
the core team) who have put so much effort into cake, it looks like
it's going to be great when I finally figure it all out.

I'm following the tutorial
http://book.cakephp.org/view/1549/An-Automated-tool-for-creating-ACOs#!/view/1543/Simple-Acl-controlled-Application
- I have to admit that I'm loosely following it and suiting bits to my
needs but I'm basically following it.

I'd set it all up but it wasn't working properly in that it wasn't
allowing me to access any functions in the posts controller when it
was supposed to be allowing me. I just kept getting 'you are not
authorized...' messages.

In another tutorial I then read through it said that I should have
$this-Auth-userModel = 'User'; in the beforefilter of my users
controller and posts controller. When I put that line in things
started to work. So I'm confused now. Is the tutorial wrong or have I
got the wrong end of the stick? do I need $this-Auth-userModel =
'User';  in every controller beforefilter or not? Or can I stick it in
the beforefilter of app_controller? Do I need it at all?

thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: do I need $this-Auth-userModel = 'User'; in every controller beforefilter or not?

2011-02-09 Thread Miles J
Most of those settings are default, so now you do not have to add them
as long as you follow conventions. For easier convenience, place in
your AppController.

However, you do need to allow() in every controllers beforeFilter().

On Feb 9, 12:03 pm, barricades davow...@googlemail.com wrote:
 I'm new to learning cakephp so firstly thanks to the developers (esp
 the core team) who have put so much effort into cake, it looks like
 it's going to be great when I finally figure it all out.

 I'm following the 
 tutorialhttp://book.cakephp.org/view/1549/An-Automated-tool-for-creating-ACOs...
 - I have to admit that I'm loosely following it and suiting bits to my
 needs but I'm basically following it.

 I'd set it all up but it wasn't working properly in that it wasn't
 allowing me to access any functions in the posts controller when it
 was supposed to be allowing me. I just kept getting 'you are not
 authorized...' messages.

 In another tutorial I then read through it said that I should have
 $this-Auth-userModel = 'User'; in the beforefilter of my users
 controller and posts controller. When I put that line in things
 started to work. So I'm confused now. Is the tutorial wrong or have I
 got the wrong end of the stick? do I need $this-Auth-userModel =
 'User';  in every controller beforefilter or not? Or can I stick it in
 the beforefilter of app_controller? Do I need it at all?

 thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php