//internal static Boolean IsAllowedFull(InputParams input, IAllower Allower, List<NormalRule> nrules) //{ // List<NormalRule> InterestedRules = getInterestedRulesFull(input, nrules); // if (InterestedRules.Count == 0) // { // return false; // CWA: by default the input is not allowed in case the rule is not present // } // else // { // return !InterestedRules.Exists(ir => Allower.getAllowance(ir.Allow) == false); // } //} //// faster because it is using indexes //public Boolean IsAllowedFast(IInternalLicenseFilter filter, IAllower Allower) //{ // var input = FromFilterToInput(filter); // return IsAllowedFast(input, Allower); //} public Boolean IsAllowedFast(InputParams input, IAllower Allower) { List <NormalRule> InterestedRules = getInterestedRulesFast(input, this.NormalRules); if (InterestedRules.Count == 0) { return(false); // CWA: by default the input is not allowed in case the rule is not present } else { var result = !InterestedRules.Exists(ir => Allower.getAllowance(ir.Allow) == false); return(result); } }
internal Boolean IsAllowedSlim(InputParams input, IAllower Allower) { return(!NormalRules.Where(nr => ComparableFields.isContainedSlim(input, nr)).Any(ir => Allower.getAllowance(ir.Allow) == false)); }
// iscontained using only fileds not filtered by the license manager public Boolean IsAllowedSlim(ILicenseFilter filter, IAllower Allower) { var input = FromFilterToInputSlim((IInternalLicenseFilter)filter); return(IsAllowedSlim(input, Allower)); }