Decouple UserType, add Role entity and management

Removed all UserType logic and references, replacing them with a new Role model and management system. Introduced RoleManager service, repository, and API endpoint for role CRUD operations. Updated user flows and JWT claims to use RoleCode. Removed admin-only user CRUD endpoints. Updated DI, documentation, and error handling for consistency. Appsettings and DTOs now reflect the new role-based approach.
This commit is contained in:
Dhananjaya99
2026-10-19 12:57:07 +05:30
parent fbd079d337
commit 15832d1ae3
19 changed files with 393 additions and 297 deletions
+10 -1
View File
@@ -10,11 +10,12 @@ namespace AuthHex.Controllers
[ApiController]
[Route("api")]
[EnableCors("AllowAll")]
public class APIController(UserManager userManager, RecoveryManager recoveryManager, AltOptionManager altOptionManager) : ControllerBase
public class APIController(UserManager userManager, RecoveryManager recoveryManager, AltOptionManager altOptionManager, RoleManager roleManager) : ControllerBase
{
private readonly UserManager _userManager = userManager;
private readonly RecoveryManager _recoveryManager = recoveryManager;
private readonly AltOptionManager _altOptionManager = altOptionManager;
private readonly RoleManager _roleManager = roleManager;
[HttpGet("status")]
[AllowAnonymous]
@@ -75,5 +76,13 @@ namespace AuthHex.Controllers
return StatusCode(response.StatusCode, response);
}
[HttpPost("role")]
[AllowAnonymous]
public async Task<IActionResult> RoleExecute([FromBody] ApiRequest request)
{
var response = await _roleManager.Execute(request, HttpContext);
return StatusCode(response.StatusCode, response);
}
}
}