Update CheckAdminAsync

This commit is contained in:
Stanislav Mykhailenko 2023-05-30 20:54:17 +03:00
parent 4b6053b5c0
commit 11ac997ca7
GPG key ID: 1E95E66A9C9D6A36

View file

@ -58,16 +58,8 @@ namespace NG_2023_Kanban.BusinessLayer.Services
public async Task<bool> CheckAdminAsync(int id) public async Task<bool> CheckAdminAsync(int id)
{ {
var user = await GetAsync(id); var user = await GetAsync(id);
Console.WriteLine(user.Roles.Count); return user.Roles.Any(role => role.Name == "Administrator");
foreach (RoleModel role in user.Roles)
{
if (role.Name == "Administrator")
{
return true;
}
}
return false;
} }
} }
} }