mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 11:38:32 -07:00
Some rules #865
This commit is contained in:
parent
d73899fc53
commit
974cb1ebb3
22 changed files with 289 additions and 131 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Core.Claims;
|
||||
using Ombi.Core.Models.Requests;
|
||||
using Ombi.Core.Rule.Interfaces;
|
||||
|
@ -15,19 +16,19 @@ namespace Ombi.Core.Rule.Rules.Request
|
|||
|
||||
private IPrincipal User { get; }
|
||||
|
||||
public RuleResult Execute(BaseRequestModel obj)
|
||||
public Task<RuleResult> Execute(BaseRequestModel obj)
|
||||
{
|
||||
if (User.IsInRole(OmbiClaims.Admin))
|
||||
{
|
||||
obj.Approved = true;
|
||||
return Success();
|
||||
return Task.FromResult(Success());
|
||||
}
|
||||
|
||||
if (obj.Type == RequestType.Movie && User.IsInRole(OmbiClaims.AutoApproveMovie))
|
||||
obj.Approved = true;
|
||||
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
|
||||
return Task.FromResult(Success()); // We don't really care, we just don't set the obj to approve
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue