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); }
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); }
protected override void WriteResult(IConfigurable dataObject) { PsDlpComplianceRule psDlpComplianceRule = new PsDlpComplianceRule(dataObject as RuleStorage); psDlpComplianceRule.PopulateTaskProperties(this, base.DataSession as IConfigurationSession); base.WriteResult(psDlpComplianceRule); }
protected override void WriteResult(IConfigurable dataObject) { PsDlpComplianceRule psDlpComplianceRule = new PsDlpComplianceRule(dataObject as RuleStorage); psDlpComplianceRule.PopulateTaskProperties(this, base.DataSession as IConfigurationSession); if (psDlpComplianceRule.ReadOnly) { this.WriteWarning(Strings.WarningTaskRuleIsTooAdvancedToRead(psDlpComplianceRule.Name)); } base.WriteResult(psDlpComplianceRule); }
protected override void InternalValidate() { base.InternalValidate(); PsDlpComplianceRule psDlpComplianceRule = new PsDlpComplianceRule(base.DataObject); psDlpComplianceRule.PopulateTaskProperties(this, base.DataSession as IConfigurationSession); if (psDlpComplianceRule.ReadOnly && !base.ForceDeletion) { throw new TaskRuleIsTooAdvancedToModifyException(psDlpComplianceRule.Name); } }
internal override void UpdateStorageProperties(Task task, IConfigurationSession configurationSession, bool isNewRule) { base.UpdateStorageProperties(task, configurationSession, isNewRule); if (base.ObjectState != ObjectState.Unchanged) { PolicyRule policyRule = new PolicyRule { Condition = PsDlpComplianceRule.ConvertTaskConditionsToEngineCondition(this.GetTaskConditions()), Actions = PsDlpComplianceRule.ConvertTaskActionsToEngineActions(this.GetTaskActions()), Comments = base.Comment, Enabled = (base.Enabled ? RuleState.Enabled : RuleState.Disabled), ImmutableId = base.Guid, Name = base.Name }; base.RuleBlob = this.GetRuleXmlFromPolicyRule(policyRule); } }
internal override void PopulateTaskProperties(Task task, IConfigurationSession configurationSession) { base.PopulateTaskProperties(task, configurationSession); if (!string.IsNullOrEmpty(base.RuleBlob)) { PolicyRule policyRuleFromRuleBlob = this.GetPolicyRuleFromRuleBlob(); if (policyRuleFromRuleBlob.IsTooAdvancedToParse) { base.ReadOnly = true; } else { this.SetTaskConditions(PsDlpComplianceRule.ConvertEngineConditionToTaskConditions(policyRuleFromRuleBlob.Condition)); this.SetTaskActions(PsDlpComplianceRule.ConvertEngineActionsToTaskActions(policyRuleFromRuleBlob.Actions)); } base.ResetChangeTracking(); } }
protected override void CopyExplicitParameters() { base.CopyExplicitParameters(); PsDlpComplianceRule psDlpComplianceRule = (PsDlpComplianceRule)base.PsRulePresentationObject; if (base.Fields.IsModified("ContentContainsSensitiveInformation")) { psDlpComplianceRule.ContentContainsSensitiveInformation = this.ContentContainsSensitiveInformation; } if (base.Fields.IsModified(PsDlpComplianceRuleSchema.ContentPropertyContainsWords)) { psDlpComplianceRule.ContentPropertyContainsWords = this.ContentPropertyContainsWords; } if (base.Fields.IsModified(PsDlpComplianceRuleSchema.AccessScopeIs)) { psDlpComplianceRule.AccessScopeIs = this.AccessScopeIs; } if (base.Fields.IsModified(PsDlpComplianceRuleSchema.BlockAccess)) { psDlpComplianceRule.BlockAccess = this.BlockAccess; } }