Lots of refactoring #865

Starting to refactor the Angular Modules now
This commit is contained in:
Jamie.Rees 2017-07-07 13:25:41 +01:00
parent bad109c862
commit ffab4b7981
26 changed files with 602 additions and 267 deletions

View file

@ -1,5 +1,4 @@
using Ombi.Core.Claims;
using Ombi.Core.Rule;
using Ombi.Core.Rule;
using System.Collections.Generic;
using System.Security.Principal;
using System.Threading.Tasks;
@ -18,24 +17,13 @@ namespace Ombi.Core.Engine.Interfaces
}
protected IPrincipal User { get; }
protected IRuleEvaluator Rules { get; }
protected string Username => User.Identity.Name;
protected bool HasRole(string roleName)
{
return User.IsInRole(roleName);
}
protected bool ShouldSendNotification(BaseRequest req)
{
var sendNotification = !req.Approved; /*|| !prSettings.IgnoreNotifyForAutoApprovedRequests;*/
if (HasRole(OmbiClaims.Admin))
sendNotification = false; // Don't bother sending a notification if the user is an admin
return sendNotification;
}
public async Task<IEnumerable<RuleResult>> RunRequestRules(BaseRequest model)
{