fix 权限递归获取
This commit is contained in:
@@ -119,8 +119,21 @@ public class MenuService : IMenuService
|
||||
|
||||
public async Task<List<string>> GetAllAssignmentPermissionsAsync()
|
||||
{
|
||||
var all = await GetAllAssignmentCodesAsync();
|
||||
return await _dbContext.Queryable<MenuEntity>().Where(x => all.Contains(x.Code)).Select(x => x.Permission).ToListAsync();
|
||||
var menus = await GetCurrentMenusAsync();
|
||||
return GetPermissions(menus).ToList();
|
||||
|
||||
IEnumerable<string> GetPermissions(List<MenuResponse> innerMenuResponses)
|
||||
{
|
||||
foreach (var item in innerMenuResponses)
|
||||
{
|
||||
yield return item.Permission;
|
||||
|
||||
foreach (var item1 in GetPermissions(item.Items))
|
||||
{
|
||||
yield return item1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<MenuResponse>> GetCurrentMenusAsync()
|
||||
|
||||
Reference in New Issue
Block a user