1
This commit is contained in:
parent
ed751b328c
commit
6a8c152623
@ -64,7 +64,7 @@ namespace asg_form.Controllers
|
|||||||
{
|
{
|
||||||
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||||
var user = await userManager.FindByIdAsync(userId);
|
var user = await userManager.FindByIdAsync(userId);
|
||||||
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")||!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
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 = "无权访问" });
|
return Ok(new error_mb { code = 401, message = "无权访问" });
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ namespace asg_form.Controllers
|
|||||||
{
|
{
|
||||||
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||||
var user = await userManager.FindByIdAsync(userId);
|
var user = await userManager.FindByIdAsync(userId);
|
||||||
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin") || !this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
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 = "无权访问" });
|
return Ok(new error_mb { code = 401, message = "无权访问" });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user