protected internal void GetFormAccess() { SecurityManager manager = new SecurityManager(); String formName = string.Empty; #if DEBUG { formName = Request.Url.AbsolutePath; } #else { formName = Request.Url.AbsolutePath.Replace(@"/ERP",""); } #endif CustomList<LeftMenuItems> menuList = (CustomList<LeftMenuItems>)HttpContext.Current.Session["UserSession_LeftMenu"]; if (menuList.IsNotNull()) { LeftMenuItems menu = menuList.Find(f => f.FormName == formName); if (menu.IsNotNull()) { DocListFormatID = menu.DocListFormatID; MenuID = menu.ObjectID; StatusID = menu.StatusID; } } if (CurrentUserSession.IsAdmin) { accessRights = new FormAccessRights(); accessRights.CanSelect = true; accessRights.CanInsert = true; accessRights.CanUpdate = true; accessRights.CanDelete = true; } else { this.accessRights = manager.GetFormAccessRights(CurrentUserSession.UserCode, formName); } }
private void PopulateGrideWithMenu() { try { SecurityManager manager = new SecurityManager(); String response = String.Empty; String applicationID = HttpContext.Current.Request.QueryString["ApplicationID"]; CustomList<SECURITY.DAO.Menu> menu = manager.GetAllMenuByApplicationID(applicationID.ToString()); CustomList<Menu> MenuList = new CustomList<Menu>(); MenuList = menu.FindAll(f => f.FormName != ""); CustomList<RuleDetails> SecurityRuleDetailList = (CustomList<RuleDetails>)HttpContext.Current.Session["SecurityRule_SecurityRuleDetailList"]; foreach (SECURITY.DAO.Menu m in MenuList) { CustomList<RuleDetails> tSROList = SecurityRuleDetailList.FindAll(f => f.ObjectID == m.MenuID && f.ApplicationID == m.ApplicationID); foreach (RuleDetails tSRO in tSROList) { m.CanInsert = tSRO.CanInsert; m.CanSelect = tSRO.CanSelect; m.CanUpdate = tSRO.CanUpdate; m.CanDelete = tSRO.CanDelete; } } HttpContext.Current.Session["SecurityRule_MenuList"] = MenuList; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "text/plain"; HttpContext.Current.Response.Write(response); HttpContext.Current.Response.Flush(); } catch (Exception ex) { throw (ex); } }