void IPrivacyDomainRepository.AddPriorityFunctions(string domainName, PriorityFunction priority)
        {
            var filter = Builders <PrivacyDomain> .Filter.Eq("domain_name", domainName);

            var update = Builders <PrivacyDomain> .Update.Push("hierarchy", priority);

            _mongoCollection.UpdateOne(filter, update);
        }
Пример #2
0
        public void AddPriorityFunctions(string domainName, PriorityFunction priority)
        {
            var filter = Builders <PrivacyDomain> .Filter.Eq("domain_name", domainName);

            var update = Builders <PrivacyDomain> .Update.Push("hierarchy", priority);

            dbContext.GetCollection <PrivacyDomain>("PrivacyDomain").UpdateOne(filter, update);
        }
Пример #3
0
        public void Create([FromBody] SubPrivacyPolicyInsertCommand command)
        {
            bool IsResourceRequired = true;

            var fieldRules = new List <FieldRule>();

            foreach (var rule in command.Rules)
            {
                var condition = _conditionalExpressionService.Parse(rule.Condition);
                var fieldRule = new FieldRule()
                {
                    Identifer    = rule.RuleID,
                    FieldEffects = rule.FieldEffects,
                    Condition    = condition
                };
                fieldRules.Add(fieldRule);

                if (!IsResourceRequired)
                {
                    IsResourceRequired = rule.Condition.Contains("\"Resource.");
                }
            }

            var policy = new PrivacyPolicy()
            {
                CollectionName = command.CollectionName,
                Description    = command.Description,
                PolicyId       = command.PolicyID,
                Rules          = fieldRules,
                IsAttributeResourceRequired = IsResourceRequired
            };

            _privacyPolicyRepository.Add(policy);

            var priorty = new PriorityFunction()
            {
                Name = command.PolicyID, Priority = command.Priority
            };

            _privacyDomainRepository.AddPriorityFunctions(command.DomainName, priorty);
        }
Пример #4
0
 private static void AddFunction(Target target, PriorityFunction func)
 {
     TargetFunctionManager.priorityFunctions.Add(target, func);
 }