[Catalyst] Audit logs: model or controller?

Charlie Garrison garrison at zeta.org.au
Mon Sep 17 13:47:27 GMT 2007


Good evening,

On 17/9/07 at 12:55 PM +0100, Ton Voon <ton.voon at altinity.com> wrote:

>However, one key bit of information I'd like to save is the 
>user at the web app level. But this is not passed to the model. 
>What would be a good way of having that information passed to 
>the model (I was thinking of setting an environment variable at 
>the start of a request and then removing it at the end)? Or is 
>it best to have audit logs at the controller?
>
>What have others done in similar cases?

You're looking for ACCEPT_CONTEXT. Took me a while to get the 
right setup so that it did what I needed but works great now. I 
couldn't find *one* complete example that showed me how to best 
implement it, but after looking at various examples I was able 
to pick out the bits that worked for my app. I ended up with 
something very close to this <http://article.gmane.org/gmane.comp.web.catalyst.general/11887>.

Best practices say to only store the info from $context that you 
need in your model rather than a reference to $context itself. 
IOW, if you just need the current user object, then just store 
that. I don't recall the reasoning for it though.

Charlie

-- 
    Charlie Garrison  <garrison at zeta.org.au>
    PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt



More information about the Catalyst mailing list