Просмотр исходного кода

修改默认路径和验证用户

zhoufan лет назад: 3
Родитель
Сommit
d246b49b7a

+ 22 - 22
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/App_Start/AuthorizeAttribute.cs

@@ -23,29 +23,29 @@ namespace CallCenterApi.Interface
23 23
 
24 24
             if (filterContext.RequestContext.HttpContext.Request.IsAuthenticated)
25 25
             {
26
-                var actionDescriptor = filterContext.ActionDescriptor;
27
-                var controllerDescriptor = actionDescriptor.ControllerDescriptor;
28
-                var controller = controllerDescriptor.ControllerName;
29
-                var action = actionDescriptor.ActionName;
30
-                var token = filterContext.HttpContext.Request["token"];
26
+                //var actionDescriptor = filterContext.ActionDescriptor;
27
+                //var controllerDescriptor = actionDescriptor.ControllerDescriptor;
28
+                //var controller = controllerDescriptor.ControllerName;
29
+                //var action = actionDescriptor.ActionName;
30
+                //var token = filterContext.HttpContext.Request["token"];
31 31
 
32
-                var userData = CacheHelper.Get<Cache.Models.CurrentUserInfo>(token);
33
-                var roleId = userData.F_RoleId;
34
-                var role = new BLL.T_Sys_RoleInfo().GetModel(roleId);
35
-                if (role != null)
36
-                {
37
-                    var roleFunctionList = roleFunctionBLL.DataTableToList(roleFunctionBLL.GetList(" F_RoleId=" + role.F_RoleId).Tables[0]);
38
-                    //var str = string.Join(",", roleFunctionList.Select(x => x.F_FunctionId).ToArray());
39
-                    var moduleFunction = new BLL.T_Sys_ModuleFunctions().GetModel(controller, action);
40
-                    if (moduleFunction != null)
41
-                    {
42
-                        var single = roleFunctionList.SingleOrDefault(x => x.F_FunctionId == moduleFunction.F_FunctionId);
43
-                        if (single != null)
44
-                        {
45
-                            isAuth = true;
46
-                        }
47
-                    }
48
-                }
32
+                //var userData = CacheHelper.Get<Cache.Models.CurrentUserInfo>(token);
33
+                //var roleId = userData.F_RoleId;
34
+                //var role = new BLL.T_Sys_RoleInfo().GetModel(roleId);
35
+                //if (role != null)
36
+                //{
37
+                //    var roleFunctionList = roleFunctionBLL.DataTableToList(roleFunctionBLL.GetList(" F_RoleId=" + role.F_RoleId).Tables[0]);
38
+                //    //var str = string.Join(",", roleFunctionList.Select(x => x.F_FunctionId).ToArray());
39
+                //    var moduleFunction = new BLL.T_Sys_ModuleFunctions().GetModel(controller, action);
40
+                //    if (moduleFunction != null)
41
+                //    {
42
+                //        var single = roleFunctionList.SingleOrDefault(x => x.F_FunctionId == moduleFunction.F_FunctionId);
43
+                //        if (single != null)
44
+                //        {
45
+                //            isAuth = true;
46
+                //        }
47
+                //    }
48
+                //}
49 49
             }
50 50
             else
51 51
             {

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/App_Start/RouteConfig.cs

@@ -16,7 +16,7 @@ namespace CallCenterApi.Interface
16 16
             routes.MapRoute(
17 17
                 name: "Default",
18 18
                 url: "{controller}/{action}/{id}",
19
-                defaults: new { controller = "NoWaterInfo", action = "GetData", id = UrlParameter.Optional }
19
+                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20 20
             );
21 21
         }
22 22
     }