> That's going to be a lot of maintenance.

You're right, I didn't think about it. Obviously I'm not so
experienced in professionnal development which is normal as I've only
been working as a web developer for seven months. In opposition to me,
you seem to have a good hindsight with development, and I appreciate
your advice a lot.

> It gets to the point in a 'serious project' where you have to stop digging 
> and move on.(...) I now have a rule that if after an hour it looks like I'm 
> going
nowhere I do something else.

You are right. I'm always waisting my time trying to find the best
solution ever or trying to make things work exactly as I want them to
work and finally I waste a lot of time. And at work time == money so
you can't spend a whole day searching the web...

But as far as the Auth component is concerned, even if you use the
standard Users controller, actually (correct me if I'm wrong) it
doesn't help you save a lot of lines. What I wanted to do is keeping
all the initialization process of the Auth component in the
AppController class in order to not repeat the following lines in each
controller :

var $components = array("Auth");

function beforeFilter()
{
        $this->Auth->userModel = "Utilisateur";
        $this->Auth->fields = array('username' => 'login', 'password' =>
'pass');
        $this->Auth->loginAction = array('controller' => 'utilisateurs',
'action' => 'login');
        $this->Auth->loginRedirect = array('controller' => 'utilisateurs',
'action' => 'index');
        $this->Auth->logoutRedirect = array('controller' => 'creations',
'action' => 'index');
        $this->Auth->loginError = __("Identifiant et/ou mot de passe
incorrect", true);
        $this->Auth->authError = __("Vous n'êtes pas autorisé à accéder à cet
endroit.", true);
}

But using the standard Users controller doesn't change anything with
that. So I may use Dardo Sordi Bogado's method as he tells me it
works...

Thank you Leo.


On 5 juin, 18:09, leo <[EMAIL PROTECTED]> wrote:
> >> "I gave up in the end as I had to make so many changes"
> >> => The only changes that I had to make for now is to add the following
> >> code in all my controllers :
>
> That's going to be a lot of maintenance.
>
> >> Can you please give me more details about
> >> those changes ? What do you advise me to do ? I'm working on a serious
> >> project (at the office, so not just for fun) so if it's necessary to
> >> have a Users controller I'll make one...
>
> I can't really give you details because I never got it working by
> reconfiguring and it would (may) just lead you along the wrong path.
>
> It gets to the point in a 'serious project' where you have to stop
> digging and move on. This thread has now run to 14 messages.
>
> I now have a rule that if after an hour it looks like I'm going
> nowhere I do something else. That's why I opted to go with the
> standard out of the box approach. Follow the manual word for word and
> it'll just work.
>
> On Jun 5, 4:53 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > >    => Do you think it will work as my solution which was about the same
> > > technically (except I didn't use the parent beforeFilter() method and my
> > > initializeAuthComponent() wasn't private) didn't ?
>
> > I don't know what are you doing in your setup in order to make it
> > don't work, for me is working great.
>
> > > BTW, I don't understand why my solution didn't work, but this Auth 
> > > component
> > > seems a little strange...
>
> > The Auth component works just fine.
>
> > > 2008/6/5 Dardo Sordi Bogado <[EMAIL PROTECTED]>:
>
> > >> > 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