protected override void InternalProcessRecord() { this.DataObject.Default = !NewAcceptedDomain.DomainsExist(this.ConfigurationSession, null); this.DataObject.AddressBookEnabled = (this.DataObject.DomainType == AcceptedDomainType.Authoritative); bool flag = AcceptedDomainUtility.IsCoexistenceDomain(this.DataObject.DomainName.Domain); if (flag && !this.SkipDnsProvisioning) { this.DataObject.IsCoexistenceDomain = true; try { AcceptedDomainUtility.RegisterCoexistenceDomain(this.DataObject.DomainName.Domain); } catch (TimeoutException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, null); } catch (InvalidOperationException exception2) { base.WriteError(exception2, ErrorCategory.InvalidArgument, null); } catch (SecurityAccessDeniedException exception3) { base.WriteError(exception3, ErrorCategory.InvalidArgument, null); } catch (CommunicationException exception4) { base.WriteError(exception4, ErrorCategory.InvalidArgument, null); } } if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient)) { if (this.resolvedCatchAllRecipient != null) { this.DataObject.CatchAllRecipientID = this.resolvedCatchAllRecipient.OriginalId; } else { this.DataObject.CatchAllRecipientID = null; } } base.InternalProcessRecord(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); if (Server.IsSubscribedGateway(base.GlobalConfigSession)) { base.WriteError(new CannotRunOnSubscribedEdgeException(), ErrorCategory.InvalidOperation, null); } base.InternalValidate(); if (this.SkipDomainNameValidation) { if (!TemplateTenantConfiguration.IsTemplateTenant(base.OrganizationId)) { base.WriteError(new CannotBypassDomainNameValidationException(), ErrorCategory.InvalidOperation, null); } } else { NewAcceptedDomain.ValidateDomainName(this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.DataObject.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain)) { this.WriteWarning(Strings.WarnAboutStarAcceptedDomain); } NewAcceptedDomain.DomainAdditionValidator domainAdditionValidator = new NewAcceptedDomain.DomainAdditionValidator(this); domainAdditionValidator.ValidateAllPolicies(); if (this.DataObject.InitialDomain) { NewAcceptedDomain.ValidateInitialDomain(this.DataObject, this.ConfigurationSession, new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (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)); AcceptedDomainUtility.ValidateMatchSubDomains(this.DataObject.MatchSubDomains, this.DataObject.DomainType, new Task.TaskErrorLoggingDelegate(base.WriteError)); 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 DomainAdditionValidator(NewAcceptedDomain task) : base(new Task.TaskErrorLoggingDelegate(task.WriteError), (IConfigurationSession)task.DataSession, null, task.DataObject) { }