コード例 #1
0
 public DataSet GetUserAllowDelegteRoles(string userValue,
                                         string appCodeName,
                                         UserValueType userValueType,
                                         RightMaskType rightMask)
 {
     return(SecurityCheck.GetUserAllowDelegteRoles(userValue, appCodeName, userValueType, rightMask));
 }
コード例 #2
0
 public DataSet GetUserApplications(string userValue,
                                    UserValueType userValueType,
                                    RightMaskType rightMask,
                                    DelegationMaskType delegationMask)
 {
     return(SecurityCheck.GetUserApplications(userValue, userValueType, rightMask, delegationMask));
 }
コード例 #3
0
        public DataSet GetUserRoles2(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask, bool includeMatrixUsers)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] userIDs     = OGUReaderService.SplitObjectValues(userValue);

            SCObjectAndRelationCollection users = OGUReaderService.GetSearchAdapter(GetSearchOUIDType(userValueType), SchemaInfo.FilterByCategory("Users").ToSchemaNames(), userIDs, false).QueryObjectsAndRelations();

            SchemaObjectCollection roles = SCSnapshotAdapter.Instance.QueryUserBelongToRoles(schemaTypes, appCodeName, users.ToIDArray(), false, DateTime.MinValue);

            if (includeMatrixUsers)
            {
                List <string> matachedRoleIDs = GetUserRoleIDsInMatrix(users.ToIDArray(), appCodeName);

                //过滤掉已经在之前查询过的角色
                matachedRoleIDs = matachedRoleIDs.FindAll(rID => roles.ContainsKey(rID) == false);

                if (matachedRoleIDs.Count > 0)
                {
                    InSqlClauseBuilder matrixRoleBuilder = new InSqlClauseBuilder("ID");

                    matrixRoleBuilder.AppendItem(matachedRoleIDs.ToArray());
                    SchemaObjectCollection rolesInMatrix = SchemaObjectAdapter.Instance.Load(matrixRoleBuilder, DateTime.MinValue);

                    rolesInMatrix.ForEach(rMatrix => roles.AddNotExistsItem(rMatrix, (r) => string.Compare(r.ID, rMatrix.ID, true) == 0));
                }
            }

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(roles));

            return(ds);
        }
コード例 #4
0
        public RoleCollection GetUserRoles(IApplication application, IUser user)
        {
            application.NullCheck("application");
            user.NullCheck("user");

            //原来是按照ID进行权限判断,现在改成根据配置文件决定(沈峥)
            string        userID    = user.ID;
            UserValueType valueType = UserValueType.Guid;

            if (OguPermissionSettings.GetConfig().RoleRelatedUserParentDept&& user.FullPath.IsNotEmpty())
            {
                userID    = user.FullPath;
                valueType = UserValueType.AllPath;
            }

            bool includeMatrixUsers = ServiceBrokerContext.Current.Context.GetValue("includeMatrixUsers", true);

            DataTable table = AppAdminServiceBroker.Instance.GetUserRoles2(
                userID,
                application.CodeName,
                valueType,
                RightMaskType.App,
                DelegationMaskType.All,
                includeMatrixUsers).Tables[0];

            RoleCollection roles = new RoleCollection(BuildObjectsFromTable <IRole>(table));

            if (application != null)
            {
                roles.ForEach(r => ((RoleImpl)r).Application = application);
            }

            return(roles);
        }
コード例 #5
0
 public bool IsUserInAllRoles(string userValue,
                              string appCodeName,
                              string roleCodeNames,
                              UserValueType userValueType,
                              DelegationMaskType delegationMask)
 {
     return(SecurityCheck.IsUserInAllRoles(userValue, appCodeName, roleCodeNames, userValueType, delegationMask));
 }
コード例 #6
0
 public bool DoesUserHasAllPermissions(string userValue,
                                       string appCodeName,
                                       string funcCodeNames,
                                       UserValueType userValueType,
                                       DelegationMaskType delegationMask)
 {
     return(SecurityCheck.DoesUserHasAllPermissions(userValue, appCodeName, funcCodeNames, userValueType, delegationMask));
 }
