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;
        }
        
    }
        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;
                }

            }
        }
        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;
        }
 /// <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;
     }
 }
예제 #5
0
 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);// 1 is default parent PortalID 
         }
         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
 }
예제 #6
0
        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;
            }

        }
        public void GetPortalCommonInfo(out int StoreID, out int PortalID, out string UserName, out string CultureName)
        {
            StoreID = 0;
            if (HttpContext.Current.Session[SessionKeys.SageFrame_StoreID] != null &&
                   HttpContext.Current.Session[SessionKeys.SageFrame_StoreID].ToString() != string.Empty)
            {
                StoreID = Int32.Parse(HttpContext.Current.Session[SessionKeys.SageFrame_StoreID].ToString());
            }
            PortalID = 0;
            if (HttpContext.Current.Session[SessionKeys.SageFrame_PortalID] != null &&
                   HttpContext.Current.Session[SessionKeys.SageFrame_PortalID].ToString() != string.Empty)
            {
                PortalID = Int32.Parse(HttpContext.Current.Session[SessionKeys.SageFrame_PortalID].ToString());
            }
            try
            {
                SecurityPolicy objSecurity = new SecurityPolicy();
                UserName = objSecurity.GetUser(GetPortalID);

            }
            catch
            {
                UserName = ApplicationKeys.anonymousUser;
            }
            CultureName = CultureInfo.CurrentCulture.Name;
        }
예제 #8
0
        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);
            }
        }