|
|
|
@ -32,14 +32,7 @@ namespace Ombi.Core.Engine.Interfaces
|
|
|
|
|
private OmbiUser _user;
|
|
|
|
|
protected async Task<OmbiUser> GetUser()
|
|
|
|
|
{
|
|
|
|
|
if (IsApiUser)
|
|
|
|
|
{
|
|
|
|
|
return new OmbiUser
|
|
|
|
|
{
|
|
|
|
|
UserName = Username,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName == Username));
|
|
|
|
|
return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(Username, StringComparison.CurrentCultureIgnoreCase)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected async Task<string> UserAlias()
|
|
|
|
@ -49,10 +42,6 @@ namespace Ombi.Core.Engine.Interfaces
|
|
|
|
|
|
|
|
|
|
protected async Task<bool> IsInRole(string roleName)
|
|
|
|
|
{
|
|
|
|
|
if (IsApiUser && roleName != OmbiRoles.Disabled)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return await UserManager.IsInRoleAsync(await GetUser(), roleName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -72,7 +61,5 @@ namespace Ombi.Core.Engine.Interfaces
|
|
|
|
|
var ruleResults = await Rules.StartSpecificRules(model, rule);
|
|
|
|
|
return ruleResults;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool IsApiUser => Username.Equals("Api", StringComparison.CurrentCultureIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
}
|