On 25/06/12 13:00 Bill Moseley wrote: > > > On Mon, Jun 25, 2012 at 4:48 AM, Robert Rothenberg <[email protected] > <mailto:[email protected]>> wrote: > > Several DBIC classes in our application have been customized with a method > > user_can_modify($c) > > Do you really need the context?
Yes. > I think the suggestion is normally pass in > the data you need, which I suspect is a user object. Then you are not > binding DBIC and Catalyst so tightly. > > user_can_modify( $user ): No. I need other information from the context, such as whether a user is even logged in, the user's roles, and session information, among other things. > Sure, you can mock up a context object, but for flexible to pass in only the > data you really need. It's much more complex to set up and change a mock object, and have to worry about whether it's set up correctly, than to log in as a particular user and do actions that the user would normally do, and test how that affects the user's access permissions. _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
