Пример #1
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            AuditConfigurationPolicy auditConfigurationPolicy = new AuditConfigurationPolicy(dataObject as PolicyStorage);

            base.PopulateDistributionStatus(auditConfigurationPolicy, dataObject as PolicyStorage);
            base.WriteResult(auditConfigurationPolicy);
        }
Пример #2
0
        protected override void InternalProcessRecord()
        {
            Func <ErrorRecord, bool> predicate = (ErrorRecord e) => !(e.Exception is ManagementObjectNotFoundException);

            foreach (Workload workload in AuditConfigUtility.AuditableWorkloads)
            {
                IEnumerable <ErrorRecord> errRecords;
                AuditConfigurationPolicy  auditConfigurationPolicy = AuditConfigUtility.GetAuditConfigurationPolicy(workload, this.Organization, out errRecords);
                if (AuditConfigUtility.ValidateErrorRecords(this, errRecords, predicate) && auditConfigurationPolicy != null)
                {
                    AuditConfigurationRule auditConfigurationRule = AuditConfigUtility.GetAuditConfigurationRule(workload, this.Organization, out errRecords);
                    if (AuditConfigUtility.ValidateErrorRecords(this, errRecords, predicate) && auditConfigurationRule != null)
                    {
                        this.WriteResult(new AuditConfig(workload)
                        {
                            Setting = AuditConfigUtility.ValidateAuditConfigurationRule(workload, auditConfigurationRule),
                            PolicyDistributionStatus = PolicyApplyStatus.Success,
                            DistributionResults      = auditConfigurationPolicy.DistributionResults
                        });
                    }
                }
            }
        }
Пример #3
0
        protected override void InternalProcessRecord()
        {
            Func <ErrorRecord, bool> predicate = (ErrorRecord e) => !(e.Exception is ManagementObjectNotFoundException);

            foreach (Workload workload in AuditConfigUtility.AuditableWorkloads)
            {
                AuditSwitchStatus auditSwitch = this.Workload.Contains(workload) ? AuditSwitchStatus.On : AuditSwitchStatus.Off;
                MultiValuedProperty <AuditableOperations> auditOperations = AuditConfigUtility.GetAuditOperations(workload, auditSwitch);
                IEnumerable <ErrorRecord> errRecords;
                AuditConfigurationRule    auditConfigurationRule = AuditConfigUtility.GetAuditConfigurationRule(workload, this.Organization, out errRecords);
                if (AuditConfigUtility.ValidateErrorRecords(this, errRecords, predicate))
                {
                    if (auditConfigurationRule != null)
                    {
                        AuditConfigUtility.SetAuditConfigurationRule(workload, this.Organization, auditOperations, out errRecords);
                        AuditConfigUtility.ValidateErrorRecords(this, errRecords);
                    }
                    else
                    {
                        AuditConfigurationPolicy auditConfigurationPolicy = AuditConfigUtility.GetAuditConfigurationPolicy(workload, this.Organization, out errRecords);
                        if (AuditConfigUtility.ValidateErrorRecords(this, errRecords, predicate))
                        {
                            if (auditConfigurationPolicy == null)
                            {
                                auditConfigurationPolicy = AuditConfigUtility.NewAuditConfigurationPolicy(workload, this.Organization, out errRecords);
                                if (!AuditConfigUtility.ValidateErrorRecords(this, errRecords))
                                {
                                    continue;
                                }
                            }
                            auditConfigurationRule = AuditConfigUtility.NewAuditConfigurationRule(workload, this.Organization, auditOperations, out errRecords);
                            AuditConfigUtility.ValidateErrorRecords(this, errRecords);
                        }
                    }
                }
            }
        }
        protected override void WriteResult(IConfigurable dataObject)
        {
            AuditConfigurationPolicy result = new AuditConfigurationPolicy(dataObject as PolicyStorage);

            base.WriteResult(result);
        }