update:路由权限判断放到userManager中
This commit is contained in:
@@ -21,5 +21,6 @@ namespace Ewide.Core
|
|||||||
Task<List<string>> GetUserRoleIdList();
|
Task<List<string>> GetUserRoleIdList();
|
||||||
Task<List<SysRole>> GetUserRoleList(string userId);
|
Task<List<SysRole>> GetUserRoleList(string userId);
|
||||||
Task<List<SysRole>> GetUserRoleList();
|
Task<List<SysRole>> GetUserRoleList();
|
||||||
|
Task<List<string>> GetLoginPermissionList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Ewide.Core.Service;
|
||||||
|
|
||||||
namespace Ewide.Core
|
namespace Ewide.Core
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,7 @@ namespace Ewide.Core
|
|||||||
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
|
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
|
||||||
private readonly IRepository<SysOrg> _sysOrgRep;
|
private readonly IRepository<SysOrg> _sysOrgRep;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly ISysMenuService _sysMenuService;
|
||||||
|
|
||||||
public string UserId
|
public string UserId
|
||||||
{
|
{
|
||||||
@@ -52,7 +54,8 @@ namespace Ewide.Core
|
|||||||
IRepository<SysUserRole> sysUserRoleRep,
|
IRepository<SysUserRole> sysUserRoleRep,
|
||||||
IRepository<SysEmp> sysEmpRep,
|
IRepository<SysEmp> sysEmpRep,
|
||||||
IRepository<SysOrg> sysOrgRep,
|
IRepository<SysOrg> sysOrgRep,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
ISysMenuService sysMenuService)
|
||||||
{
|
{
|
||||||
_sysUserRep = sysUserRep;
|
_sysUserRep = sysUserRep;
|
||||||
_sysRoleRep = sysRoleRep;
|
_sysRoleRep = sysRoleRep;
|
||||||
@@ -60,6 +63,7 @@ namespace Ewide.Core
|
|||||||
_sysEmpRep = sysEmpRep;
|
_sysEmpRep = sysEmpRep;
|
||||||
_sysOrgRep = sysOrgRep;
|
_sysOrgRep = sysOrgRep;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_sysMenuService = sysMenuService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -163,5 +167,10 @@ namespace Ewide.Core
|
|||||||
{
|
{
|
||||||
return await GetUserRoleList(UserId);
|
return await GetUserRoleList(UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<List<string>> GetLoginPermissionList()
|
||||||
|
{
|
||||||
|
return _sysMenuService.GetLoginPermissionList(UserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ namespace Ewide.Web.Core
|
|||||||
if (defalutRoute.Contains(routeName)) return true;
|
if (defalutRoute.Contains(routeName)) return true;
|
||||||
|
|
||||||
// 获取用户权限集合(按钮或API接口)
|
// 获取用户权限集合(按钮或API接口)
|
||||||
var permissionList = await App.GetService<ISysMenuService>().GetLoginPermissionList(userManager.UserId);
|
var permissionList = await userManager.GetLoginPermissionList();
|
||||||
|
|
||||||
// 检查授权
|
// 检查授权
|
||||||
return permissionList.Contains(routeName);
|
return permissionList.Contains(routeName);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
webpack: {
|
webpack: {
|
||||||
plugins: [
|
plugins: [
|
||||||
new MonacoWebpackPlugin()
|
// new MonacoWebpackPlugin()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user