private void SetPageInitPart() { ltrJQueryLibrary.Text = GetAdminJqueryLibraryPath(); CheckUserLogin(); string PageName = Path.GetFileNameWithoutExtension(PagePath); //adminImage.ImageUrl = GetUserImage; if (PageName != null) { SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(GetPortalID); templateFavicon = SetFavIcon(GetActiveTemplate); Extension = SageFrameSettingKeys.PageExtension; ApplicationController objAppController = new ApplicationController(); objSecurity.UpdateExpireTime(userName, GetPortalID); if (!objAppController.CheckRequestExtension(Request)) { SageInitPart(); } SetGlobalVariable(); bool IsAdmin = true; IncludeStartup(GetPortalID, pchHolder, IsAdmin); } else { Response.Redirect(PortalAPI.PageNotAccessibleURL); } }
private void SetPageInitPart() { ltrJQueryLibrary.Text = GetJqueryLibraryPath(); CheckUserLogin(); string PageName = "EditPages";// Path.GetFileNameWithoutExtension(PagePath); if (PageName != null) { SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(1); templateFavicon = SetFavIcon(GetActiveTemplate); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "templatefavicon", " var templateFavIcon='" + templateFavicon + "';", true); Extension = SageFrameSettingKeys.PageExtension; ApplicationController objAppController = new ApplicationController(); objSecurity.UpdateExpireTime(userName, 1); if (!objAppController.CheckRequestExtension(Request)) { SageInitPart(); } SetGlobalVariable(); bool IsAdmin = true; IncludeStartup(1, pchHolder, IsAdmin); } else { Response.Redirect(PortalAPI.PageNotAccessibleURL); } }
protected void Page_Load(object sender, EventArgs e) { Extension = SageFrameSettingKeys.PageExtension; SageFrameConfig sfConfig = new SageFrameConfig(); userName = SecurityPolicy.GetUser(GetPortalID); IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls); if (!IsPostBack) { profileText = GetSageMessage("LoginStatus", "MyProfile"); Literal lnkProfileUrl = (Literal)LoginView1.TemplateControl.FindControl("lnkProfileUrl"); RegisterURL = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalRegistrationPage) + SageFrameSettingKeys.PageExtension; if (sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalShowProfileLink) == "1") { if (IsUseFriendlyUrls) { if (GetPortalID > 1) { profileURL = "<a href='" + ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalUserProfilePage) + SageFrameSettingKeys.PageExtension) + "'>" + profileText + "</a>"; } else { profileURL = "<a href='" + ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalUserProfilePage) + SageFrameSettingKeys.PageExtension) + "'>" + profileText + "</a>"; } } else { profileURL = "<a href='" + ResolveUrl("~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalUserProfilePage)) + "'>" + profileText + "</a>"; } } else { profileURL = ""; } if (IsUseFriendlyUrls) { if (GetPortalID > 1) { RegisterURL = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalRegistrationPage) + SageFrameSettingKeys.PageExtension); } else { RegisterURL = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalRegistrationPage) + SageFrameSettingKeys.PageExtension); } } else { RegisterURL = ResolveUrl("~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalRegistrationPage)); } } }
protected void Page_Load(object sender, EventArgs e) { IncludeLanguageJS(); appPath = GetApplicationName; SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(GetPortalID); Extension = SageFrameSettingKeys.PageExtension; if (!IsPostBack) { // BindThemes(); //BindLayouts(); //BindValues(); hlnkDashboard.Visible = false; SageFrameConfig conf = new SageFrameConfig(); string ExistingPortalShowProfileLink = conf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink); lnkAccount.NavigateUrl = GetProfileLink(); if (ExistingPortalShowProfileLink == "1") { lnkAccount.Visible = true; } else { lnkAccount.Visible = false; } SageFrame.Application.Application app = new SageFrame.Application.Application(); lblVersion.Text = string.Format("V {0}", app.FormatShortVersion(app.Version, true)); } hypLogo.NavigateUrl = GetPortalAdminPage(); hypLogo.ImageUrl = appPath + "/Administrator/Templates/Default/images/sagecomers-logoicon.png"; RoleController _role = new RoleController(); string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(','); if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()) || roles.Contains(SystemSetting.SITEADMIN.ToLower())) { hlnkDashboard.Visible = true; hlnkDashboard.NavigateUrl = GetPortalAdminPage(); cpanel.Visible = true; AspxAdminNotificationView1.Visible = true; IsAdmin = true; } else { cpanel.Visible = false; } }
private static bool CheckAuth(int portalId, int userModuleId, string uName, string authToken, string permType) { string spName = ""; spName = permType == "v" ? "usp_CheckModulePermissionView" : "usp_CheckModulePermissionEdit"; SecurityPolicy objSecurity = new SecurityPolicy(); string userName = objSecurity.GetUser(portalId, authToken); if (userName == "superuser") { return(true); } else if (permType == "e" && uName != "anonymoususer" && uName == userName) { List <KeyValuePair <string, object> > para = new List <KeyValuePair <string, object> >(); para.Add(new KeyValuePair <string, object>("@UserModuleID", userModuleId)); para.Add(new KeyValuePair <string, object>("@PortalID", portalId)); para.Add(new KeyValuePair <string, object>("@userName", uName)); SQLHandler handler = new SQLHandler(); int flag = handler.ExecuteAsScalar <int>(spName, para); if (flag == 1) { return(true); } else { return(false); } } else if (permType == "v" && uName == userName) { List <KeyValuePair <string, object> > para = new List <KeyValuePair <string, object> >(); para.Add(new KeyValuePair <string, object>("@UserModuleID", userModuleId)); para.Add(new KeyValuePair <string, object>("@PortalID", portalId)); para.Add(new KeyValuePair <string, object>("@userName", uName)); SQLHandler handler = new SQLHandler(); int flag = handler.ExecuteAsScalar <int>(spName, para); if (flag == 1) { return(true); } else { return(false); } } return(false); }
protected void Page_Load(object sender, EventArgs e) { IncludeLanguageJS(); appPath = GetApplicationName; SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(GetPortalID); Extension = SageFrameSettingKeys.PageExtension; IncludeJs("topstickybar", "/js/TopStickyBar.js"); if (!IsPostBack) { // BindThemes(); //BindLayouts(); //BindValues(); hlnkDashboard.Visible = false; SageFrameConfig conf = new SageFrameConfig(); string ExistingPortalShowProfileLink = conf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink); lnkAccount.NavigateUrl = GetProfileLink(); if (ExistingPortalShowProfileLink == "1") { lnkAccount.Visible = true; } else { lnkAccount.Visible = false; } SageFrame.Version.SageFrameVersion app = new SageFrame.Version.SageFrameVersion(); lblVersion.Text = string.Format("V {0}", app.FormatShortVersion(app.Version, true)); } hypLogo.NavigateUrl = GetPortalAdminPage(); hypLogo.ImageUrl = appPath + "/Administrator/Templates/Default/images/sageframe.png"; RoleController _role = new RoleController(); bool isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID); if (isDashboardAccessible) { hlnkDashboard.Visible = true; hlnkDashboard.NavigateUrl = GetPortalAdminPage(); cpanel.Visible = true; } else { cpanel.Visible = false; } }
private string GetUserName() { try { SecurityPolicy sp = new SecurityPolicy(); string userName = sp.GetUser(GetPortalID); if (userName != ApplicationKeys.anonymousUser) { return(userName); } else { return(ApplicationKeys.anonymousUser); } } catch { return(ApplicationKeys.anonymousUser); } }
/// <summary> /// Returns username /// </summary> /// <param name="portalID">portalID</param> /// <param name="authToken"> authentication token</param> /// <returns>Returns userName</returns> private string GetUsername(int portalID, string authToken) { try { SecurityPolicy objSecurity = new SecurityPolicy(); string userName = objSecurity.GetUser(portalID, authToken); if (userName != ApplicationKeys.anonymousUser) { return(userName); } else { return(ApplicationKeys.anonymousUser); } } catch { return(ApplicationKeys.anonymousUser); } }
private void SetPageInitPart() { string PageName = Path.GetFileNameWithoutExtension(PagePath); if (PageName != null) { userName = SecurityPolicy.GetUser(GetPortalID); templateFavicon = SetFavIcon(GetActiveTemplate); Extension = SageFrameSettingKeys.PageExtension; ApplicationController objAppController = new ApplicationController(); if (!objAppController.CheckRequestExtension(Request)) { SageInitPart(); } SetGlobalVariable(); bool IsAdmin = true; IncludeStartup(GetPortalID, pchHolder, IsAdmin); } else { Response.Redirect(PortalAPI.PageNotAccessibleURL); } }
protected void Page_Load(object sender, EventArgs e) { Extension = SageFrameSettingKeys.PageExtension; SageFrameConfig sfConfig = new SageFrameConfig(); SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(GetPortalID); if (!IsPostBack) { profileText = GetSageMessage("LoginStatus", "MyProfile"); Literal lnkProfileUrl = (Literal)LoginView1.TemplateControl.FindControl("lnkProfileUrl"); RegisterURL = sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalRegistrationPage) + SageFrameSettingKeys.PageExtension; if (sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink) == "1") { if (!IsParent) { profileURL = "<a href='" + GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalUserProfilePage) + SageFrameSettingKeys.PageExtension + "'>" + profileText + "</a>"; } else { profileURL = "<a href='" + GetParentURL + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalUserProfilePage) + SageFrameSettingKeys.PageExtension + "'>" + profileText + "</a>"; } } else { profileURL = ""; } if (!IsParent) { RegisterURL = GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalRegistrationPage) + SageFrameSettingKeys.PageExtension; } else { RegisterURL = GetParentURL + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalRegistrationPage) + SageFrameSettingKeys.PageExtension; } } }
protected void Page_Load(object sender, EventArgs e) { IncludeLanguageJS(); appPath = GetApplicationName; userName = SecurityPolicy.GetUser(GetPortalID); Extension = SageFrameSettingKeys.PageExtension; if (!IsPostBack) { // BindThemes(); //BindLayouts(); //BindValues(); hlnkDashboard.Visible = false; SageFrameConfig conf = new SageFrameConfig(); string ExistingPortalShowProfileLink = conf.GetSettingsByKey(SageFrameSettingKeys.PortalShowProfileLink); lnkAccount.NavigateUrl = GetProfileLink(); if (ExistingPortalShowProfileLink == "1") { } else { } } RoleController _role = new RoleController(); string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(','); if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()) || roles.Contains(SystemSetting.SITEADMIN.ToLower())) { hlnkDashboard.Visible = true; hlnkDashboard.NavigateUrl = GetPortalAdminPage(); cpanel.Visible = true; } else { cpanel.Visible = false; } }
//private string GetUpgraderUrl() //{ // string upgradeLink = string.Empty; // if (GetPortalID > 1) // { // upgradeLink = "~/portal/" + GetPortalSEOName + "/Admin/sfUpgrader" + Extension; // } // else // { // upgradeLink = "~/Admin/sfUpgrader" + Extension; // } // return upgradeLink; //} private void SetPortalCofig() { Hashtable hstPortals = GetPortals(); SageUserControl suc = new SageUserControl(); suc.PagePath = PagePath; int portalID = 1; #region "Get Portal SEO Name and PortalID" if (string.IsNullOrEmpty(Request.QueryString["ptSEO"])) { if (string.IsNullOrEmpty(PortalSEOName)) { PortalSEOName = GetDefaultPortalName(hstPortals, 1); } else if (!hstPortals.ContainsKey(PortalSEOName.ToLower().Trim())) { PortalSEOName = GetDefaultPortalName(hstPortals, 1); } else { portalID = int.Parse(hstPortals[PortalSEOName.ToLower().Trim()].ToString()); } } else { PortalSEOName = Request.QueryString["ptSEO"].ToString().ToLower().Trim(); portalID = Int32.Parse(Request.QueryString["ptlid"].ToString()); } #endregion suc.SetPortalSEOName(PortalSEOName.ToLower().Trim()); Session[SessionKeys.SageFrame_PortalSEOName] = PortalSEOName.ToLower().Trim(); Session[SessionKeys.SageFrame_PortalID] = portalID; Session[SessionKeys.SageFrame_AdminTheme] = ThemeHelper.GetAdminTheme(GetPortalID, GetUsername); Globals.sysHst[ApplicationKeys.ActiveTemplate + "_" + portalID] = TemplateController.GetActiveTemplate(GetPortalID).TemplateSeoName; Globals.sysHst[ApplicationKeys.ActivePagePreset + "_" + portalID] = PresetHelper.LoadActivePagePreset(GetActiveTemplate, GetPageSEOName(Request.Url.ToString())); suc.SetPortalID(portalID); SetPortalID(portalID); #region "Set user credentials for modules" SecurityPolicy objSecurity = new SecurityPolicy(); if (objSecurity.GetUser(GetPortalID) != string.Empty) { SettingProvider objSP = new SettingProvider(); SageFrameConfig sfConfig = new SageFrameConfig(); string strRoles = string.Empty; List <SageUserRole> sageUserRolles = objSP.RoleListGetByUsername(objSecurity.GetUser(GetPortalID), GetPortalID); if (sageUserRolles != null) { foreach (SageUserRole userRole in sageUserRolles) { strRoles += userRole.RoleId + ","; } } if (strRoles.Length > 1) { strRoles = strRoles.Substring(0, strRoles.Length - 1); } if (strRoles.Length > 0) { SetUserRoles(strRoles); } } #endregion }
private void SetPortalCofig() { Hashtable hstPortals = GetPortals(); SageUserControl suc = new SageUserControl(); int portalID = 1; #region "Get Portal SEO Name and PortalID" if (string.IsNullOrEmpty(Request.QueryString["ptSEO"])) { if (string.IsNullOrEmpty(PortalSEOName)) { PortalSEOName = GetDefaultPortalName(hstPortals, 1);// 1 is for Default Portal } else if (!hstPortals.ContainsKey(PortalSEOName.ToLower().Trim())) { PortalSEOName = GetDefaultPortalName(hstPortals, 1);// 1 is for Default Portal } else { portalID = int.Parse(hstPortals[PortalSEOName.ToLower().Trim()].ToString()); } } else { PortalSEOName = Request.QueryString["ptSEO"].ToString().ToLower().Trim(); portalID = Int32.Parse(Request.QueryString["ptlid"].ToString()); } #endregion suc.SetPortalSEOName(PortalSEOName.ToLower().Trim()); Session[SessionKeys.SageFrame_PortalSEOName] = PortalSEOName.ToLower().Trim(); Session[SessionKeys.SageFrame_PortalID] = portalID; string tempName = /*activeTemplate;// */ TemplateController.GetActiveTemplate(currentportalID).TemplateSeoName; string tempPath = Decide.IsTemplateDefault(tempName) ? Utils.GetTemplatePath_Default(tempName) : Utils.GetTemplatePath(tempName); if (!Directory.Exists(tempPath)) { tempName = "default"; } Globals.sysHst[ApplicationKeys.ActiveTemplate + "_" + currentportalID] = tempName; //Globals.sysHst[ApplicationKeys.ActivePagePreset + "_" + currentportalID] = LoadActivePagePreset() || PresetHelper.LoadActivePagePreset(tempName, GetPageSEOName(Request.Url.ToString())); LoadActivePagePreset(); suc.SetPortalID(portalID); SetPortalID(portalID); #region "Set user credentials for modules" if (SecurityPolicy.GetUser(GetPortalID) != string.Empty) { SettingProvider objSP = new SettingProvider(); SageFrameConfig sfConfig = new SageFrameConfig(); if (SecurityPolicy.GetUser(GetPortalID) != string.Empty) { string strRoles = string.Empty; List <SageUserRole> sageUserRolles = objSP.RoleListGetByUsername(SecurityPolicy.GetUser(GetPortalID), currentportalID); if (sageUserRolles != null) { foreach (SageUserRole userRole in sageUserRolles) { strRoles += userRole.RoleId + ","; } } if (strRoles.Length > 1) { strRoles = strRoles.Substring(0, strRoles.Length - 1); } if (strRoles.Length > 0) { SetUserRoles(strRoles); } } } #endregion }
protected void Page_Load(object sender, EventArgs e) { IncludeLanguageJS(); appPath = GetApplicationName; SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(GetPortalID); Extension = SageFrameSettingKeys.PageExtension; IncludeJs("topstickybar", "/js/popup.js", "/js/TopStickyBar.js"); if (!IsPostBack) { // BindThemes(); //BindLayouts(); //BindValues(); hlnkDashboard.Visible = false; hypEdit.Visible = false; SageFrameConfig conf = new SageFrameConfig(); string ExistingPortalShowProfileLink = conf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink); lnkAccount.NavigateUrl = GetProfileLink(); if (ExistingPortalShowProfileLink == "1") { lnkAccount.Visible = true; } else { lnkAccount.Visible = false; } SageFrame.Version.SageFrameVersion app = new SageFrame.Version.SageFrameVersion(); string value = SageFrame.Utilities.Config.GetVersionConfigSettingValue("SageFrameVersionLoad"); if (!IsPostBack) { if (value.ToLower() == "true") { showVersion(); } else { hideVersion(); } } } hypEdit.NavigateUrl = GetEditURL(); string LogoPath = Server.MapPath(appPath + "~/Administrator/Templates/Default/images/SageLogo.png"); if (File.Exists(LogoPath)) { hypLogo.NavigateUrl = GetPortalAdminPage(); hypLogo.ImageUrl = appPath + "/Administrator/Templates/Default/images/SageLogo.png"; if (GetUsername != SystemSetting.SYSTEM_USER) { lblHideLogo.Visible = false; } } else { divLogo.Visible = false; } RoleController _role = new RoleController(); bool isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID); if (isDashboardAccessible) { hlnkDashboard.Visible = true; hypEdit.Visible = true; hlnkDashboard.NavigateUrl = GetPortalAdminPage(); cpanel.Visible = true; GetNotInstallModules(); htpTemplates.NavigateUrl = GetHostURL() + "/Admin/Templates.aspx"; htpTemplates.Visible = true; } else { cpanel.Visible = false; } }