protected override void InternalValidate() { TaskLogger.LogEnter(); if (Server.IsSubscribedGateway(base.GlobalConfigSession)) { base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null); } base.InternalValidate(); RemoveAcceptedDomain.CheckDomainForRemoval(base.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); RemoveAcceptedDomain.DomainRemovalValidator domainRemovalValidator = new RemoveAcceptedDomain.DomainRemovalValidator(this); domainRemovalValidator.ValidateAllPolicies(); TaskLogger.LogExit(); }
protected override void InternalValidate() { if (Server.IsSubscribedGateway(base.GlobalConfigSession)) { base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null); } base.InternalValidate(); if (this.DataObject.PendingRemoval && !this.DataObject.IsChanged(AcceptedDomainSchema.PendingRemoval)) { base.WriteError(new CannotOperateOnAcceptedDomainPendingRemovalException(this.DataObject.DomainName.ToString()), ErrorCategory.InvalidOperation, null); } if (this.DataObject.PendingRemoval && this.DataObject.IsChanged(AcceptedDomainSchema.PendingRemoval)) { RemoveAcceptedDomain.CheckDomainForRemoval(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.IsChanged(ADObjectSchema.Name)) { NewAcceptedDomain.ValidateDomainName(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain)) { this.WriteWarning(Strings.WarnAboutStarAcceptedDomain); } SetAcceptedDomain.DomainEditValidator domainEditValidator = new SetAcceptedDomain.DomainEditValidator(this); domainEditValidator.ValidateAllPolicies(); if (this.DataObject.IsChanged(AcceptedDomainSchema.AcceptedDomainType) && this.DataObject.DomainType == AcceptedDomainType.ExternalRelay && (Datacenter.IsMicrosoftHostedOnly(true) || Datacenter.IsForefrontForOfficeDatacenter())) { base.WriteError(new ExternalRelayDomainsAreNotAllowedInDatacenterAndFfoException(), ErrorCategory.InvalidOperation, null); } if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient) && this.CatchAllRecipient != null) { this.resolvedCatchAllRecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.CatchAllRecipient, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.CatchAllRecipientNotExists(this.CatchAllRecipient)), new LocalizedString?(Strings.CatchAllRecipientNotUnique(this.CatchAllRecipient)), ExchangeErrorCategory.Client); } AcceptedDomainUtility.ValidateCatchAllRecipient(this.resolvedCatchAllRecipient, this.DataObject, base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient), new Task.TaskErrorLoggingDelegate(base.WriteError)); AcceptedDomainUtility.ValidateIfOutboundConnectorToRouteDomainIsPresent(base.DataSession, this.DataObject, new Task.TaskWarningLoggingDelegate(this.WriteWarning)); if (this.DataObject.IsChanged(AcceptedDomainSchema.AcceptedDomainType) || base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains)) { bool matchSubDomains = base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains) ? this.MatchSubDomains : this.DataObject.MatchSubDomains; AcceptedDomainUtility.ValidateMatchSubDomains(matchSubDomains, this.DataObject.DomainType, new Task.TaskErrorLoggingDelegate(base.WriteError)); } }
public DomainRemovalValidator(RemoveAcceptedDomain task) : base(new Task.TaskErrorLoggingDelegate(task.WriteError), (IConfigurationSession)task.DataSession, task.DataObject, null) { }