Ban and unban work

This commit is contained in:
defnotken
2025-09-05 13:27:09 -05:00
parent 7c81f880e1
commit b5aa817d0b
2 changed files with 60 additions and 0 deletions

View File

@@ -17,6 +17,24 @@ public class UserController : Controller
LightlessDbContextFactory = lightlessDbContext;
}
[Authorize(Policy = "Internal")]
[HttpPost(LightlessAuth.Ban_Uid)]
public async Task MarkForBanUid(string uid)
{
using var dbContext = await LightlessDbContextFactory.CreateDbContextAsync();
Logger.LogInformation("Banning user with UID {UID}", uid);
//Mark User as banned, and not marked for ban
var auth = await dbContext.Auth.FirstOrDefaultAsync(f => f.UserUID == uid);
if (auth != null)
{
auth.MarkForBan = true;
}
await dbContext.SaveChangesAsync();
}
[Authorize(Policy = "Internal")]
[HttpPost(LightlessAuth.User_Unban_Uid)]
public async Task UnBanUserByUid(string uid)