protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter) { if ((new string[3] { "A_111", "AA_Agents", "AA_Visit" }).Contains(view.Name)) { if (User.IsInRole("User")) { if (User == null || User.Identity == null || User.Identity.Name == null) { throw new AccessViolationException(); } if (view.Name == "A_111") { filter.WhereStatement += " and sochen_1 = " + User.Identity.Name; } if (view.Name == "AA_Agents") { filter.WhereStatement += " and Sochen = " + User.Identity.Name; } if (view.Name == "AA_Visit") { filter.WhereStatement += " and SochenID = " + User.Identity.Name; } } } base.SetPermanentFilter((Durados.Web.Mvc.View)view, filter); }
protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter) { if (Durados.Web.Mvc.UI.Helpers.SecurityHelper.IsInRole("User")) { if (User == null || User.Identity == null || User.Identity.Name == null) { throw new AccessViolationException(); } filter.WhereStatement += " and UserID = " + Durados.Web.Mvc.Specifics.Bugit.DataAccess.User.GetUserID(User.Identity.Name);; } }
protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter) { if ((new string[4] { "Issue", "Project", "User", "vTimeSheet" }).Contains(view.Name)) { if (Durados.Web.Mvc.UI.Helpers.SecurityHelper.IsInRole("User")) { if (User == null || User.Identity == null || User.Identity.Name == null) { throw new AccessViolationException(); } int?companyID = DataAccess.User.GetCompanyID(User.Identity.Name); if (!companyID.HasValue) { throw new AccessViolationException(); } filter.WhereStatement += " and CompanyID = " + companyID.Value; } } base.SetPermanentFilter((Durados.Web.Mvc.View)view, filter); }