Ban and unban work
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user