コード例 #7
0
 public DataSet GetUserPermissions(string userValue,
                                   string appCodeName,
                                   UserValueType userValueType,
                                   RightMaskType rightMask,
                                   DelegationMaskType delegationMask)
 {
     return(SecurityCheck.GetUserPermissions(userValue, appCodeName, userValueType, rightMask, delegationMask));
 }
コード例 #8
0
 public DataSet GetDelegatedUser(string userValues,
                                 string appCodeName,
                                 string roleCodeNames,
                                 UserValueType userValueType,
                                 bool includeDisabled)
 {
     return(SecurityCheck.GetDelegatedUser(userValues, appCodeName, roleCodeNames, userValueType, includeDisabled));
 }
コード例 #9
0
 /// <remarks/>
 public System.IAsyncResult BeginGetAllDelegatedUser(string userValues, UserValueType userValueType, bool includeDisabled, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("GetAllDelegatedUser", new object[] {
         userValues,
         userValueType,
         includeDisabled
     }, callback, asyncState));
 }
コード例 #10
0
 public System.Data.DataSet GetAllDelegatedUser(string userValues, UserValueType userValueType, bool includeDisabled)
 {
     object[] results = this.Invoke("GetAllDelegatedUser", new object[] {
         userValues,
         userValueType,
         includeDisabled
     });
     return((System.Data.DataSet)(results[0]));
 }
コード例 #11
0
ファイル: UserData.cs プロジェクト: 0000duck/brawltools
 public UserDataEntry(int entries, UserValueType type, int id)
 {
     _totalLen     = 0;
     _dataOffset   = type == UserValueType.String ? 0 : 0x18;
     _entryCount   = entries;
     _type         = (int)type;
     _stringOffset = 0;
     _id           = id;
 }
コード例 #12
0
 public DataSet GetUserFunctionsScopes(string userValue,
                                       string appCodeName,
                                       string funcCodeNames,
                                       UserValueType userValueType,
                                       DelegationMaskType delegationMask,
                                       ScopeMaskType scopeMask)
 {
     return(SecurityCheck.GetUserFunctionsScopes(userValue, appCodeName, funcCodeNames, userValueType, delegationMask, scopeMask));
 }
コード例 #13
0
 public UserDataEntry(int entries, UserValueType type, int id)
 {
     _totalLen = 0;
     _dataOffset = type == UserValueType.String ? 0 : 0x18;
     _entryCount = entries;
     _type = (int)type;
     _stringOffset = 0;
     _id = id;
 }
コード例 #14
0
 /// <remarks/>
 public System.IAsyncResult BeginGetUserApplications(string userValue, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("GetUserApplications", new object[] {
         userValue,
         userValueType,
         rightMask,
         delegationMask
     }, callback, asyncState));
 }
コード例 #15
0
 public System.Data.DataSet GetUserApplications(string userValue, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask)
 {
     object[] results = this.Invoke("GetUserApplications", new object[] {
         userValue,
         userValueType,
         rightMask,
         delegationMask
     });
     return((System.Data.DataSet)(results[0]));
 }
コード例 #16
0
        public DataSet GetUserPermissions(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] userIDs     = OGUReaderService.SplitObjectValues(userValue);

            SCObjectAndRelationCollection users = OGUReaderService.GetSearchAdapter(GetSearchOUIDType(userValueType), SchemaInfo.FilterByCategory("Users").ToSchemaNames(), userIDs, false).QueryObjectsAndRelations();

            SchemaObjectCollection roles = SCSnapshotAdapter.Instance.QueryUserBelongToPermissions(schemaTypes, appCodeName, users.ToIDArray(), false, DateTime.MinValue);

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(roles));

            return(ds);
        }
コード例 #17
0
        public DataSet GetUserPermissions2(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask, bool includeMatrixUsers)
        {
            string[] schemaTypes = SchemaInfo.FilterByCategory("Roles").ToSchemaNames();
            string[] userIDs     = OGUReaderService.SplitObjectValues(userValue);

            SCObjectAndRelationCollection users = OGUReaderService.GetSearchAdapter(GetSearchOUIDType(userValueType), SchemaInfo.FilterByCategory("Users").ToSchemaNames(), userIDs, false).QueryObjectsAndRelations();

            SchemaObjectCollection permissions = SCSnapshotAdapter.Instance.QueryUserBelongToPermissions(schemaTypes, appCodeName, users.ToIDArray(), false, DateTime.MinValue);

            if (includeMatrixUsers)
            {
                string[] permissionTypes = SchemaInfo.FilterByCategory("Permissions").ToSchemaNames();

                List <string> roleIDsInMatrix = GetUserRoleIDsInMatrix(users.ToIDArray(), appCodeName);

                SCObjectAndRelationCollection permissionsInMatrixRelation = SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(permissionTypes, roleIDsInMatrix.ToArray(), false, true, false, DateTime.MinValue);

                InSqlClauseBuilder inBuilder = new InSqlClauseBuilder("ID");

                List <string> permissionInMatrixIDs = new List <string>();

                foreach (SCObjectAndRelation pim in permissionsInMatrixRelation)
                {
                    if (permissions.ContainsKey(pim.ID) == false)
                    {
                        inBuilder.AppendItem(pim.ID);
                    }
                }

                if (inBuilder.IsEmpty == false)
                {
                    SchemaObjectCollection permissionsInMatrix = SchemaObjectAdapter.Instance.Load(inBuilder, DateTime.MinValue);

                    permissions.CopyFrom(permissionsInMatrix);
                }
            }

            DataSet ds = new DataSet();

            ds.Tables.Add(QueryHelper.GetAppObjectTableBuilder(schemaTypes).Convert(permissions));

            return(ds);
        }
