update: 移动获取数据权限到UserManager

This commit is contained in:
2021-06-28 17:44:22 +08:00
parent b6822e3364
commit fdd35d5e58
4 changed files with 15 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ namespace Ewide.Application.Service
[HttpPost("/houseMember/page")]
public async Task<dynamic> QueryMemberPageList([FromBody] UserInput input)
{
var dataScopes = await _sysUserService.GetUserDataScopeIdList(_userManager.UserId);
var dataScopes = await _userManager.GetUserDataScopeIdList();
var sql = @"SELECT
SU.*,

View File

@@ -19,13 +19,11 @@ namespace Ewide.Core.Controller
public class AreaCodeController : IDynamicApiController
{
private readonly IAreaCodeService _areaCodeService;
private readonly ISysUserService _sysUserService;
private readonly IUserManager _userManager;
public AreaCodeController(IAreaCodeService areaCodeService, IUserManager userManager, ISysUserService sysUserService)
public AreaCodeController(IAreaCodeService areaCodeService, IUserManager userManager)
{
_areaCodeService = areaCodeService;
_userManager = userManager;
_sysUserService = sysUserService;
}
/// <summary>
/// 查询
@@ -88,7 +86,7 @@ namespace Ewide.Core.Controller
List<string> areaCodeList = null;
if (!_userManager.SuperAdmin)
{
var orgIdList = await _sysUserService.GetUserDataScopeIdList(_userManager.UserId);
var orgIdList = await _userManager.GetUserDataScopeIdList();
areaCodeList = await _areaCodeService.GetAreaCodeListByOrgId(orgIdList);
}
return await _areaCodeService.GetAreaCodeTree(level, areaCodeList);

View File

@@ -1,4 +1,6 @@
using System.Collections.Generic;
using Ewide.Core.Entity;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Ewide.Core
@@ -22,5 +24,6 @@ namespace Ewide.Core
Task<List<SysRole>> GetUserRoleList(string userId);
Task<List<SysRole>> GetUserRoleList();
Task<List<string>> GetLoginPermissionList();
Task<List<string>> GetUserDataScopeIdList();
}
}

View File

@@ -22,6 +22,7 @@ namespace Ewide.Core
private readonly IRepository<SysOrg> _sysOrgRep;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly ISysMenuService _sysMenuService;
private readonly ISysUserService _sysUserService;
public string UserId
{
@@ -55,7 +56,8 @@ namespace Ewide.Core
IRepository<SysEmp> sysEmpRep,
IRepository<SysOrg> sysOrgRep,
IHttpContextAccessor httpContextAccessor,
ISysMenuService sysMenuService)
ISysMenuService sysMenuService,
ISysUserService sysUserService)
{
_sysUserRep = sysUserRep;
_sysRoleRep = sysRoleRep;
@@ -64,6 +66,7 @@ namespace Ewide.Core
_sysOrgRep = sysOrgRep;
_httpContextAccessor = httpContextAccessor;
_sysMenuService = sysMenuService;
_sysUserService = sysUserService;
}
/// <summary>
@@ -172,5 +175,9 @@ namespace Ewide.Core
{
return _sysMenuService.GetLoginPermissionList(UserId);
}
public Task<List<string>> GetUserDataScopeIdList()
{
return _sysUserService.GetUserDataScopeIdList(UserId);
}
}
}