Understood. I would recommend using an interceptor to set these permission-based layout views. That way, you don’t have to muck up every handler action with the logic and it’s guaranteed to run on every page.
Register an interceptor with a preProcess method that checks the credentials of the logged-in user and sets the views they should get to see in the private request collection. (It’s cleaner that way and keeps it clear of the regular request collection that actually applies to the page). Now, every page on your site will automatically have the views set for them. Or really, for that matter, you could simply put the if statement in your layout and be done with it. There’s no reason why you can’t put a little logic in a layout as long as any heavy lifting is deferred to a service.
Is the difference between rendering a view and running an event that renders a view clearer now? For instance, if the left side bar was “similar content” or something like that, your view would need to get data to display and the wrapper event gives you a place to do that cleanly.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com