Exemple #1
0
 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();
 }
Exemple #2
0
 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));
     }
 }