public DataSet GetUserFunctionsScopes(string userValue,
                                       string appCodeName,
                                       string funcCodeNames,
                                       UserValueType userValueType,
                                       DelegationMaskType delegationMask,
                                       ScopeMaskType scopeMask)
 {
     return(SecurityCheck.GetUserFunctionsScopes(userValue, appCodeName, funcCodeNames, userValueType, delegationMask, scopeMask));
 }
예제 #2
0
        /// <summary>
        /// 得到当前人员指定功能的,相应服务范围
        /// </summary>
        /// <example>
        /// <code>
        ///		<queryUserFuncScopes app_code_name="asdf" func_code_names="ADD_OBJECT_FUNC" delegation_mask="3" scope_mask="1"/>
        /// </code>
        /// </example>
        protected void DoQueryUserFuncScopes()
        {
            XmlElement root = _XmlRequest.DocumentElement;

            string appCodeName    = root.GetAttribute("app_code_name");
            string funcCodeNames  = root.GetAttribute("func_code_names");
            string delegationMask = root.GetAttribute("delegation_mask");
            string scopeMask      = root.GetAttribute("scope_mask");

            DelegationMaskType dm = DelegationMaskType.All;
            ScopeMaskType      sm = ScopeMaskType.All;

            if (delegationMask != string.Empty)
            {
                dm = (DelegationMaskType)int.Parse(delegationMask);
            }
            if (scopeMask != string.Empty)
            {
                sm = (ScopeMaskType)int.Parse(scopeMask);
            }

            string userID = LogOnUserInfo.UserLogOnName;

            //得到服务范围
            DataTable dt = SecurityCheck.GetUserFunctionsScopes(userID, appCodeName, funcCodeNames, UserValueType.LogonName, dm, sm).Tables[0];

            _XmlResult = new XmlDocument();
            _XmlResult.LoadXml("<DataSet/>");

            XmlHelper.AppendNode(_XmlResult.FirstChild, "Table");

            string strRootOrg;

            string[] arrRootOrg;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                strRootOrg = dt.Rows[i]["DESCRIPTION"].ToString();
                arrRootOrg = strRootOrg.Split(new char[] { ',', ';' });
                for (int j = 0; j < arrRootOrg.Length; j++)
                {
                    if (arrRootOrg[j] != string.Empty)
                    {
                        if (_XmlResult.SelectSingleNode(string.Format(".//ORGANIZATIONS[.='{0}']", arrRootOrg[j])) == null)
                        {
                            XmlHelper.AppendNode(_XmlResult.FirstChild.FirstChild, "ORGANIZATIONS", arrRootOrg[j]);
                        }
                    }
                }
            }
        }
예제 #3
0
 public System.Data.DataSet GetUserFunctionsScopes(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType, DelegationMaskType delegationMask, ScopeMaskType scopeMask)
 {
     object[] results = this.Invoke("GetUserFunctionsScopes", new object[] {
         userValue,
         appCodeName,
         funcCodeNames,
         userValueType,
         delegationMask,
         scopeMask
     });
     return((System.Data.DataSet)(results[0]));
 }
예제 #4
0
 /// <remarks/>
 public System.IAsyncResult BeginGetUserFunctionsScopes(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType, DelegationMaskType delegationMask, ScopeMaskType scopeMask, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("GetUserFunctionsScopes", new object[] {
         userValue,
         appCodeName,
         funcCodeNames,
         userValueType,
         delegationMask,
         scopeMask
     }, callback, asyncState));
 }
 public System.Data.DataSet GetUserFunctionsScopes(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType, DelegationMaskType delegationMask, ScopeMaskType scopeMask)
 {
     object[] results = this.Invoke("GetUserFunctionsScopes", new object[] {
                 userValue,
                 appCodeName,
                 funcCodeNames,
                 userValueType,
                 delegationMask,
                 scopeMask});
     return ((System.Data.DataSet)(results[0]));
 }
예제 #6
0
		//生成语句:查询指定人员,在指定应用,指定角色中所拥有的服务范围
		private static string GetUserFunctionsScopes_SqlStr(string userID,
			string userAllPath,
			string appCodeName,
			string funcCodeNames,
			DelegationMaskType delegationMask,
			ScopeMaskType scopeMask)
		{
			//从功能到角色
			DataTable roleDT = GetFunctionsRoles(appCodeName, funcCodeNames).Tables[0];

			string roleCodeNames = GetColumnValue(roleDT, "CODE_NAME");

			return GetUserRolesScopes_SqlStr(userID, userAllPath, appCodeName, roleCodeNames, delegationMask, scopeMask);
		}
예제 #7
0
		/// <summary>
		/// 查询指定人员,在指定应用,指定角色中所拥有的服务范围
		/// </summary>
		/// <param name="userID"></param>
		/// <param name="userAllPath"></param>
		/// <param name="appCodeName"></param>
		/// <param name="funcCodeNames"></param>
		/// <param name="delegationMask"></param>
		/// <param name="scopeMask"></param>
		/// <returns></returns>
		private static DataSet GetUserFunctionsScopes(string userID,
			string userAllPath,
			string appCodeName,
			string funcCodeNames,
			DelegationMaskType delegationMask,
			ScopeMaskType scopeMask)
		{
			string strSql = GetUserFunctionsScopes_SqlStr(userID, userAllPath, appCodeName, funcCodeNames, delegationMask, scopeMask);
			if (strSql == string.Empty)
			{
				strSql = @"
SELECT ID, APP_ID, NAME, CODE_NAME, EXPRESSION, DESCRIPTION, CLASSIFY, SORT_ID, INHERITED  
FROM SCOPES 
WHERE 1>1";
				return OGUCommonDefine.ExecuteDataset(strSql);
			}
			else
			{
				strSql += "\n ORDER BY CLASSIFY, SORT_ID";
				return GetScopeAllPath(OGUCommonDefine.ExecuteDataset(strSql), userID, userAllPath);
			}
		}
