add roles seeding
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 8s
Build and Deploy API / build-and-deploy (push) Successful in 11s

This commit is contained in:
2026-04-21 19:13:44 -05:00
parent 214f1601b5
commit 2f3cb46af3
3 changed files with 36 additions and 19 deletions

View File

@@ -37,12 +37,13 @@ public class AuthController : ControllerBase {
// assigning roles to user
string role = "base";
if(dto.UserName == "bard") {
role = "Superuser";
role = "superuser";
} else if(dto.UserName.StartsWith("x")) {
role = "Admin";
role = "admin";
}
await userManager_.AddToRoleAsync(user, role); // TODO: error check this
// await _userManager.RemoveFromRoleAsync(user, "Admin"); // remove role
// these are here just in case you need them
// await _userManager.RemoveFromRoleAsync(user, "admin"); // remove role
// var roles = await _userManager.GetRolesAsync(user); // get list of roles for user
return CreatedAtAction(