[Catalyst] Restricting access to the model
Kevin Old
kevinold at gmail.com
Tue Jul 18 19:44:27 CEST 2006
Hi Matt,
On 7/3/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> I tend to just modify the relevant ACCEPT_CONTEXT to return a resultset that
> already has (e.g.) "WHERE order.user_id = $current_uid" applied to it, at
> which point I can just do $c->model('DBIC::Orders') in my controller code and
> it Does The Right Thing.
I understand what your saying here, but can't figure out how to
implement it or how it's useful. I've read the docs about
ACCEPT_CONTEXT in Catalyst::Manual::Intro and Catalyst::Component, but
don't understand how this makes getting to that information easier.
It doesn't seem that hard to say:
$c->model('DBIC::Orders')->search({ user_id => $current_uid || $c->user->id });
If the ACCEPT_CONTEXT is a cool new way to handle (what seem to me as)
global variables, I'd love to use it, but wonder if you could give a
small example.
Thanks,
Kevin
--
Kevin Old
kevinold at gmail.com
More information about the Catalyst
mailing list