diff --git a/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs b/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs index 8fa618fc..0924f7c3 100644 --- a/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs +++ b/Src/Dlhis.Sys/Identity/Controllers/RolesController.cs @@ -34,6 +34,17 @@ public class RolesController : ControllerBase return await _roleService.GetPageAsync(request); } + /// + /// 角色列表 + /// + /// + [Authorize(Roles = "admin")] + [HttpGet("list")] + public async Task> GetListAsync() + { + return await _roleService.GetListAsync(); + } + /// /// 分配角色 /// diff --git a/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs b/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs index 0b233448..03cd8c23 100644 --- a/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs +++ b/Src/Dlhis.Sys/Identity/Response/RoleRespone.cs @@ -7,4 +7,9 @@ public class RoleRespone public string Name { get; set; } public string NormalizedName { get; set; } + + /// + /// 是否可编辑 + /// + public bool Editable => Id > 5; } diff --git a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs index d11dec11..45ff5c74 100644 --- a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs +++ b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs @@ -4,25 +4,58 @@ public class UserResponse { public int Id { get; set; } + /// + /// 账号名称 + /// public string UserName { get; set; } + /// + /// 规范化账号名称 + /// public string NormalizedUserName { get; set; } + /// + /// 邮件 + /// public string Email { get; set; } + /// + /// 规范化邮件 + /// public string NormalizedEmail { get; set; } + /// + /// 邮件是否已确认 + /// public bool EmailConfirmed { get; set; } + /// + /// 手机号 + /// public string PhoneNumber { get; set; } + /// + /// 手机号是否已确认 + /// public bool PhoneNumberConfirmed { get; set; } + /// + /// 是否开启双因素认证 + /// public bool TwoFactorEnabled { get; set; } + /// + /// 账号锁定结束时间 + /// public DateTime? LockoutEnd { get; set; } + /// + /// 是否开启账号锁定功能 + /// public bool LockoutEnabled { get; set; } + /// + /// 登陆失败次数 + /// public int AccessFailedCount { get; set; } } diff --git a/Src/Dlhis.Sys/Identity/Services/IRoleService.cs b/Src/Dlhis.Sys/Identity/Services/IRoleService.cs index eb101cc1..3b789429 100644 --- a/Src/Dlhis.Sys/Identity/Services/IRoleService.cs +++ b/Src/Dlhis.Sys/Identity/Services/IRoleService.cs @@ -8,6 +8,8 @@ public interface IRoleService : IScopeDependency { Task> GetPageAsync(RolePageRequest request); + Task> GetListAsync(); + Task SaveRoleAsync(RoleSaveRequest request); Task GetMyRoleAsync(); diff --git a/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs index 399b1d7f..38cd025a 100644 --- a/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs +++ b/Src/Dlhis.Sys/Identity/Services/Implements/RoleService.cs @@ -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> GetListAsync() + { + return await Scoped.Request.Value.CreateAsync(async sp => + { + var dbContext = sp.GetService(); + var identityConnection = _configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value; + dbContext.Client.CurrentConnectionConfig.ConnectionString = identityConnection; + + + return await dbContext.Queryable() + .Select() + .ToListAsync(); + }); + } }