2010年2月16日星期二

Re: [fw-mvc] Inject preDispatch code without explicitly declaring it in each controller

Good point, but if you don't need the controller at all (depends on how the OP decides to handle the unauthenticated scenario) then you can skip dispatching the controller and redirect at routeShutdown (the earlier point in which you'll know where the user is going).

--
Hector


On Tue, Feb 16, 2010 at 1:32 PM, Abraham Block <atblock@gmail.com> wrote:
I prefer to use an action helper, because this gives me access to the action controller in question


On Tue, Feb 16, 2010 at 4:31 PM, Hector Virgen <djvirgen@gmail.com> wrote:
I use a controller plugin for this. You can check out the source here:


To register it with the front controller I added this line to my application.ini:

resources.frontController.plugins.authenticate = "Default_Plugin_Authenticate"

You'll need to ensure that the class can be autoloaded first.

--
Hector



On Tue, Feb 16, 2010 at 1:22 PM, Abraham Block <atblock@gmail.com> wrote:
just add an action helper to the stack with a predispatch method


On Tue, Feb 16, 2010 at 4:19 PM, Nathan Garlington <garlinto@gmail.com> wrote:
Hi all,

I am trying to write an app that is accessed via a subdomain, and
handles all of the backend maintenance and configuration for a
customer's site. Since authentication will be necessary, I will need
to check for a valid identity on each request. I know that I can
handle this in each controller's preDispatch() method, but is there a
more central place that such code could be injected without having to
explicitly declare it in each controller? I was thumbing through the
docs, but I'm not sure how to search for what I am looking for.

Would appreciated being pointed in the right direction...

regards,

Nathan Garlington
T&R Trailer Sales
5930 N Interstate 25
Pueblo, CO  81008

719.546.2321 T
719.423.8033 M
719.404.4697 F

nathan@tandrtrailer.com
www.tandrtrailer.com





没有评论: