[Catalyst] Changing Model attributes in ACCEPT_CONTEXT

Jonathan Rockway jon at jrock.us
Thu Jan 25 08:25:29 GMT 2007


On Wednesday 24 January 2007 16:30, James R. Leu wrote:
> This seems to work, but it feels wrong.  Is there a better way
> to go about changing the Model attributes on the fly per user.

Looks fine to me.  The main thing is that reconnecting to the database is 
pretty inefficient, so it's intentionally hard to do.  

You might be better off rethinking your approach.  Perhaps wrapping the tables 
with stored procs to enforce access control would work?  Then you'd only have 
to connect once, and it would probably be easy to get DBIC to silently pass 
@USERNAME=$c->user on every query.  I'm sure how well relations would work in 
that case, though.

Regards,
Jonathan Rockway

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070125/f6fb401e/attachment.pgp


More information about the Catalyst mailing list