Merge pull request #2973 from Patricol/master

fix album-request-permission error message
pull/3016/head
Jamie 6 years ago committed by GitHub
commit 54c5765c5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,6 @@
using System.Security.Claims; using Ombi.Store.Entities;
using System.IO;
using System.Security.Claims;
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -37,16 +39,24 @@ namespace Ombi.Core.Rule.Rules.Request
if (obj.RequestType == RequestType.TvShow) if (obj.RequestType == RequestType.TvShow)
{ {
if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestTv) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveTv)) if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestTv) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveTv))
return Success(); {
return TSuccess();
}
return Fail("You do not have permissions to Request a TV Show");
} }
if (obj.RequestType == RequestType.Album) if (obj.RequestType == RequestType.Album)
{ {
if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestMusic) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveMusic)) if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestMusic) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveMusic))
{
return Success(); return Success();
}
return Fail("You do not have permissions to Request an Album");
} }
return Fail("You do not have permissions to Request a TV Show"); throw new InvalidDataException("Permission check failed: unknown RequestType");
} }
} }
} }

Loading…
Cancel
Save