/*====================================================*/ public override void CorePage_Load(Object aSrc, EventArgs aEvent) { bool AdminKey = false; if (ModuleUser == null || WebSession == null) { Response.Redirect(WebAppl.LogoutURL); } if (ModuleUser.MasterNavElement != null && !WebSession.HasAdminUser) { XmlNodeList aNodeList = ModuleNode.SelectNodes("AdminNavigation/NavElement"); foreach (XmlNode aNode in aNodeList) { cNavElement aAdminNavElement = ModuleUser.MasterNavElement.Find_ChildElement(cXMLDoc.AttributeToString(aNode, "Key")); if (aAdminNavElement.Key == NavKey) { AdminKey = true; break; } foreach (cXMLNavElement aNavElement in aAdminNavElement.Elements) { if (aNavElement.Key == NavKey) { AdminKey = true; break; } } } if (AdminKey && !WebSession.HasAdminUser) { String aError = System.Configuration.ConfigurationSettings.AppSettings["PermissionErrorPage"]; if (aError != "") { String aRetURL = cWebLib.Get_QueryString(Request, "ReturnURL", ""); WebSession.CurrentUrl = aRetURL; String aUrl = WebAppl.Build_RootURL(aError); Response.Redirect(aUrl); } else { WebSession.LogoutAllUsers(); Response.Redirect(WebAppl.LogoutURL); } } base.CorePage_Load(aSrc, aEvent); } else { base.CorePage_Load(aSrc, aEvent); } // Update Activity Log }
/*----------------------------------------------------*/ public void Validate_Admin_NavigationItem() { if (ModuleUser.MasterNavElement != null) { XmlNodeList aNodeList = ModuleNode.SelectNodes("AdminNavigation/NavElement"); foreach (XmlNode aNode in aNodeList) { Set_Admin_NavigationItem(cXMLDoc.AttributeToString(aNode, "Key")); } } }
/*----------------------------------------------------*/ //hides navigation item if it does not apply to ModuleUser's person roles public void Validate_PersonRole_NavigationItem() { XmlNodeList aNavigationNodeList; XmlNodeList aRolesNodeList; cNavElement aCurNavElement; bool aBool; aNavigationNodeList = ModuleNode.SelectNodes("Navigation/NavElement"); foreach (XmlNode aNavElementNode in aNavigationNodeList) { aBool = false; aRolesNodeList = aNavElementNode.SelectNodes("PersonRole"); if (aRolesNodeList.Count != 0) { foreach (XmlNode aRoleNode in aRolesNodeList) { foreach (cDataObject aDataObject in ModuleUser.PersonRoles) { if (aDataObject.GetPropertyInt("WfTaskRoleID") == cXMLDoc.AttributeToInt(aRoleNode, "Key")) { aBool = true; break; } } } //if current user does not have a valid role for the navigation element, set visible=false if (aBool == false) { aCurNavElement = ModuleUser.MasterNavElement.Find_ChildElement(cXMLDoc.AttributeToString(aNavElementNode, "Key")); if (aCurNavElement != null) { aCurNavElement.Visible = false; } } } } }