Validation based on roles and data

Validation based on roles and data

Old forum URL: forums.lhotka.net/forums/t/7114.aspx


j055 posted on Tuesday, June 16, 2009

Hi

I want to restrict access to data based on parameter values passed into the business object's Fetch factory method. I wondered if there's a better alternative to this using built in functionality of the CSLA framework.

public static BusList GetList(bool status)
{
if (!ApplicationContext.User.IsInRole("Admin") && status == false)
throw new SecurityException("Access denied.");
return DataPortal.Fetch(status);
}

Also is there a way of using Validation rules with the current ApplicationContext? I haven't seen any examples in the book.

Thanks
Andrew

Copyright (c) Marimer LLC