small cleanup #865

This commit is contained in:
Jamie.Rees 2017-06-02 09:24:31 +01:00
commit e0018f63fa
38 changed files with 399 additions and 552 deletions

View file

@ -1,10 +1,8 @@
using Ombi.Core.Claims;
using Ombi.Core.Models.Requests;
using Ombi.Core.Rules;
using System;
using System.Collections.Generic;
using Ombi.Store.Entities;
using System.Security.Principal;
using System.Text;
namespace Ombi.Core.Rule.Rules
{
@ -16,23 +14,20 @@ namespace Ombi.Core.Rule.Rules
}
private IPrincipal User { get; }
public RuleResult Execute(BaseRequestModel obj)
{
if(User.IsInRole(OmbiClaims.Admin))
if (User.IsInRole(OmbiClaims.Admin))
{
obj.Approved = true;
return Success();
}
if (obj.Type == Store.Entities.RequestType.Movie && User.IsInRole(OmbiClaims.AutoApproveMovie))
{
if (obj.Type == RequestType.Movie && User.IsInRole(OmbiClaims.AutoApproveMovie))
obj.Approved = true;
}
if (obj.Type == Store.Entities.RequestType.TvShow && User.IsInRole(OmbiClaims.AutoApproveTv))
{
if (obj.Type == RequestType.TvShow && User.IsInRole(OmbiClaims.AutoApproveTv))
obj.Approved = true;
}
return Success(); // We don't really care, we just don't set the obj to approve
}
}
}
}