fix(API): Fixed an issue where the API key couldn't delete a request #4489

This commit is contained in:
tidusjar 2022-02-03 09:00:05 +00:00
parent 34aa07c331
commit 8e42dbf8f7
2 changed files with 14 additions and 1 deletions

View file

@ -45,7 +45,12 @@ namespace Ombi.Core.Engine.Interfaces
protected async Task<bool> IsInRole(string roleName)
{
return await UserManager.IsInRoleAsync(await GetUser(), roleName);
if (Username.Equals("API", StringComparison.CurrentCultureIgnoreCase))
{
return true;
}
var user = await GetUser();
return await UserManager.IsInRoleAsync(user, roleName);
}
public async Task<IEnumerable<RuleResult>> RunRequestRules(BaseRequest model)