public List <SinoMenuItem> GetAllMenus(string _postID) { SinoSZTicketInfo _currentUserInfo = CallContext.GetData("UserIdentity") as SinoSZTicketInfo; string _logonName = _currentUserInfo.Name; SinoUser _userinfo = LogonUserLib.GetUserInfo(_logonName); bool _find = false; foreach (SinoPost _sp in _userinfo.Posts) { if (_sp.PostID == _postID) { _find = true; break; } } if (_find) { return(MenuFactory.GetAllMenus(_postID)); } else { throw new Exception("用户不具有此岗位授权!"); } return(null); }
/// <summary> /// 登录系统 /// </summary> /// <param name="_sysid"></param> /// <param name="_name"></param> /// <param name="_mwpass"></param> /// <returns></returns> public SinoUser LoginSys(string _sysid, string _name, string _mwpass, string CheckType) { //暂未实现 C_SignOnBase _SignOnControler = new C_SignOnBase(); string _pass = _mwpass; string _ipaddr = WCFClientInfo.IPAddr; string _hostName = ""; try { _hostName = Dns.GetHostEntry(_ipaddr).HostName; } catch (Exception ex) { string _err = ex.Message; _hostName = _ipaddr; } SinoUser _su = new SinoUser(); _su.LoginName = _name; _su.UserName = "******"; _su.DwName = "海关总署缉私局"; string _yhid = ""; if (_name.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "NONE": break; case "TESTPASS": _SignOnControler = new C_SignOnTestPass(); break; case "BASE": //采用综合系统验证功能 _SignOnControler = new C_SignOnFromJS(); break; case "CUPPAPASSPORT": _SignOnControler = new C_SignOnCUPPAPassport(); break; default: _SignOnControler = new C_SignOnFromJS(); break; } } else { _SignOnControler = new C_SignOnAdmin(); } bool _signOn = _SignOnControler.Check(_name, _pass, CheckType); if (_signOn) { //写入用户操作日志 } else { //写入用户操作日志 throw new Exception("用户名/口令不正确!"); } if (_name.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "CUPPAPASSPORT": #if DEBUG _yhid = C_GetUserInfo.GetYHIDByName(_name, _pass); #else _yhid = C_GetUserInfo_Cuppa.GetYHIDByName(_name, CheckType); #endif break; default: _yhid = C_GetUserInfo.GetYHIDByName(_name, _pass); break; } } else { _yhid = "0"; } if (_yhid != "-1") { _su = C_GetUserInfo.GetUserInfoByYHID(_yhid); } else { _su = C_GetUserInfo.GetNoRegisterUserByUserName(_name); } //SystemLogWriter.WriteLog(string.Format("取{0}的用户信息成功!", _name), EventLogEntryType.Information); //写入用户操作日志 //SQLCommon.WriteUserLog(decimal.Parse(_yhid), "系统登录", string.Format("{1}使用用户名{0}登录成功!", _name, _su.UserName), 1, _ipaddr, _hostName); //CreateTicket(ref _su, _ipaddr); _su.EncryptedTicket = TicketLib.AddTicket(_yhid, _ipaddr); //SystemLogWriter.WriteLog(string.Format("生成{0}的验证票据成功!", _name), EventLogEntryType.Information); _su.IPAddress = _ipaddr; _su.SystemID = ConfigFile.SystemID; LogonUserLib.AddUserInfo(_su.UserID, _su); //SystemLogWriter.WriteLog(string.Format("添加用户{0}到验证用户列表成功!", _name), EventLogEntryType.Information); return(_su); }
/// <summary> /// 登录系统 /// </summary> /// <param name="_sysid"></param> /// <param name="_name"></param> /// <param name="_mwpass"></param> /// <returns></returns> public SinoUser LoginSys(string _sysid, string _name, string _mwpass, string _type) { //暂未实现 C_SignOnBase _SignOnControler = new C_SignOnBase(); string _pass = _mwpass; string _ipaddr = CallContext.GetData("ClientIP").ToString(); string _hostName = ""; try { _hostName = Dns.GetHostEntry(_ipaddr).HostName; } catch { _hostName = _ipaddr; } SinoUser _su = new SinoUser(); _su.LoginName = _name; _su.UserName = "******"; _su.DwName = "海关总署缉私局"; string _yhid = ""; if (_name.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "NONE": break; case "TESTPASS": _SignOnControler = new C_SignOnTestPass(); break; case "BASE": //采用综合系统验证功能 _SignOnControler = new C_SignOnFromJS(); break; case "OGUPERMISSION": //采用海关通用授权平台验证WEB验证的功能(不再使用) _SignOnControler = new C_SignOnOGUPermission(); break; case "HGAD": //采用域验证的方式 _SignOnControler = new C_SignOnHGAD(); break; case "QDHB": _SignOnControler = new C_SignOnQDHBService(); break; case "HBSERVICE": _SignOnControler = new C_SignOnHBSecurityService(); break; case "CUPPAPASSPORT": _SignOnControler = new C_SignOnCUPPAPassport(); break; default: _SignOnControler = new C_SignOnFromJS(); break; } } else { _SignOnControler = new C_SignOnAdmin(); } bool _signOn = _SignOnControler.Check(_name, _pass, _type); if (!_signOn) { throw new Exception("用户名/口令不正确!"); } //写入用户操作日志 //SystemLogWriter.WriteLog(string.Format("验证{0}的口令成功!", _name), EventLogEntryType.Information); if (_name.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "CUPPAPASSPORT": string _atype = C_SignOnCUPPAPassport.GetAuthType(_type); _yhid = C_GetUserInfo_Cuppa.GetYHIDByName(_name, _atype); break; default: _yhid = C_GetUserInfo.GetYHIDByName(_name, _pass); break; } } else { _yhid = "0"; } if (_yhid != "-1") { _su = C_GetUserInfo.GetUserInfoByYHID(_yhid); } else { _su = C_GetUserInfo.GetNoRegisterUserByUserName(_name); } //同步登录名信息用(处理三统一的问题) _su.LoginName = _name; //SystemLogWriter.WriteLog(string.Format("取{0}的用户信息成功!", _name), EventLogEntryType.Information); //写入用户操作日志 //SQLCommon.WriteUserLog(decimal.Parse(_yhid), "系统登录", string.Format("{1}使用用户名{0}登录成功!", _name, _su.UserName), 1, _ipaddr, _hostName); //CreateTicket(ref _su, _ipaddr); _su.EncryptedTicket = TicketLib.AddTicket(_name, _ipaddr); //SystemLogWriter.WriteLog(string.Format("生成{0}的验证票据成功!Address={1}", _name, _ipaddr), EventLogEntryType.Information); _su.IPAddress = _ipaddr; _su.SystemID = ConfigFile.SystemID; LogonUserLib.AddUserInfo(_su.LoginName, _su); //SystemLogWriter.WriteLog(string.Format("添加用户{0}到验证用户列表成功!", _name), EventLogEntryType.Information); return(_su); }