fix 更新注释和role-list

This commit is contained in:
2024-02-22 14:46:43 +08:00
parent 170b6a1202
commit 1ccacdf04d
5 changed files with 67 additions and 0 deletions

View File

@@ -34,6 +34,17 @@ public class RolesController : ControllerBase
return await _roleService.GetPageAsync(request);
}
/// <summary>
/// 角色列表
/// </summary>
/// <returns></returns>
[Authorize(Roles = "admin")]
[HttpGet("list")]
public async Task<List<RoleRespone>> GetListAsync()
{
return await _roleService.GetListAsync();
}
/// <summary>
/// 分配角色
/// </summary>

View File

@@ -7,4 +7,9 @@ public class RoleRespone
public string Name { get; set; }
public string NormalizedName { get; set; }
/// <summary>
/// 是否可编辑
/// </summary>
public bool Editable => Id > 5;
}

View File

@@ -4,25 +4,58 @@ public class UserResponse
{
public int Id { get; set; }
/// <summary>
/// 账号名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 规范化账号名称
/// </summary>
public string NormalizedUserName { get; set; }
/// <summary>
/// 邮件
/// </summary>
public string Email { get; set; }
/// <summary>
/// 规范化邮件
/// </summary>
public string NormalizedEmail { get; set; }
/// <summary>
/// 邮件是否已确认
/// </summary>
public bool EmailConfirmed { get; set; }
/// <summary>
/// 手机号
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// 手机号是否已确认
/// </summary>
public bool PhoneNumberConfirmed { get; set; }
/// <summary>
/// 是否开启双因素认证
/// </summary>
public bool TwoFactorEnabled { get; set; }
/// <summary>
/// 账号锁定结束时间
/// </summary>
public DateTime? LockoutEnd { get; set; }
/// <summary>
/// 是否开启账号锁定功能
/// </summary>
public bool LockoutEnabled { get; set; }
/// <summary>
/// 登陆失败次数
/// </summary>
public int AccessFailedCount { get; set; }
}

View File

@@ -8,6 +8,8 @@ public interface IRoleService : IScopeDependency
{
Task<Pagination<RoleRespone>> GetPageAsync(RolePageRequest request);
Task<List<RoleRespone>> GetListAsync();
Task SaveRoleAsync(RoleSaveRequest request);
Task<RoleRespone> GetMyRoleAsync();

View File

@@ -9,6 +9,7 @@ using Kurisu.Core.DataAccess.Dto;
using Kurisu.Core.User.Abstractions;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
using Org.BouncyCastle.Asn1.Ocsp;
namespace Dlhis.Sys.Identity.Services.Implements;
@@ -172,4 +173,19 @@ public class RoleService : IRoleService
await dbContext.DeleteReallyAsync(role);
});
}
public async Task<List<RoleRespone>> GetListAsync()
{
return await Scoped.Request.Value.CreateAsync(async sp =>
{
var dbContext = sp.GetService<IDbContext>();
var identityConnection = _configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value;
dbContext.Client.CurrentConnectionConfig.ConnectionString = identityConnection;
return await dbContext.Queryable<RoleEntity>()
.Select<RoleRespone>()
.ToListAsync();
});
}
}