【更新】调整菜单管理反射获取所有Controller和Action授权的方法。【修复】数据库SysMenu表修复path路径与访问的文件夹或文件大小写不一致,导致linux下404的问题。

pull/150/head
JianWeie 3 years ago
parent 86c04ca1ed
commit 50b5d2d586

@ -37,7 +37,7 @@ namespace CoreCms.Net.Filter
var controllers = types.Where(p => p.Name.Contains("Controller") && !noController.Contains(p.Name));
foreach (var type in controllers)
{
if (type.Name.Length > 10 && type.BaseType.Name == "Controller" && type.Name.EndsWith("Controller")) //如果是Controller
if (type.Name.Length > 10 && type.BaseType.Name == "ControllerBase" && type.Name.EndsWith("Controller")) //如果是Controller
{
var members = type.GetMethods();
var cp = new ControllerPermission
@ -56,12 +56,18 @@ namespace CoreCms.Net.Filter
var newMembers = members.Where(p =>
p.ReturnType.Name == "ActionResult" || p.ReturnType.Name == "FileResult" ||
p.ReturnType.Name == "JsonResult" || (p.ReturnType.GenericTypeArguments.Length > 0 && p.ReturnType.GenericTypeArguments[0].Name == "JsonResult")).ToList();
p.ReturnType.FullName != null && (p.ReturnType.Name == "ActionResult" ||
p.ReturnType.Name == "FileResult" ||
p.ReturnType.Name == "JsonResult" ||
(p.ReturnType.GenericTypeArguments.Length > 0 && p.ReturnType.GenericTypeArguments[0].Name == "JsonResult") ||
p.ReturnType.Name == "AdminUiCallBack" ||
p.ReturnType.Name == "IActionResult" ||
p.ReturnType.FullName.Contains("CoreCms.Net.Model.ViewModels.UI.AdminUiCallBack"))
).ToList();
foreach (var member in newMembers)
{
if (member.Name == "ValidationProblem" || member.Name =="Json") continue;
if (member.Name == "ValidationProblem" || member.Name == "Json") continue;
//if (member.ReturnType.Name == "ActionResult" || member.ReturnType.Name == "FileResult" || member.ReturnType.Name == "JsonResult" || (member.ReturnType.GenericTypeArguments.Length > 0 && member.ReturnType.GenericTypeArguments[0].Name == "JsonResult")) //如果是Action
//{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,3 +1,6 @@
2021-10-14
1、数据库结构无变化只是调整几个已知后台菜单链接与文件夹或文件大小写不统一的问题。
2021-10-12
1、后端开启颗粒化权限控制数据库结构无变化只是增加了不同菜单对不同Controller和Action的控制关联及管理员的关联权限。

Loading…
Cancel
Save