|
@@ -179,6 +179,9 @@ public class RoleController : BaseController
|
|
|
return await _systemDataTableRepository.Queryable().ToListAsync();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取数据表
|
|
|
+ /// </summary>
|
|
|
[HttpGet("tables")]
|
|
|
public IReadOnlyList<KeyValuePair<string, string>> GetTables([FromServices] ISugarUnitOfWork<HotlineDbContext> uow)
|
|
|
{
|
|
@@ -204,6 +207,9 @@ public class RoleController : BaseController
|
|
|
await _systemDataAuthorityRepository.AddAsync(dataAuthority);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 新增数据权限
|
|
|
+ /// </summary>
|
|
|
[HttpPost("accesslevel")]
|
|
|
public async Task<string> AddAccessLevel([FromBody] AddAccessLevelDto dto)
|
|
|
{
|
|
@@ -231,6 +237,9 @@ public class RoleController : BaseController
|
|
|
await _systemDataAuthorityRepository.UpdateAsync(entity, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 修改数据权限
|
|
|
+ /// </summary>
|
|
|
[HttpPut("accesslevel")]
|
|
|
public async Task UpdateAccessLevel([FromBody] UpdateDataAuthorityDto dto)
|
|
|
{
|
|
@@ -248,6 +257,7 @@ public class RoleController : BaseController
|
|
|
/// <returns></returns>
|
|
|
[Permission(EPermission.RemoveDataAuthority)]
|
|
|
[HttpDelete("remove-data-authority/{id}")]
|
|
|
+ [Obsolete]
|
|
|
public async Task RemoveDataAuthority(string id)
|
|
|
{
|
|
|
var entity = await _systemDataAuthorityRepository.GetAsync(id, HttpContext.RequestAborted);
|
|
@@ -257,6 +267,15 @@ public class RoleController : BaseController
|
|
|
await _systemDataAuthorityRepository.RemoveAsync(id);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 删除数据权限
|
|
|
+ /// </summary>
|
|
|
+ [HttpDelete("accesslevel/{id}")]
|
|
|
+ public async Task RemoveAccessLevel(string id)
|
|
|
+ {
|
|
|
+ await _tableAccessLevelRepository.RemoveAsync(id, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取角色所有数据权限设置
|
|
|
/// </summary>
|
|
@@ -264,11 +283,24 @@ public class RoleController : BaseController
|
|
|
/// <returns></returns>
|
|
|
[Permission(EPermission.GetDataAuthorityByRole)]
|
|
|
[HttpGet("getdataauthoritybyrole")]
|
|
|
+ [Obsolete]
|
|
|
public async Task<IReadOnlyList<SystemDataAuthority>> GetDataAuthorityByRole(string roleid)
|
|
|
{
|
|
|
return await _systemDataAuthorityRepository.Queryable().Where(x => x.RoleId == roleid).Includes(x => x.Table).Includes(x => x.Role).ToListAsync();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取角色所有数据权限设置
|
|
|
+ /// </summary>
|
|
|
+ [HttpGet("accesslevels")]
|
|
|
+ public async Task<IReadOnlyList<TableAccessLevel>> GetAccessLevels(string roleCode)
|
|
|
+ {
|
|
|
+ return await _tableAccessLevelRepository.Queryable()
|
|
|
+ .Where(d => d.RoleCode == roleCode)
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region private
|