Beispiel #1
0
        protected override IConfigurable PrepareDataObject()
        {
            RuleStorage ruleStorage = (RuleStorage)base.PrepareDataObject();

            ruleStorage.Name = base.Name;
            ruleStorage.SetId(((ADObjectId)this.policyStorage.Identity).GetChildId(base.Name));
            ruleStorage.MasterIdentity = Guid.NewGuid();
            PsDlpComplianceRule psDlpComplianceRule = new PsDlpComplianceRule(ruleStorage)
            {
                Comment  = base.Comment,
                Disabled = base.Disabled,
                Mode     = Mode.Enforce,
                Policy   = Utils.GetUniversalIdentity(this.policyStorage),
                Workload = this.policyStorage.Workload,
                ContentPropertyContainsWords        = this.ContentPropertyContainsWords,
                ContentContainsSensitiveInformation = this.ContentContainsSensitiveInformation,
                AccessScopeIs = this.AccessScopeIs,
                BlockAccess   = this.BlockAccess
            };

            if (!psDlpComplianceRule.GetTaskActions().Any <PsComplianceRuleActionBase>())
            {
                throw new RuleContainsNoActionsException(psDlpComplianceRule.Name);
            }
            ADObjectId adobjectId;

            base.TryGetExecutingUserId(out adobjectId);
            psDlpComplianceRule.UpdateStorageProperties(this, base.DataSession as IConfigurationSession, true);
            return(ruleStorage);
        }
Beispiel #2
0
        protected override void StampChangesOn(IConfigurable dataObject)
        {
            RuleStorage ruleStorage = (RuleStorage)dataObject;

            ruleStorage.ResetChangeTracking(true);
            base.PsRulePresentationObject = new PsDlpComplianceRule(ruleStorage);
            PsDlpComplianceRule psDlpComplianceRule = (PsDlpComplianceRule)base.PsRulePresentationObject;

            base.PsRulePresentationObject.PopulateTaskProperties(this, base.DataSession as IConfigurationSession);
            if (base.PsRulePresentationObject.ReadOnly)
            {
                throw new TaskRuleIsTooAdvancedToModifyException(base.PsRulePresentationObject.Name);
            }
            if (ruleStorage.Mode == Mode.PendingDeletion)
            {
                base.WriteError(new ErrorCommonComplianceRuleIsDeletedException(ruleStorage.Name), ErrorCategory.InvalidOperation, null);
            }
            base.StampChangesOn(dataObject);
            this.CopyExplicitParameters();
            if (!psDlpComplianceRule.GetTaskActions().Any <PsComplianceRuleActionBase>())
            {
                throw new RuleContainsNoActionsException(psDlpComplianceRule.Name);
            }
            psDlpComplianceRule.UpdateStorageProperties(this, base.DataSession as IConfigurationSession, false);
        }