private JArray RecursivePrivacyProcess(string policyName, JArray nestedArrayResource, Subject subject, EnvironmentObject environment) { var policyID = policyName.Split('.')[1]; var policy = _privacyPolicyRepository.GetById(policyID); var result = new JArray(); foreach (var token in nestedArrayResource) { var record = (JObject)token; var fieldCollectionRules = new Dictionary <string, string>(); foreach (var rule in policy.Rules) { bool isRuleApplied = _expressionService.Evaluate(rule.Condition, subject.Data, record, environment.Data); if (isRuleApplied) { foreach (var fieldEffect in rule.FieldEffects) { if (!fieldCollectionRules.ContainsKey(fieldEffect.Name)) { fieldCollectionRules.Add(fieldEffect.Name, fieldEffect.FunctionApply); } else { fieldCollectionRules[fieldEffect.Name] = fieldEffect.FunctionApply; } } } } //result.Add(PrivacyProcessing(record, fieldCollectionRules, subject, environment)); } return(result); }
public DLModel.PrivacyPolicy GetPrivacyPolicyByID(int PrivacyPolicyID) { return((DLModel.PrivacyPolicy) new DLModel.PrivacyPolicy().InjectFrom(_privacyPolicyRepository.GetById(PrivacyPolicyID))); }