Hi,

Since it's the login and register action, I bet you have them in allow(). So the Auth component is disabled for those actions and isAuthorized is never called. You need to check it somewhere else (e.g. beforeFilter).

Max

Am 05.09.2010 22:28, schrieb Simon:
I have a isAuthorized function in my controller because $this->Auth-
authorize is set to 'controller'.
This is my function (the comments explains everything):
function isAuthorized()
{
        parent::isAuthorized();

        //if the user is logged in. He cannot access the register and login
function
        if( ($this->action == 'registreren') || ($this->action ==
'login') )
        {
             if( $this->Auth->user() )
            {
                    return false;
             }
            else
            {
                   return true;
            }
         }

         //other actions are available for everyone
         return true;
}

The problem is that it seems that this function is not called because
when I'm logged in, I still can access the registreren action.

Is there something I'm doing wrong. Or have I misunderstood the
meaning of this function?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

Reply via email to