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)
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue