Thursday, January 3, 2013

Re: Best practices for general checks and redirects?

If you only need to check (and redirect if necessary) upon login I
would be tempted to just place the code directly in the login()
method. The beforeFilter callback wouldn't be a good choice because it
fires on every request. Checking it once should be sufficient.

On Wed, Jan 2, 2013 at 7:14 PM, Jamie Krasnoo <jkrasnoo@gmail.com> wrote:
> Hey all,
>
> I'm new to CakePHP and have a lot of experience with other frameworks. I'd
> like to know what the best practice is for doing checking for things before
> any controller is run? Does it belong in the AppController's beforeFilter
> callback, the afterFilter in UsersController, or is there a place to
> specifically put this sort of stuff? I just need to make sure that the
> RegisterController and login and logout and pages aren't impeded.
>
> I need to check to see if a User with the role of merchants has their store
> set up after they log in. If they don't then they need to be redirected to
> the controller to set their store up.
>
> Jamie
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: