예제 #1
0
        /// <summary>
        /// 检查用户是否拥有某个模块的权限
        /// </summary>
        /// <param name="moduleName"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static bool CheckFunctionAccess(string moduleName, string userId)
        {
            var item = WF_M_MODULELoader.Query(string.Empty, moduleName).FirstOrDefault();

            if (item == null)
            {
                return(false);
            }
            return(QueryAuthModuleByUserId(userId).Any(a => a.ModuleId == item.ModuleId));
        }
예제 #2
0
 /// <summary>
 /// 查找用户所拥有的权限模块
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public static List <WF_M_AUTH_MODULE> QueryAuthModuleByUserId(string userId)
 {
     if (userId == "admin")
     {
         return(WF_M_MODULELoader.Query().Select(a => new WF_M_AUTH_MODULE()
         {
             ModuleId = a.ModuleId
         }).ToList());
     }
     return(QueryAuthModule(UserRoleLoader.Query(userId).Select(a => a.RoleId).Distinct().ToList()));
 }