Adding users endpoint to return all users to authorized users

This commit is contained in:
hz
2025-05-13 15:10:28 -07:00
parent be255ef384
commit a923dfadc2
2 changed files with 13 additions and 0 deletions
+9
View File
@@ -108,6 +108,15 @@ public class AuthController : ControllerBase
return Ok($"{request.Username}'s role updated to {request.NewRole}");
}
[HttpGet("users")]
[Authorize(Roles = "SUPER")]
public async Task<IActionResult> GetAllUsers()
{
var users = await _userService.GetAllAsync();
return Ok(users);
}
private string GenerateJwtToken(User user)
{