fix(#I12EAZ): 演示模式下菜单更新时对菜单进行保护

#Comment
comment https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12EAZ

#Issues
link https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12EAZ
This commit is contained in:
Argo Zhang 2019-09-21 00:08:03 +08:00
parent e82bd0e809
commit b1b80abfc7
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 11 additions and 1 deletions

View File

@ -29,7 +29,17 @@ namespace Bootstrap.DataAccess
public static bool Save(BootstrapMenu p)
{
// 不允许保存系统菜单与前台演示系统的默认菜单
if (DictHelper.RetrieveSystemModel() && (p.Category == "0" || p.Application == "2")) return true;
if (DictHelper.RetrieveSystemModel())
{
if (p.Category == "0" || p.Application == "2") return true;
// 查找原有数据比对是否为系统菜单与演示菜单
if (!string.IsNullOrEmpty(p.Id))
{
var menus = RetrieveAllMenus("Admin").FirstOrDefault(m => m.Id.Equals(p.Id, System.StringComparison.OrdinalIgnoreCase));
if (menus != null && menus.Category == "0" || p.Application == "2") return true;
}
}
var ret = DbContextManager.Create<Menu>().Save(p);
if (ret) CacheCleanUtility.ClearCache(menuIds: string.IsNullOrEmpty(p.Id) ? new List<string>() : new List<string>() { p.Id });