Probably a more correct way could be
function isAuthorized(){
return $this->Auth->user();
}Il 18/04/2012 00:24, jeremyharris ha scritto:
Setting $this->Auth->authorize = array('Controller'); tells the AuthComponent where to run the `isAuthorized()` method, in this case, the Controller. You can find more info here: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorizeOn Tuesday, April 17, 2012 2:45:56 PM UTC-7, DigitalDude wrote: Hey, hmmmm as I changed the code to the snippet of stork, it gave me a "... function isAuthorized() on a non-object (auth-component line 52). When I added the code of luca capra, everything is working as expected. All actions that are not allowed by $this->Auth->allow() within beforeFilter-functions of my controllers are blocked when not logged in. When logged in, I can use those actions. Thank you very much, both of you. It's still weird about the error with the auth-component and the isAuthorized() function, but as it now works I will go deeper into the code of the Auth component later. If anyone has an explanation for this, it would be great to discuss it! Again, thank you very much, that saved me a lot of time! Regards, DD On 17 Apr., 16:03, stork <[email protected]> wrote: > > $this->Auth->authorize = 'controllers'; > > $this->Auth->authorize = array('Controller'); --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[email protected] For more options, visit this group at http://groups.google.com/group/cake-php
--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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
