From 715857b2baf33011f9c75750a3f632a537c216b7 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 17 May 2019 16:36:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(#IWON2):=20=E5=89=8D=E5=8F=B0=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E7=B3=BB=E7=BB=9F=E9=BB=98=E8=AE=A4=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E4=BB=A5=E8=A2=AB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment 前台演示系统的默认菜单保护 comment #IWON2 #Issue close https://gitee.com/LongbowEnterprise/dashboard/issues?id=IWON2 --- Bootstrap.DataAccess/Helper/MenuHelper.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Bootstrap.DataAccess/Helper/MenuHelper.cs b/Bootstrap.DataAccess/Helper/MenuHelper.cs index 012fd24d..95fd5ca0 100644 --- a/Bootstrap.DataAccess/Helper/MenuHelper.cs +++ b/Bootstrap.DataAccess/Helper/MenuHelper.cs @@ -1,4 +1,4 @@ -using Bootstrap.Security; +using Bootstrap.Security; using Bootstrap.Security.DataAccess; using Longbow.Cache; using Longbow.Data; @@ -59,8 +59,9 @@ namespace Bootstrap.DataAccess { if (DictHelper.RetrieveSystemModel()) { - // 允许删除自定义菜单 - var systemMenus = RetrieveAllMenus("Admin").Where(m => m.Category == "0"); + // 不允许删除系统菜单与前台演示系统的默认菜单 + var menuNames = new string[] { "首页", "测试页面", "关于", "返回码云" }; + var systemMenus = RetrieveAllMenus("Admin").Where(m => m.Category == "0" || menuNames.Any(n => n.Equals(m.Name, StringComparison.OrdinalIgnoreCase))); value = value.Where(v => !systemMenus.Any(m => m.Id == v)); if (!value.Any()) return true; }