新增获取角色列表接口
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Apimanager_backend.Dtos;
|
||||
using Apimanager_backend.Exceptions;
|
||||
using Apimanager_backend.Models;
|
||||
using Apimanager_backend.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -145,5 +146,15 @@ namespace Apimanager_backend.Controllers
|
||||
return Ok(res);
|
||||
}
|
||||
#endregion
|
||||
#region 获取角色列表
|
||||
[HttpGet]
|
||||
[Authorize(Roles = "Admin")]
|
||||
public async Task<ActionResult<ResponseBase<List<UserRole>>>> GetRoles()
|
||||
{
|
||||
var userRoles = await adminService.GetRolesAsync();
|
||||
var res = new ResponseBase<List<UserRole>>(userRoles);
|
||||
return Ok(res);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user