feature: Digitization Workstation UI
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
/// <summary>
|
||||
/// User directory for batch assignment and operational lookups.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/v1/users")]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
public class UsersController : ControllerBase
|
||||
{
|
||||
private readonly IUserDirectoryService _users;
|
||||
|
||||
public UsersController(IUserDirectoryService users) => _users = users;
|
||||
|
||||
/// <summary>
|
||||
/// Lists active users, optionally filtered by role.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Authorize(Roles = "INTAKE_CLERK,ADMINISTRATOR")]
|
||||
[ProducesResponseType(typeof(ApiResponse<IReadOnlyList<UserSummaryResponse>>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> List([FromQuery] string? role)
|
||||
{
|
||||
UserRole? parsedRole = null;
|
||||
if (!string.IsNullOrWhiteSpace(role))
|
||||
parsedRole = UserRoleExtensions.FromDbString(role);
|
||||
|
||||
var results = await _users.ListByRoleAsync(parsedRole);
|
||||
return Ok(ApiResponse<IReadOnlyList<UserSummaryResponse>>.Ok(results));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user