I have some doubts regarding the following controller action (in ASP.NET MVC, but it's a more generic question ) :
public ActionResult DoSomething( int id, IUser currentUser )
{
var myDomainObject = businessService.GetDomainObjectById( id );
if( !securityService.CurrentUserCanAcess( currentUser, myDomainObject ) )
{
throw new HttpException(403, "forbidden");
}
if( workflowService.IsWorkflowFinishedFor( myDomainObject ) )
{
return RedirectToAction( "OtherAction", identifier );
}
var myModel = entityToModelMapper.GetModel( myDomainObject );
return View( myModel );
}
workflowService, securityService, businessService and entityToModelMapper are all injected into my controller with IoC.
I'm concerned about having security, business and workflow involved in the same controller action. Is it OK ?