[Catalyst] What's the best way to exclude static requests from needing user to log in?

Matt S Trout dbix-class at trout.me.uk
Sun Apr 19 10:18:55 GMT 2009


On Sun, Apr 19, 2009 at 10:06:51AM +1000, kakimoto at tpg.com.au wrote:
> 
> hi, all
> 
>    what's the best way to exclude static requests from needing the user
> to log in?
> Some parts of my site are open to general public. For example, the
> 'contact us', 'services portfolio' and so forth pages.
> 
>   At the moment, I have put in codes in my MyApp::Controller::Root->auto
> and it seems to want every request to be logged on.

Two options:

(1) (preferred) use Chained and have two root chain points, one that requires
login and one that doesn't

(2) sub static_serving_thing :NoLogin and check for
$c->action->attributes->{NoLogin} in your root auto

I'd suggest avoiding the ACL plugin; the implementation's a complete hack
and Chained effectively obsoletes it anyway.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list