asg_backend/asg_form/Controllers/BlackController.cs
2024-11-08 21:58:56 +08:00

31 lines
962 B
C#

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; }
//.....
}
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 = "" });
}
}
}