public static void RemoveAllCache() { if (AccreditSection.GetConfig().AccreditSettings.ClearLocalCache) { if (false == File.Exists(InnerCacheHelper.cacheDependenceFile)) { File.Create(InnerCacheHelper.cacheDependenceFile); } using (StreamWriter writer = new StreamWriter(InnerCacheHelper.cacheDependenceFile, true)) { writer.WriteLine(Guid.NewGuid().ToString()); writer.Flush(); } } if (AccreditSection.GetConfig().AccreditSettings.ClearRemoteCache) { string[] cacheQueueType = { "MCS.Library.OGUPermission.OguObjectIDCache, MCS.Library.OGUPermission", "MCS.Library.OGUPermission.OguObjectFullPathCache, MCS.Library.OGUPermission", "MCS.Library.OGUPermission.OguObjectLogOnNameCache, MCS.Library.OGUPermission" }; CacheNotifyData[] data = new CacheNotifyData[cacheQueueType.Length]; for (int i = 0; i < cacheQueueType.Length; i++) { data[i] = new CacheNotifyData(); data[i].CacheQueueTypeDesp = cacheQueueType[i]; data[i].NotifyType = CacheNotifyType.Clear; } UdpCacheNotifier.Instance.SendNotifyAsync(data); MmfCacheNotifier.Instance.SendNotify(data); } }
/// <summary> /// 获取当前登录用户在当前“机构人员管理系统”中的全部权限 /// </summary> /// <returns></returns> public static string GetOGUPemission() { string strResult = "setNoPermission"; bool IsCustomsAuthentication = AccreditSection.GetConfig().AccreditSettings.CustomsAuthentication; if (IsCustomsAuthentication) { DataSet ds = SecurityCheck.GetUserPermissions(GlobalInfo.UserLogOnInfo.UserLogOnName, AccreditResource.AppCodeName, UserValueType.LogonName, RightMaskType.App, DelegationMaskType.All); strResult = string.Empty; foreach (DataRow row in ds.Tables[0].Rows) { if (strResult.Length > 0) { strResult += ","; } strResult += OGUCommonDefine.DBValueToString(row["CODE_NAME"]); } } return(strResult); }
private XmlDocument GetImpersonateUserDocument() { if (LogOnUserInfo.ImpersonateUserDocument == null) { string filePath = AccreditSection.GetConfig().AccreditSettings.ImpersonateUser; if (false == string.IsNullOrEmpty(filePath)) { bool IsFileExist = false; if (false == File.Exists(filePath)) { if (HttpContext.Current != null) { filePath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + filePath; } else { filePath = AppDomain.CurrentDomain.BaseDirectory + filePath; } IsFileExist = File.Exists(filePath); } if (IsFileExist) { LogOnUserInfo.ImpersonateUserDocument = XmlHelper.LoadDocument(filePath); } } } return(LogOnUserInfo.ImpersonateUserDocument); }
protected void Page_Load(object sender, System.EventArgs e) { secFrm.Value = Request.QueryString["secFrm"]; int iMaxCount = AccreditSection.GetConfig().AccreditSettings.AppListMaxCount; listMaxCount.Value = iMaxCount.ToString(); roleCodeName.Value = Request.QueryString["roleCodeName"]; }
private void CheckPermission(string strOPType) { bool bPermission = true; bool isCustomsAuthentication = AccreditSection.GetConfig().AccreditSettings.CustomsAuthentication; if (isCustomsAuthentication) { switch (strOPType) { case "Update": bPermission = SecurityCheck.DoesUserHasPermissions(LogOnUserInfo.UserLogOnName, AccreditResource.AppCodeName, AccreditResource.Func_ModifyUser, UserValueType.LogonName, DelegationMaskType.All); if (bPermission) { DataSet ds = SecurityCheck.GetUserFunctionsScopes(LogOnUserInfo.UserLogOnName, AccreditResource.AppCodeName, AccreditResource.Func_ModifyUser, UserValueType.LogonName, DelegationMaskType.All, ScopeMaskType.All); string strObjGuid = (string)GetRequestData("objGuid", string.Empty); bPermission = IsObjectIsIncludeInObjects("USERS", strObjGuid, SearchObjectColumn.SEARCH_GUID, ds); } break; case "AddSideline": case "Insert": bPermission = SecurityCheck.DoesUserHasPermissions(LogOnUserInfo.UserLogOnName, AccreditResource.AppCodeName, AccreditResource.Func_CreateUser, UserValueType.LogonName, DelegationMaskType.All); ExceptionHelper.FalseThrow(bPermission, "对不起,您没有权限创建新的“用户”!"); if (bPermission) { DataSet ds = SecurityCheck.GetUserFunctionsScopes(LogOnUserInfo.UserLogOnName, AccreditResource.AppCodeName, AccreditResource.Func_CreateUser, UserValueType.LogonName, DelegationMaskType.All, ScopeMaskType.All); ExceptionHelper.FalseThrow(IsObjectIsIncludeInObjects("ORGANIZATIONS", parentAllPathName.Value, SearchObjectColumn.SEARCH_ALL_PATH_NAME, ds), "对不起,您没有在当前机构中创建“用户”的权限!"); } break; } } opPermission.Value = bPermission.ToString().ToLower(); }
/// <summary> /// 根据查询条件查询系统中符合条件的所有对象 /// </summary> private void QueryObjForOGUInput() { XmlElement root = (XmlElement)_XmlRequest.DocumentElement.FirstChild; string strLikeName = root.GetAttribute("likeName"); ExceptionHelper.TrueThrow(strLikeName.Length == 0, "对不起,查询条件不能为空!"); int iListType = 0; string strQueryObjMask = root.GetAttribute("queryObjMask"); if (strQueryObjMask.Length == 0) { iListType = (int)ListObjectType.USERS; } else { iListType = int.Parse(strQueryObjMask); } string strRootOrg = root.GetAttribute("rootOrg"); if (strRootOrg.Length == 0) { strRootOrg = AccreditSection.GetConfig().AccreditSettings.OguRootName; } string strOrgAccessLevel = root.GetAttribute("orgAccessLevel"); string strUserAccesslevel = root.GetAttribute("userAccessLevel"); string strAttr = root.GetAttribute("extAttr"); DataSet ds = OGUReader.QueryOGUByCondition(strRootOrg, SearchObjectColumn.SEARCH_ALL_PATH_NAME, strLikeName, false, strOrgAccessLevel, strUserAccesslevel, strAttr, iListType); _XmlResult = InnerCommon.GetXmlDocAttr(ds.Tables[0], "OBJECTCLASS"); Debug.WriteLine(_XmlResult.OuterXml, "Result"); }
private void WriteInputStream(SoapMessage message) { Copy(this.oldStream, this.newStream); if (AccreditSection.GetConfig().AccreditSettings.SoapRecord & message is SoapServerMessage) { this.newStream.Position = 0; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(new StreamReader(this.newStream)); if (AccreditSection.GetConfig().AccreditSettings.SoapRecordInput) { this.soapRecorder.InputStream = xmlDoc.OuterXml; } this.soapRecorder.SoapMethod += "." + xmlDoc.DocumentElement.FirstChild.FirstChild.LocalName; } this.newStream.Position = 0; }
public static DependencyBase PrepareDependency() { if (false == File.Exists(InnerCacheHelper.cacheDependenceFile)) { lock (InnerCacheHelper.syncFile) { if (false == File.Exists(InnerCacheHelper.cacheDependenceFile)) { File.Create(InnerCacheHelper.cacheDependenceFile); } } } TimeSpan ts = new TimeSpan(0, 1, 0); MixedDependency result = new MixedDependency( new FileCacheDependency(InnerCacheHelper.cacheDependenceFile), new SlidingTimeDependency(new TimeSpan(AccreditSection.GetConfig().AccreditSettings.CacheSlideMinutes *ts.Ticks))); return(result); }
/// <summary> /// 结合系统中的隐藏配置,生成对系统中针对数据查询的条件 /// </summary> /// <param name="strOriginalHideType">原始的系统配置</param> /// <returns>结合系统中的隐藏配置,生成对系统中针对数据查询的条件</returns> internal static string GetHideType(string strOriginalHideType) { string strResult = strOriginalHideType; //string strAutoHide = (new SysConfig()).GetDataFromConfig("AutohideType", string.Empty); string strAutoHide = AccreditSection.GetConfig().AccreditSettings.AutohideType; if (strOriginalHideType.Length == 0) { strResult = strAutoHide; } else { if (strAutoHide.Length > 0) { string[] strArrs = strOriginalHideType.Split(',', ' ', ';'); string[] strAutoArrs = strAutoHide.Split(',', ' ', ';'); for (int i = 0; i < strAutoArrs.Length; i++) { bool bAddAuto = true; for (int j = 0; j < strArrs.Length; j++) { if (strArrs[j] == strAutoArrs[i]) { bAddAuto = false; } } if (bAddAuto) { strResult += "," + strAutoArrs[i]; } } } } return(strResult); }
protected void Page_Load(object sender, System.EventArgs e) { Response.Cache.SetNoStore(); string strGroupGuid = (string)GetRequestData("Guid", string.Empty); ExceptionHelper.TrueThrow(strGroupGuid == string.Empty, "对不起,没有确定的人员组标识!"); groupGuid.Value = strGroupGuid; using (DbContext context = DbContext.GetContext(AccreditResource.ConnAlias)) { DataSet ds = OGUReader.GetObjectsDetail("GROUPS", strGroupGuid, SearchObjectColumn.SEARCH_GUID, string.Empty, SearchObjectColumn.SEARCH_NULL); GroupDisplayName.Text = OGUCommonDefine.DBValueToString(ds.Tables[0].Rows[0]["DISPLAY_NAME"]); userPermission.Value = classLib.OGUUserPermission.GetOGUPemission(); } txtPageSize.Value = AccreditSection.GetConfig().AccreditSettings.GroupUsersPageSize.ToString(); }
private void WriteOutputStream(SoapMessage message) { this.newStream.Position = 0; Copy(this.newStream, this.oldStream); if (AccreditSection.GetConfig().AccreditSettings.SoapRecord & message is SoapServerMessage) { if (AccreditSection.GetConfig().AccreditSettings.SoapRecordOutput) { this.newStream.Position = 0; TextReader reader = new StreamReader(this.newStream); this.soapRecorder.OutputStream = reader.ReadToEnd(); } this.soapRecorder.EndDate = DateTime.Now; if (HttpContext.Current != null) { this.soapRecorder.HostIP = HttpContext.Current.Request.UserHostAddress; } string sql = ORMapping.GetInsertSql <SoapRecorder>(this.soapRecorder, TSqlBuilder.Instance); try { OGUCommonDefine.ExecuteNonQuery(sql); } catch (DbException ex) { if (ex.Message.IndexOf("WEB_READ_LOG") > 0) { InitDatabase(sql); } //else // throw ex; } } }
protected void Page_Load(object sender, System.EventArgs e) { HttpContext context = HttpContext.Current; HttpRequest request = HttpContext.Current.Request; string appCodeName = request.QueryString["aName"]; string appScope = request.QueryString["aScope"]; string appName = string.Empty; if (appCodeName == null || appCodeName == string.Empty) { lbAppSocpe.InnerText = "(所有应用)"; } else { DataTable dt = SecurityCheck.GetApplications().Tables[0]; DataRow[] drs = dt.Select("[CODE_NAME] = '" + appCodeName + "'"); if (drs.Length > 0) { appName = drs[0]["NAME"].ToString(); } lbAppSocpe.InnerText = string.Format("({0}-{1})", appName, appCodeName); } XmlDocument xDoc = XmlHelper.CreateDomDocument("<Config><multiSelect>false</multiSelect><selectObjType>1</selectObjType><RootOrg/><BottomRow>true</BottomRow></Config>"); XmlNode xNode = xDoc.SelectSingleNode(".//RootOrg"); string strUser = HttpContext.Current.User.Identity.Name; if (!IsPostBack) { if (appScope != null && appScope.ToLower() == "y") { DataTable dt = SecurityCheck.GetUserRolesScopes(strUser, appCodeName, "SELF_ADMIN_ROLE,COMMON_ADMIN_ROLE").Tables[0]; string strScope = string.Empty; if (dt.Rows.Count == 0) { throw new Exception(string.Format("用户[{0}]没有设定相应的服务范围,不能完成此项操作", strUser)); } foreach (DataRow row in dt.Rows) { strScope = row["DESCRIPTION"].ToString(); foreach (string scope in strScope.Split(new char[] { ',', ';' })) { XmlHelper.AppendNode(xNode, "ORGANIZATIONS", scope); } } } else { string strRoot = AccreditSection.GetConfig().AccreditSettings.OguRootName; XmlHelper.AppendNode(xNode, "ORGANIZATIONS", strRoot); } hdConfig.Value = xDoc.OuterXml; return; } if (hdUserGuid.Value != string.Empty) { if (appCodeName == null || appCodeName == string.Empty) { //查所有权限 lbTitle.InnerText = string.Format("[{0}]所具有的角色:", hdAllPathName.Value); DataSet ds = SecurityCheck.GetUserApplicationsRoles( hdUserGuid.Value, UserValueType.Guid, RightMaskType.All, DelegationMaskType.All); DataView dv = new DataView(ds.Tables[0]); dv.Sort = "APP_RESOURCE_LEVEL ASC, SORT_ID ASC"; for (int i = 0; i < dv.Count; i++) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = dv[i]["APP_CODE_NAME"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerText = dv[i]["APP_NAME"].ToString(); //ars[i].AppName; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerText = dv[i]["CODE_NAME"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerText = dv[i]["NAME"].ToString(); row.Controls.Add(cell); appRolesTable.Controls.Add(row); } } else { //查一个应用的权限 lbTitle.InnerText = string.Format("[{0}]在\n[{1}-{2}]中所具有的角色:", hdAllPathName.Value, appName, appCodeName); bool bIsSelfAdmin = SecurityCheck.IsUserInRoles(strUser, appCodeName, "SELF_ADMIN_ROLE"); DataSet ds = SecurityCheck.GetUserRoles( hdUserGuid.Value, appCodeName, UserValueType.Guid, bIsSelfAdmin ? RightMaskType.All : RightMaskType.App, DelegationMaskType.All); DataView dv = new DataView(ds.Tables[0]); dv.Sort = "CLASSIFY ASC, SORT_ID ASC"; for (int i = 0; i < dv.Count; i++) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = appCodeName; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerText = appName; row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerText = dv[i]["CODE_NAME"].ToString(); row.Controls.Add(cell); cell = new HtmlTableCell(); cell.InnerText = dv[i]["NAME"].ToString(); row.Controls.Add(cell); appRolesTable.Controls.Add(row); } } } }