예제 #8
0
		/// <summary>
		/// 生成语句:查询指定人员,在指定应用,指定角色中所拥有的服务范围
		/// </summary>
		/// <param name="userID"></param>
		/// <param name="userAllPath"></param>
		/// <param name="appCodeName"></param>
		/// <param name="roleCodeNames"></param>
		/// <param name="delegationMask"></param>
		/// <param name="scopeMask"></param>
		/// <returns></returns>
		private static string GetUserRolesScopes_SqlStr(string userID,
			string userAllPath,
			string appCodeName,
			string roleCodeNames,
			DelegationMaskType delegationMask,
			ScopeMaskType scopeMask)
		{
			//modified by yangrui 2005.1
			string strSql = string.Format("SELECT ISNULL(USE_SCOPE, 'n') FROM APPLICATIONS WHERE CODE_NAME = {0}",
				TSqlBuilder.Instance.CheckQuotationMark(appCodeName, true));

			object obj = OGUCommonDefine.ExecuteScalar(strSql);

			if (obj == null || obj.ToString().ToLower() == "n")
			{
				return string.Empty;
			}

			string expIDsSql = GetUserExpressionIDs_SqlStr(userID, userAllPath, appCodeName, RightMaskType.All, delegationMask, roleCodeNames);
			strSql = string.Empty;
			if (expIDsSql != string.Empty)
			{
				strSql = string.Format(@"
SELECT ID, APP_ID, NAME, CODE_NAME, EXPRESSION, DESCRIPTION, CLASSIFY, SORT_ID, INHERITED  
FROM SCOPES 
WHERE ID IN 
	(
		SELECT ES.SCOPE_ID
		FROM EXP_TO_SCOPES ES INNER JOIN EXPRESSIONS E ON ES.EXP_ID = E.ID
			INNER JOIN ROLES R ON E.ROLE_ID = R.ID 
			INNER JOIN APPLICATIONS A ON R.APP_ID = A.ID
			WHERE ES.EXP_ID IN ({0}) AND A.CODE_NAME = {1} AND R.CODE_NAME IN ({2}) 
	)",
					expIDsSql, TSqlBuilder.Instance.CheckQuotationMark(appCodeName, true),
					OGUCommonDefine.AddMulitStrWithQuotationMark(roleCodeNames));
				string classCondition = string.Empty;
				if (scopeMask == ScopeMaskType.OrgScope)
					classCondition = "\n AND (CLASSIFY = 'y') ";
				if (scopeMask == ScopeMaskType.DataScope)
					classCondition = "\n AND (CLASSIFY = 'n') ";
				if (classCondition != string.Empty)
					strSql += classCondition;

				//strSql = string.Format(strSql, OGUCommonDefine.AddMulitStrWithQuotationMark(expIDs));
			}

			return strSql;

		}
예제 #9
0
		/// <summary>
		/// 查询指定人员,在指定应用,指定角色中所拥有的服务范围
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="funcCodeNames">功能的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="delegationMask">委派类型</param>
		/// <param name="scopeMask">服务范围类型</param>
		/// <returns></returns>
		public static DataSet GetUserFunctionsScopes(string userValue,
			string appCodeName,
			string funcCodeNames,
			UserValueType userValueType,
			DelegationMaskType delegationMask,
			ScopeMaskType scopeMask)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey(userValue, appCodeName, funcCodeNames, userValueType, delegationMask, scopeMask);
			DataSet result;
			//if (false == GetUserFunctionsScopesQueue.Instance.TryGetValue(cacheKey, out result))
			//{
			//    lock (typeof(GetUserFunctionsScopesQueue))//.CacheQueueSync)
			//    {
			if (false == GetUserFunctionsScopesQueue.Instance.TryGetValue(cacheKey, out result))
			{
				using (DbContext context = DbContext.GetContext(CommonResource.AppConnAlias))
				{
					string strUserIDs = string.Empty;
					strUserIDs = GetUserGuids(userValue, userValueType);
					if (userValueType == UserValueType.AllPath)
					{
						result = GetUserFunctionsScopes(strUserIDs, userValue, appCodeName, funcCodeNames, delegationMask, scopeMask);
					}
					else
					{
						result = GetUserFunctionsScopes(strUserIDs, string.Empty, appCodeName, funcCodeNames, delegationMask, scopeMask);
					}
				}
				GetUserFunctionsScopesQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
		public DataSet GetUserFunctionsScopes(string userValue, 
			string appCodeName, 
			string funcCodeNames, 
			UserValueType userValueType,
			DelegationMaskType delegationMask, 
			ScopeMaskType scopeMask)
		{
			return SecurityCheck.GetUserFunctionsScopes(userValue, appCodeName, funcCodeNames, userValueType, delegationMask, scopeMask);
		}