コード例 #18
0
		/// <summary>
		/// 判断人员是否是总管理员
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns>判断人员是否是总管理员</returns>
		/// <remarks>总管理员是通用授权平台的总管理者,如果总管理员中没有用户,系统的授权失效;必须有一个总管理员才能激活系统的授权管理控制;
		/// 这里判断用户userValue是否是通用授权管理系统中的总管理员角色</remarks>
		public static bool IsAdminUser(string userValue, UserValueType userValueType)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey(userValue, userValueType);
			bool result;
			//if (false == IsAdminUserQueue.Instance.TryGetValue(cacheKey, out result))
			//{
			//    lock (typeof(IsAdminUserQueue))//.CacheQueueSync)
			//    {
			if (false == IsAdminUserQueue.Instance.TryGetValue(cacheKey, out result))
			{
				using (DbContext context = DbContext.GetContext(CommonResource.AppConnAlias))
				{
					string strUserIDs = GetUserGuids(userValue, userValueType);

					string strSql = @"SELECT COUNT(*) FROM EXPRESSIONS WHERE ROLE_ID IN 
								(SELECT ID FROM ROLES WHERE CODE_NAME =	'ADMINISTRATOR_ROLE'
									AND APP_ID = (SELECT ID FROM APPLICATIONS WHERE CODE_NAME = 'APP_ADMIN') )";
					object obj = OGUCommonDefine.ExecuteScalar(strSql);
					if (obj != null && (int)obj == 0)////总管理员角色中没有对象,所有人员均是总管理员
					{
						result = true;
					}
					else
					{
						string userAllPath = userValueType == UserValueType.AllPath ? userValue : string.Empty;
						result = SecurityCheck.IsUserInRoles(strUserIDs,
							userAllPath,
							"APP_ADMIN",
							"ADMINISTRATOR_ROLE",
							DelegationMaskType.All);
					}
				}
				IsAdminUserQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
コード例 #19
0
        public List <IRole> GetAllUserRoles(IUser user)
        {
            user.NullCheck("user");

            //原来是按照ID进行权限判断,现在改成根据配置文件决定(沈峥)
            string        userID    = user.ID;
            UserValueType valueType = UserValueType.Guid;

            if (OguPermissionSettings.GetConfig().RoleRelatedUserParentDept)
            {
                userID    = user.FullPath;
                valueType = UserValueType.AllPath;
            }

            DataTable table = AppAdminServiceBroker.Instance.GetUserRoles(
                userID,
                string.Empty,
                valueType,
                RightMaskType.App,
                DelegationMaskType.All).Tables[0];

            return(BuildObjectsFromTable <IRole>(table));
        }
コード例 #20
0
        private static SearchOUIDType GetSearchOUIDType(UserValueType userValueType)
        {
            SearchOUIDType result = SearchOUIDType.None;

            switch (userValueType)
            {
            case UserValueType.Guid:
                result = SearchOUIDType.Guid;
                break;

            case UserValueType.AllPath:
                result = SearchOUIDType.FullPath;
                break;

            case UserValueType.LogonName:
                result = SearchOUIDType.LogOnName;
                break;

            default:
                throw new NotSupportedException(string.Format("不支持的用户ID类型{0}", userValueType));
            }

            return(result);
        }
コード例 #21
0
		/// <summary>
		/// 查询指定人员在所有应用中、所有角色的被委派者
		/// </summary>
		/// <param name="userValues">用户身份标识(由userValueType参数指定类型,多个时用逗号分隔)</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetAllDelegatedUser(string userValues, UserValueType userValueType)
		{
			return GetAllDelegatedUser(userValues, userValueType, false);
		}
コード例 #22
0
		/// <summary>
		/// 查询指定人员,在指定应用中,是否拥有指定的功能权限(拥有全部功能)
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appID">应用的GUID</param>
		/// <param name="funcCodeNames">功能的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static bool DoesUserHasAllPermissions(string userValue, Guid appID, string funcCodeNames, UserValueType userValueType)
		{
			return DoesUserHasAllPermissions(userValue, appID, funcCodeNames, userValueType, DelegationMaskType.All);
		}
コード例 #23
0
		/// <summary>
		/// 查询指定人员,在指定应用中,是否拥有指定的功能权限(拥有全部功能)
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appID">应用的GUID</param>
		/// <param name="funcCodeNames">功能的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="delegationMask">委派类型</param>
		/// <returns></returns>
		public static bool DoesUserHasAllPermissions(string userValue,
			Guid appID,
			string funcCodeNames,
			UserValueType userValueType,
			DelegationMaskType delegationMask)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey(userValue, appID, funcCodeNames, userValueType, delegationMask);
			bool result;
			//if (false == DoesUserHasAllPermissionsQueue.Instance.TryGetValue(cacheKey, out result))
			//{
			//    lock (typeof(DoesUserHasAllPermissionsQueue))//.CacheQueueSync)
			//    {
			if (false == DoesUserHasAllPermissionsQueue.Instance.TryGetValue(cacheKey, out result))
			{
				using (DbContext context = DbContext.GetContext(CommonResource.AppConnAlias))
				{
					string appCodeName = GetApplicatonCodeName(appID);
					if (appCodeName == string.Empty)
						return false;

					result = DoesUserHasAllPermissions(userValue, appCodeName, funcCodeNames, userValueType, delegationMask);
				}
				DoesUserHasAllPermissionsQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
コード例 #24
0
 public DataSet GetAllDelegatedUser(string userValues, UserValueType userValueType, bool includeDisabled)
 {
     return(SecurityCheck.GetAllDelegatedUser(userValues, userValueType, includeDisabled));
 }
コード例 #25
0
 public System.Data.DataSet GetUserPermissions2(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask, bool includeMatrixUsers)
 {
     object[] results = this.Invoke("GetUserPermissions2", new object[] {
         userValue,
         appCodeName,
         userValueType,
         rightMask,
         delegationMask,
         includeMatrixUsers
     });
     return((System.Data.DataSet)(results[0]));
 }
コード例 #26
0
		/// <summary>
		/// 查询指定用户,在指定应用中所拥有的,可进行委派的角色
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetUserAllowDelegteRoles(string userValue, string appCodeName, UserValueType userValueType)
		{
			return GetUserAllowDelegteRoles(userValue, appCodeName, userValueType, RightMaskType.All);
		}
コード例 #27
0
 public DataSet GetAllOriginalUser(string userValue,
                                   UserValueType userValueType,
                                   bool includeDisabled)
 {
     return(SecurityCheck.GetAllOriginalUser(userValue, userValueType, includeDisabled));
 }
コード例 #28
0
 /// <remarks/>
 public System.IAsyncResult BeginGetUserAllowDelegteRoles(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("GetUserAllowDelegteRoles", new object[] {
         userValue,
         appCodeName,
         userValueType,
         rightMask
     }, callback, asyncState));
 }
コード例 #29
0
 public bool IsUserInAllRoles(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType, DelegationMaskType delegationMask)
 {
     object[] results = this.Invoke("IsUserInAllRoles", new object[] {
                 userValue,
                 appCodeName,
                 roleCodeNames,
                 userValueType,
                 delegationMask});
     return ((bool)(results[0]));
 }
コード例 #30
0
 /// <remarks/>
 public System.IAsyncResult BeginGetOriginalUser(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType, bool includeDisabled, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("GetOriginalUser", new object[] {
         userValue,
         appCodeName,
         roleCodeNames,
         userValueType,
         includeDisabled
     }, callback, asyncState));
 }
コード例 #31
0
		/// <summary>
		/// 查询指定人员所拥有的所有可进行委派操作的应用信息
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetUserApplicationsForDelegation(string userValue, UserValueType userValueType)
		{
			return GetUserApplicationsForDelegation(userValue, userValueType, RightMaskType.All);
		}
コード例 #32
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));
 }
コード例 #33
0
		/// <summary>
		/// 查询指定人员在指定应用中,指定角色的被委派者
		/// </summary>
		/// <param name="userValues">用户身份标识(由userValueType参数指定类型,多个时用逗号分隔)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="roleCodeNames">角色的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetDelegatedUser(string userValues, string appCodeName, string roleCodeNames, UserValueType userValueType)
		{
			return GetDelegatedUser(userValues, appCodeName, roleCodeNames, userValueType, false);
		}
コード例 #34
0
 /// <remarks/>
 public System.IAsyncResult BeginDoesUserHasAllPermissions(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType, DelegationMaskType delegationMask, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("DoesUserHasAllPermissions", new object[] {
         userValue,
         appCodeName,
         funcCodeNames,
         userValueType,
         delegationMask
     }, callback, asyncState));
 }
コード例 #35
0
		/// <summary>
		/// 查询指定人员所拥有的所有应用信息
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="rightMask">权限类型</param>
		/// <returns></returns>
		public static DataSet GetUserApplications(string userValue, UserValueType userValueType, RightMaskType rightMask)
		{
			return GetUserApplications(userValue, userValueType, rightMask, DelegationMaskType.All);
		}
コード例 #36
0
 public System.Data.DataSet GetUserAllowDelegteRoles(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask)
 {
     object[] results = this.Invoke("GetUserAllowDelegteRoles", new object[] {
         userValue,
         appCodeName,
         userValueType,
         rightMask
     });
     return((System.Data.DataSet)(results[0]));
 }
コード例 #37
0
		/// <summary>
		/// 查询指定人员,在指定应用具有的权限(功能)
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetUserPermissions(string userValue, string appCodeName, UserValueType userValueType)
		{
			return GetUserPermissions(userValue, appCodeName, userValueType, RightMaskType.All);
		}
コード例 #38
0
		/// <summary>
		/// 查询指定人员在指定所有应用中的原有委派者
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetAllOriginalUser(string userValue, UserValueType userValueType)
		{
			return GetAllOriginalUser(userValue, userValueType, false);
		}
コード例 #39
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="userValueType"></param>
		/// <returns></returns>
		private static OguAdmin.SearchObjectColumn GetUserValueClass(UserValueType userValueType)
		{
			switch (userValueType)
			{
				case UserValueType.Guid:
					return SearchObjectColumn.SEARCH_GUID;

				case UserValueType.LogonName:
					return SearchObjectColumn.SEARCH_LOGON_NAME;

				case UserValueType.PersonID:
					return SearchObjectColumn.SEARCH_PERSON_ID;

				case UserValueType.AllPath:
					return SearchObjectColumn.SEARCH_ALL_PATH_NAME;

				case UserValueType.ICCode:
					return SearchObjectColumn.SEARCH_IC_CARD;
				//为配合南京海关统一平台切换,新增加字段ID[自增唯一字段]
				case UserValueType.Identity:
					return SearchObjectColumn.SEARCH_IDENTITY;
			}
			return SearchObjectColumn.SEARCH_NULL;

		}
コード例 #40
0
 public bool IsUserInAllRoles(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType, DelegationMaskType delegationMask)
 {
     object[] results = this.Invoke("IsUserInAllRoles", new object[] {
         userValue,
         appCodeName,
         roleCodeNames,
         userValueType,
         delegationMask
     });
     return((bool)(results[0]));
 }
コード例 #41
0
		/// <summary>
		/// 查询指定用户,在指定应用中所拥有的角色
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="rightMask">权限类型</param>
		/// <returns></returns>
		public static DataSet GetUserRoles(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask)
		{
			return GetUserRoles(userValue, appCodeName, userValueType, rightMask, DelegationMaskType.All);
		}
コード例 #42
0
		/// <summary>
		/// 查询指定人员在指定应用中,指定角色的原有委派者
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="roleCodeNames">角色的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetOriginalUser(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType)
		{
			return GetOriginalUser(userValue, appCodeName, roleCodeNames, userValueType, false);
		}
コード例 #43
0
		/// <summary>
		/// 查询指定用户,在指定应用中所拥有的角色
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="rightMask">权限类型</param>
		/// <param name="delegationMask">委派类型</param>
		/// <returns></returns>
		public static DataSet GetUserRoles(string userValue,
			string appCodeName,
			UserValueType userValueType,
			RightMaskType rightMask,
			DelegationMaskType delegationMask)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey(userValue, appCodeName, userValueType, rightMask, delegationMask);
			DataSet result;

			if (false == GetUserRolesQueue.Instance.TryGetValue(cacheKey, out result))
			{
				using (DbContext context = DbContext.GetContext(CommonResource.AppConnAlias))
				{
					string strUserIDs = GetUserGuids(userValue, userValueType);
					if (userValueType == UserValueType.AllPath)
					{
						result = GetUserRoles(strUserIDs, userValue, appCodeName, rightMask, delegationMask);
					}
					else
					{
						result = GetUserRoles(strUserIDs, string.Empty, appCodeName, rightMask, delegationMask);
					}
				}

				GetUserRolesQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
コード例 #44
0
 public System.Data.DataSet GetOriginalUser(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType, bool includeDisabled)
 {
     object[] results = this.Invoke("GetOriginalUser", new object[] {
         userValue,
         appCodeName,
         roleCodeNames,
         userValueType,
         includeDisabled
     });
     return((System.Data.DataSet)(results[0]));
 }
コード例 #45
0
		/// <summary>
		/// 得到用户的GUID,用户非法或无效时,返回空
		/// </summary>
		/// <param name="userValues"></param>
		/// <param name="userValueType"></param>
		/// <returns></returns>
		private static string GetUserGuids(string userValues, UserValueType userValueType)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey("GetUserGuids", userValues, userValueType);
			string result;
			//if (false == CommonCoreQueue.Instance.TryGetValue(cacheKey, out result))
			//{
			//    lock (typeof(CommonCoreQueue))//.CacheQueueSync)
			//    {
			if (false == CommonCoreQueue.Instance.TryGetValue(cacheKey, out result))
			{
				string strUserColName = OGUCommonDefine.GetSearchObjectColumn(GetUserValueClass(userValueType));
				string temp = DatabaseSchema.Instence.GetTableColumns(strUserColName, "OU_USERS", "USERS");
				string strSql = @"
SELECT DISTINCT USER_GUID 
FROM USERS INNER JOIN OU_USERS
	ON USERS.GUID = OU_USERS.USER_GUID 
WHERE " + temp + " IN (" + OGUCommonDefine.AddMulitStrWithQuotationMark(userValues) + @") 
	AND OU_USERS.STATUS = 1 
	AND GETDATE() BETWEEN OU_USERS.START_TIME AND OU_USERS.END_TIME";

				//                        if (userValueType == UserValueType.LogonName)
				//                            strSql = string.Format(@"
				//SELECT DISTINCT OU.USER_GUID 
				//FROM USERS U INNER JOIN OU_USERS OU 
				//	ON U.GUID = OU.USER_GUID 
				//WHERE U.LOGON_NAME IN ({0}) 
				//	AND OU.STATUS = 1 
				//	AND GETDATE() BETWEEN OU.START_TIME AND OU.END_TIME", OGUCommonDefine.AddMulitStrWithQuotationMark(userValues));
				//                        if (userValueType == UserValueType.AllPath)
				//                            strSql = string.Format(@"
				//SELECT DISTINCT OU.USER_GUID 
				//FROM OU_USERS OU 
				//WHERE OU.ALL_PATH_NAME IN ({0}) 
				//	AND OU.STATUS = 1 
				//	AND GETDATE() BETWEEN OU.START_TIME AND OU.END_TIME", OGUCommonDefine.AddMulitStrWithQuotationMark(userValues));
				//                        if (userValueType == UserValueType.PersonID)
				//                            strSql = string.Format(@"
				//SELECT DISTINCT OU.USER_GUID 
				//FROM USERS U INNER JOIN OU_USERS OU 
				//	ON U.GUID = OU.USER_GUID 
				//WHERE U.PERSON_ID IN ({0}) 
				//	AND OU.STATUS = 1 
				//	AND GETDATE() BETWEEN OU.START_TIME AND OU.END_TIME", OGUCommonDefine.AddMulitStrWithQuotationMark(userValues));
				//                        if (userValueType == UserValueType.ICCode)
				//                            strSql = string.Format(@"
				//SELECT DISTINCT OU.USER_GUID 
				//FROM USERS U INNER JOIN OU_USERS OU 
				//	ON U.GUID = OU.USER_GUID 
				//WHERE U.IC_CARD IN ({0}) 
				//	AND OU.STATUS = 1 
				//	AND GETDATE() BETWEEN OU.START_TIME AND OU.END_TIME", OGUCommonDefine.AddMulitStrWithQuotationMark(userValues));
				//                        if (userValueType == UserValueType.Guid)
				//                            strSql = string.Format(@"
				//SELECT DISTINCT OU.USER_GUID 
				//FROM USERS U INNER JOIN OU_USERS OU 
				//	ON U.GUID = OU.USER_GUID 
				//WHERE GUID IN ({0}) 
				//	AND OU.STATUS = 1 
				//	AND GETDATE() BETWEEN OU.START_TIME AND OU.END_TIME", OGUCommonDefine.AddMulitStrWithQuotationMark(userValues));

				DataTable DT = OGUCommonDefine.ExecuteDataset(strSql).Tables[0];
				result = GetColumnValue(DT, "USER_GUID");
				CommonCoreQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
コード例 #46
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;
		}
コード例 #47
0
		/// <summary>
		/// 查询指定人员,在指定应用,指定角色中所拥有的服务范围
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="funcCodeNames">功能的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetUserFunctionsScopes(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType)
		{
			return GetUserFunctionsScopes(userValue, appCodeName, funcCodeNames, userValueType, DelegationMaskType.All);
		}
コード例 #48
0
		/// <summary>
		/// 查询指定人员所拥有的所有可进行委派操作的应用信息
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="rightMask">权限类型</param>
		/// <returns></returns>
		public static DataSet GetUserApplicationsForDelegation(string userValue, UserValueType userValueType, RightMaskType rightMask)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey(userValue, userValueType, rightMask);
			DataSet result;
			//if (false == GetUserApplicationsForDelegationQueue.Instance.TryGetValue(cacheKey, out result))
			//{
			//    lock (typeof(GetUserApplicationsForDelegationQueue))//.CacheQueueSync)
			//    {
			if (false == GetUserApplicationsForDelegationQueue.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 = GetUserApplicationsForDelegation(strUserIDs, userValue, rightMask);
					}
					else
					{
						result = GetUserApplicationsForDelegation(strUserIDs, string.Empty, rightMask);
					}
				}
				GetUserApplicationsForDelegationQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
コード例 #49
0
		/// <summary>
		/// 判断人员是否在指定应用,指定的所有角色中
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appID">应用的GUID</param>
		/// <param name="roleCodeNames">角色的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static bool IsUserInAllRoles(string userValue, Guid appID, string roleCodeNames, UserValueType userValueType)
		{
			return IsUserInAllRoles(userValue, appID, roleCodeNames, userValueType, DelegationMaskType.All);
		}
コード例 #50
0
		/// <summary>
		/// 查询指定人员在所有应用中、所有角色的被委派者
		/// </summary>
		/// <param name="userValues">用户登录名</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <param name="includeDisabled">是否包括无效的委派</param>
		/// <returns></returns>
		public static DataSet GetAllDelegatedUser(string userValues, UserValueType userValueType, bool includeDisabled)
		{
			string cacheKey = InnerCacheHelper.BuildCacheKey(userValues, userValueType, includeDisabled);
			DataSet result;
			//if (false == GetAllDelegatedUserQueue.Instance.TryGetValue(cacheKey, out result))
			//{
			//    lock (typeof(GetAllDelegatedUserQueue))//.CacheQueueSync)
			//    {
			if (false == GetAllDelegatedUserQueue.Instance.TryGetValue(cacheKey, out result))
			{
				using (DbContext context = DbContext.GetContext(CommonResource.AppConnAlias))
				{
					string strUserIDs = string.Empty;
					strUserIDs = GetUserGuids(userValues, userValueType);
					result = GetAllDelegatedUser(strUserIDs, includeDisabled);
				}
				GetAllDelegatedUserQueue.Instance.Add(cacheKey, result, InnerCacheHelper.PrepareDependency());
			}
			//    }
			//}
			return result;
		}
