2024-11-08 21:58:56 +08:00
|
|
|
|
using AsmResolver.PE.DotNet.Cil;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Security.Claims;
|
|
|
|
|
using static asg_form.Controllers.AssignmentController;
|
|
|
|
|
|
|
|
|
|
namespace asg_form.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class BlackDB
|
|
|
|
|
{
|
|
|
|
|
public int id { get; set; }
|
|
|
|
|
public string user_name { get; set; }
|
|
|
|
|
//.....
|
|
|
|
|
}
|
2025-01-27 20:32:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ApiController]
|
2024-11-08 21:58:56 +08:00
|
|
|
|
public class BlackController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
[Route("api/v1/blackTable")]
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<ActionResult<object>> blackAdd ([FromQuery] string userName)
|
|
|
|
|
{
|
|
|
|
|
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin")||!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
|
|
|
|
{
|
|
|
|
|
return Ok(new error_mb { code = 401, message = "无权访问" });
|
|
|
|
|
}
|
|
|
|
|
TestDbContext sub = new TestDbContext();
|
|
|
|
|
|
|
|
|
|
return Ok(new { code = 200, message = "" });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|