Fixed issue where using the API to request a movie/tv show would throw an exception when only using the API Key #3091

This commit is contained in:
tidusjar 2019-08-08 15:42:04 +01:00
parent 25186ba149
commit 769343a128
7 changed files with 17 additions and 14 deletions

View file

@ -1,3 +1,4 @@
using System;
using Ombi.Store.Entities;
using System.IO;
using System.Security.Claims;
@ -25,8 +26,8 @@ namespace Ombi.Core.Rule.Rules.Request
public async Task<RuleResult> Execute(BaseRequest obj)
{
var user = await _manager.Users.FirstOrDefaultAsync(x => x.UserName == User.Identity.Name);
if (await _manager.IsInRoleAsync(user, OmbiRoles.Admin))
var user = await _manager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase));
if (await _manager.IsInRoleAsync(user, OmbiRoles.Admin) || user.IsSystemUser)
return Success();
if (obj.RequestType == RequestType.Movie)