コード例 #51
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]));
 }
コード例 #52
0
 public System.Data.DataSet GetOriginalUser(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType, bool includeDisabled)
 {
     object[] results = this.Invoke("GetOriginalUser", new object[] {
                 userValue,
                 appCodeName,
                 roleCodeNames,
                 userValueType,
                 includeDisabled});
     return ((System.Data.DataSet)(results[0]));
 }
コード例 #53
0
 public bool DoesUserHasAllPermissions(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType, DelegationMaskType delegationMask)
 {
     object[] results = this.Invoke("DoesUserHasAllPermissions", new object[] {
         userValue,
         appCodeName,
         funcCodeNames,
         userValueType,
         delegationMask
     });
     return((bool)(results[0]));
 }
コード例 #54
0
 public System.Data.DataSet GetAllDelegatedUser(string userValues, UserValueType userValueType, bool includeDisabled)
 {
     object[] results = this.Invoke("GetAllDelegatedUser", new object[] {
                 userValues,
                 userValueType,
                 includeDisabled});
     return ((System.Data.DataSet)(results[0]));
 }
コード例 #55
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]));
 }
コード例 #56
0
 public System.Data.DataSet GetUserAllowDelegteRoles(string userValue, string appCodeName, UserValueType userValueType, RightMaskType rightMask)
 {
     object[] results = this.Invoke("GetUserAllowDelegteRoles", new object[] {
                 userValue,
                 appCodeName,
                 userValueType,
                 rightMask});
     return ((System.Data.DataSet)(results[0]));
 }
コード例 #57
0
 public bool DoesUserHasAllPermissions(string userValue, string appCodeName, string funcCodeNames, UserValueType userValueType, DelegationMaskType delegationMask)
 {
     object[] results = this.Invoke("DoesUserHasAllPermissions", new object[] {
                 userValue,
                 appCodeName,
                 funcCodeNames,
                 userValueType,
                 delegationMask});
     return ((bool)(results[0]));
 }
コード例 #58
0
		/// <summary>
		/// 查询指定人员,在指定应用,指定角色中所拥有的服务范围
		/// </summary>
		/// <param name="userValue">用户身份标识(由userValueType参数指定类型)</param>
		/// <param name="appCodeName">应用的英文标识</param>
		/// <param name="roleCodeNames">角色的英文标识,多个时用逗号分隔</param>
		/// <param name="userValueType">用户身份标识类型(UserValueType.LogonName:登录名, UserValueType.AllPath:全路径)</param>
		/// <returns></returns>
		public static DataSet GetUserRolesScopes(string userValue, string appCodeName, string roleCodeNames, UserValueType userValueType)
		{
			return GetUserRolesScopes(userValue, appCodeName, roleCodeNames, userValueType, DelegationMaskType.All);
		}
コード例 #59
0
 public System.Data.DataSet GetUserApplications(string userValue, UserValueType userValueType, RightMaskType rightMask, DelegationMaskType delegationMask)
 {
     object[] results = this.Invoke("GetUserApplications", new object[] {
                 userValue,
                 userValueType,
                 rightMask,
                 delegationMask});
     return ((System.Data.DataSet)(results[0]));
 }
コード例 #60
0
		public DataSet GetUserAllowDelegteRoles(string userValue,
			string appCodeName, 
			UserValueType userValueType, 
			RightMaskType rightMask)
		{
			return SecurityCheck.GetUserAllowDelegteRoles(userValue, appCodeName, userValueType, rightMask);
		}