public bool UserCanView(CMSDataContext db) { if (db.FromBatch) { return(true); } if (!VisibilityRoles.HasValue()) { return(true); } var a = VisibilityRoles.SplitStr(","); var user = HttpContext.Current.User; return(a.Any(role => user.IsInRole(role.Trim()))); }
public bool UserCanView() { if (!VisibilityRoles.HasValue()) { return(true); } var a = VisibilityRoles.SplitStr(","); var user = HttpContext.Current.User; foreach (var role in a) { if (user.IsInRole(role.Trim())) { return(true); } } return(false); }