> I guess that when you declare a beforeFilter() method in a controller
> (which extends AppController) it overrides the
> AppController::beforeFilter() ? Am I right ?

Yes, then you just need to call parent::beforeFilter() inside the
beforeFilter method from the controller you are declaring.

Usually, when you override a parent method for extending it's
functionality you need to call it manually.

> I'm going to do the following :
>
> 1) In my AppController I'll put this :
>
> function initializeAuthComponent()
> {
>        $this->Auth->userModel = "Utilisateur";
>        $this->Auth->fields = array('username' => 'login', 'password' =>
> 'pass');
>        $this->Auth->loginAction = array('controller' => 'utilisateurs',
> 'action' => 'login');
>        $this->Auth->loginError = __("Identifiant et/ou mot de passe
> incorrect", true);
> }
>
> 2) In all of my controllers extending AppController I'll do this :
>
> function beforeFilter()
> {
>        $this->initializeAuthComponent();
>        $this->Auth->allow("allowedAction1", "allowedAction2", ...);
> }
>

I use to do this:

Create a private function _setupAuth() in AppController, then in
AppController::beforeFilter() call it and in child controller's
beforeFilter() just call parent::beforeFilter().

> Thanks for your time.

You are welcome.

Regards,
- Dardo Sordi.


>
> On 5 juin, 13:02, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>> Ignore the previous code, I hit the send button by accident
>>
>> class ThingsControllers extends Appcontroller {
>>
>>     var $name = 'Things';
>>
>>     function beforeFilter() {
>>
>>         parent::beforeFilter();
>>
>>         // this controller custom stuff
>>
>>     }
>>
>> }
>>
>> Regards,
>> - Dardo Sordi
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to