コード例 #1
0
ファイル: iMES_Frame.aspx.cs プロジェクト: wra222/testgit
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //解决跨域嵌套时iFrame子页面的Session无法访问
            Response.AddHeader("P3P", "CP=CAO PSA OUR");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(iMES_Frame));

            //Get customer
            String strCustomer = Request["customer"];
            userInfo.Customer = strCustomer;

            //Get token
            String strToken = Request["Token"];
            IToken token = (IToken)WebCommonMethod.deserialize(strToken);

            //Init logon user information
            AuthorityManager authorManager = new AuthorityManager();
            AccountInfo account = authorManager.getAccountByToken(token);

            //Modify: ITC-1103-0150
            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx
            //Vincent add application info
            userInfo.Application = account.Application;

            Session["UserId"] = userInfo.UserId;

            //Init treeview
            TreeViewControl treeVC = new TreeViewControl(userInfo);
            treeVC.TreeNodePopulate(treeFunction.Nodes, token);
            Session["iMES_treeNodes"] = treeVC.getTreeNodes();
        }
    }
コード例 #2
0
ファイル: AccountUser.cs プロジェクト: wra222/testgit
        public static UserAcountInfoDef GetLogonUser(String tokenString)
        {
            UserAcountInfoDef result = new UserAcountInfoDef();

            ISecurityManager securityManager = null;
            securityManager = RBPCAgent.getRBPCManager<ISecurityManager>();

            Token tokenObject = new Token();
            tokenObject = (Token)WebCommonMethod.deserialize(tokenString);
            AccountInfo accountInfo = securityManager.getAccountByToken(tokenObject);

            result.LogonUser = Null2String(accountInfo.Login); //itc\itcxxxxxx

            //string application = System.Configuration.ConfigurationManager.AppSettings.Get("RBPCApplication").ToString();
            //根据登入人取得权限列表
            //PermissionInfo[] accountInfoList = securityManager.getAuthorities(tokenObject,application);

            UserInfo userInfo = new UserInfo();
            userInfo.Login = accountInfo.Login;

            if (accountInfo.Login.Contains("\\"))
                userInfo.UserId = (String)accountInfo.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)accountInfo.Login;

            userInfo.UserName = (String)accountInfo.Name;
            userInfo.Department = (String)accountInfo.Department;
            userInfo.Domain = (String)accountInfo.Domain;
            userInfo.Company = (String)accountInfo.Company;
            userInfo.AccountId = (long)accountInfo.Id;
            userInfo.Login = (String)accountInfo.Login; //itc\itcxxxxxx
            ///////////////////////

            AuthorityManager manager = new AuthorityManager(userInfo);
            List<string> accountInfoList = manager.getPrimaryPermissionsByUserID(accountInfo.Login);

            for (int i = 0; i < accountInfoList.Count; i++)
            {
                if (accountInfoList[i] == "Authority Manager")
                {
                    result.IsAuthorityUsermanager = "True";
                }

                if (accountInfoList[i] == "Maintain")
                {
                    result.IsAuthorityDashboard = "True";
                }

            }

            //Session["UserId"] = userInfo.UserId;
            return result;
        }
コード例 #3
0
 private void checkAccount()
 {
     String strToken = Session["Token"].ToString();
     if (!string.IsNullOrEmpty(strToken))
     {
         IToken token = (IToken)WebCommonMethod.deserialize(strToken);
         //Init logon user information
         AuthorityManager authorManager = new AuthorityManager();
         try
         {
             com.inventec.RBPC.Net.entity.AccountInfo account = authorManager.getAccountByToken(token);
         }
         catch (Exception ex)
         {
             logger.Error(ex);
             //string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(languagePre + "SessionIsNull");
             string strMsg = "SessionIsNull";
             Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
         }
     }
     else
     {
         //string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(languagePre + "SessionIsNull");
         string strMsg = "SessionIsNull";
         Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
     }
 }
コード例 #4
0
ファイル: TreeViewControl.cs プロジェクト: wra222/testgit
 public TreeViewControl(UserInfo ui)
 {
     authorManager = new AuthorityManager(ui);
     treeNodes = new DataTable();
     userInfo = ui;
 }
コード例 #5
0
ファイル: iMES_Frame.aspx.cs プロジェクト: wra222/testgit
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            logger.Debug("Page_Load Begin");
            //解决跨域嵌套时iFrame子页面的Session无法访问
            Response.AddHeader("P3P", "CP=CAO PSA OUR");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(iMES_Frame));

            //Get customer
            String strCustomer = Request["customer"];
            userInfo.Customer = strCustomer;

            //Get token
            String strToken = Request["Token"];
            IToken token = (IToken)WebCommonMethod.deserialize(strToken);

            //Init logon user information
            AuthorityManager authorManager = new AuthorityManager();
            AccountInfo account = null;
            try
            {
                account = authorManager.getAccountByToken(token);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(Pre + "SessionIsNull");
                Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
            }
            logger.DebugFormat("IMES_Frame Token:{0}", strToken);
            //Modify: ITC-1103-0150
            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx
            //Vincent add application info
            userInfo.Application = account.Application;
           
            Session["UserId"] = userInfo.UserId;
            string SessionId = Request["SessionId"];

            logger.DebugFormat("IMES_Frame RBPC UserId:{0} AccountId:{1} UserName:{2} Login:{3} SessionId:{4}", 
                                            userInfo.UserId,
                                            account.Id.ToString(),
                                            account.Name,
                                            account.Login,
                                            SessionId);

            Session[SessionId] = SessionId;
            Session[SessionId + "-UserId"] = userInfo.UserId;
            //Session["Token"] = strToken;            
            //Init treeview
            TreeViewControl treeVC = new TreeViewControl(userInfo);
            treeVC.TreeNodePopulate(treeFunction.Nodes, token, SessionId);
            Session["iMES_treeNodes"] = treeVC.getTreeNodes();
            logger.Debug("Page_Load End");
        }
    }