This commit is contained in:
王炜翔 2025-02-18 21:26:19 +08:00
parent c834712d34
commit 17b48ce7f4

View File

@ -64,7 +64,7 @@ namespace asg_form.Controllers
{
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(userId);
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin")||!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")||!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return Ok(new error_mb { code = 401, message = "无权访问" });
}
@ -113,7 +113,7 @@ namespace asg_form.Controllers
{
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(userId);
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin") || !this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin") || !this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return Ok(new error_mb { code = 401, message = "无权访问" });
}
@ -147,7 +147,7 @@ namespace asg_form.Controllers
[Authorize]
public async Task<ActionResult<object>> blackDel([FromQuery] string idFind)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin") || !this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin") || !this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return Ok(new error_mb { code = 401, message = "无权访问" });
}