update:根据权限筛选区域目录树

This commit is contained in:
2021-05-31 18:12:48 +08:00
parent 05ab0ec335
commit 5ab69ff61f
6 changed files with 58 additions and 19 deletions

View File

@@ -50,15 +50,12 @@ namespace Ewide.Core.Service.User
{
u.Delete();
});
input.GrantAreaCodeList.ForEach(u =>
var dbset = _sysUserAreaRep.Entities;
await _sysUserAreaRep.InsertAsync(input.GrantAreaCodeList.Select(u => new SysUserArea
{
new SysUserArea
{
SysUserId = input.Id,
AreaCode = u
}.Insert();
});
SysUserId = input.Id,
AreaCode = u
}));
}
}
}

View File

@@ -1,4 +1,5 @@
using Furion.DatabaseAccessor;
using Ewide.Core.Service.Role;
using Furion.DatabaseAccessor;
using Furion.DatabaseAccessor.Extensions;
using Furion.DataEncryption;
using Furion.DependencyInjection;
@@ -27,13 +28,15 @@ namespace Ewide.Core.Service
private readonly ISysEmpService _sysEmpService;
private readonly ISysUserDataScopeService _sysUserDataScopeService;
private readonly ISysUserRoleService _sysUserRoleService;
private readonly ISysUserAreaService _sysUserAreaService;
public SysUserService(IRepository<SysUser> sysUserRep,
IUserManager userManager,
ISysCacheService sysCacheService,
ISysEmpService sysEmpService,
ISysUserDataScopeService sysUserDataScopeService,
ISysUserRoleService sysUserRoleService)
ISysUserRoleService sysUserRoleService,
ISysUserAreaService sysUserAreaService)
{
_sysUserRep = sysUserRep;
_userManager = userManager;
@@ -41,6 +44,7 @@ namespace Ewide.Core.Service
_sysEmpService = sysEmpService;
_sysUserDataScopeService = sysUserDataScopeService;
_sysUserRoleService = sysUserRoleService;
_sysUserAreaService = sysUserAreaService;
}
/// <summary>
@@ -288,7 +292,16 @@ namespace Ewide.Core.Service
{
return await _sysUserDataScopeService.GetUserDataScopeIdList(input.Id);
}
/// <summary>
/// 获取用户拥有区域
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/sysUser/ownArea")]
public async Task<dynamic> GetUserOwnArea([FromQuery] QueryUserInput input)
{
return await _sysUserAreaService.GetUserAreaIdList(input.Id);
}
/// <summary>
/// 重置用户密码
/// </summary>