|
|
@@ -29,7 +29,7 @@ namespace MySystem
|
|
|
menu1.meta = new AdminRightListItemMeta();
|
|
|
menu1.meta.title = sub1.Title;
|
|
|
menu1.meta.icon = sub1.Icon;
|
|
|
- menu1.meta.auths = GetAuths(btnList.Where(m => m.MenuId.StartsWith(sub1.Id)).OrderBy(m => m.MenuId).ToList().Select(m => m.MenuId).ToList(), rightString, sub1.OtherRight);
|
|
|
+ menu1.meta.auths = GetAuths(btnList.Where(m => m.MenuId.StartsWith(sub1.Id)).OrderBy(m => m.MenuId).ToList().Select(m => m.MenuId).ToList(), sub1.Id, rightString, sub1.OtherRight);
|
|
|
if (menu1.meta.roles == null) menu1.meta.roles = new List<string>(){ "1" };
|
|
|
if (!menu1.meta.roles.Contains(myrole) && rightString.Contains("," + sub1.Id + ",")) menu1.meta.roles.Add(myrole);
|
|
|
List<AdminRightListItem> menuList2 = new List<AdminRightListItem>();
|
|
|
@@ -45,7 +45,7 @@ namespace MySystem
|
|
|
menu2.meta = new AdminRightListItemMeta();
|
|
|
menu2.meta.title = sub2.Title;
|
|
|
menu2.meta.icon = sub2.Icon;
|
|
|
- menu2.meta.auths = GetAuths(btnList.Where(m => m.MenuId.StartsWith(sub2.Id)).OrderBy(m => m.MenuId).ToList().Select(m => m.MenuId).ToList(), rightString, sub2.OtherRight);
|
|
|
+ menu2.meta.auths = GetAuths(btnList.Where(m => m.MenuId.StartsWith(sub2.Id)).OrderBy(m => m.MenuId).ToList().Select(m => m.MenuId).ToList(), sub2.Id, rightString, sub2.OtherRight);
|
|
|
if (menu2.meta.roles == null) menu2.meta.roles = new List<string>(){ "1" };
|
|
|
if (!menu2.meta.roles.Contains(myrole) && rightString.Contains("," + sub2.Id + ",")) menu2.meta.roles.Add(myrole);
|
|
|
List<RightDic> Level3 = list.Where(m => m.RightLevel == 3 && m.Id.StartsWith(sub2.Id)).OrderByDescending(m => m.Sort).ToList();
|
|
|
@@ -61,7 +61,7 @@ namespace MySystem
|
|
|
menu3.meta = new AdminRightListItemMeta();
|
|
|
menu3.meta.title = sub3.Title;
|
|
|
menu3.meta.icon = sub3.Icon;
|
|
|
- menu3.meta.auths = GetAuths(btnList.Where(m => m.MenuId.StartsWith(sub3.Id)).OrderBy(m => m.MenuId).ToList().Select(m => m.MenuId).ToList(), rightString, sub3.OtherRight);
|
|
|
+ menu3.meta.auths = GetAuths(btnList.Where(m => m.MenuId.StartsWith(sub3.Id)).OrderBy(m => m.MenuId).ToList().Select(m => m.MenuId).ToList(), sub3.Id, rightString, sub3.OtherRight);
|
|
|
if (menu3.meta.roles == null) menu3.meta.roles = new List<string>(){ "1" };
|
|
|
if (!menu3.meta.roles.Contains(myrole) && rightString.Contains("," + sub3.Id + ",")) menu3.meta.roles.Add(myrole);
|
|
|
menuList3.Add(menu3);
|
|
|
@@ -77,14 +77,13 @@ namespace MySystem
|
|
|
return menuList1;
|
|
|
}
|
|
|
|
|
|
- private List<string> GetAuths(List<string> auths, string rightString, string otherRight)
|
|
|
+ private List<string> GetAuths(List<string> auths, string rute, string rightString, string otherRight)
|
|
|
{
|
|
|
List<string> result = new List<string>();
|
|
|
- if(auths.Count <= 0)
|
|
|
+ if(auths.Count <= 0 && string.IsNullOrEmpty(otherRight))
|
|
|
{
|
|
|
return result;
|
|
|
}
|
|
|
- var rute = auths[0].Substring(0, auths[0].LastIndexOf("_"));
|
|
|
foreach (string auth in auths)
|
|
|
{
|
|
|
if (rightString.Contains(auth))
|