Update CheckAdminAsync
This commit is contained in:
parent
4b6053b5c0
commit
11ac997ca7
1 changed files with 2 additions and 10 deletions
|
@ -58,16 +58,8 @@ namespace NG_2023_Kanban.BusinessLayer.Services
|
|||
public async Task<bool> CheckAdminAsync(int id)
|
||||
{
|
||||
var user = await GetAsync(id);
|
||||
|
||||
Console.WriteLine(user.Roles.Count);
|
||||
foreach (RoleModel role in user.Roles)
|
||||
{
|
||||
if (role.Name == "Administrator")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return user.Roles.Any(role => role.Name == "Administrator");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue