fix(API): Allow RequestOnBehalf rights if requested from the API (#4919)

pull/4926/head
phildups7 2 years ago committed by GitHub
parent 91e65174a9
commit bb6deddfae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -80,7 +80,8 @@ namespace Ombi.Core.Engine
var userDetails = await GetUser();
var canRequestOnBehalf = model.RequestOnBehalf.HasValue();
var isAdmin = await UserManager.IsInRoleAsync(userDetails, OmbiRoles.PowerUser)
var isAdmin = Username.Equals("API", StringComparison.CurrentCultureIgnoreCase)
|| await UserManager.IsInRoleAsync(userDetails, OmbiRoles.PowerUser)
|| await UserManager.IsInRoleAsync(userDetails, OmbiRoles.Admin);
if (canRequestOnBehalf && !isAdmin)
{

@ -161,7 +161,7 @@ namespace Ombi.Core.Engine
var user = await GetUser();
var canRequestOnBehalf = tv.RequestOnBehalf.HasValue();
var isAdmin = await UserManager.IsInRoleAsync(user, OmbiRoles.PowerUser) || await UserManager.IsInRoleAsync(user, OmbiRoles.Admin);
var isAdmin = Username.Equals("API", StringComparison.CurrentCultureIgnoreCase) || await UserManager.IsInRoleAsync(user, OmbiRoles.PowerUser) || await UserManager.IsInRoleAsync(user, OmbiRoles.Admin);
if (tv.RequestOnBehalf.HasValue() && !isAdmin)
{
return new RequestEngineResult

Loading…
Cancel
Save