protected override void InternalProcessRecord()
 {
     if (base.DataObject.IsCoexistenceDomain)
     {
         try
         {
             AcceptedDomainUtility.DeregisterCoexistenceDomain(base.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);
         }
     }
     base.InternalProcessRecord();
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
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));
     }
 }
Exemplo n.º 5
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (this.makeDefault && !this.DataObject.Default)
            {
                this.DataObject.Default = true;
                ADPagedReader <AcceptedDomain> adpagedReader = ((IConfigurationSession)base.DataSession).FindPaged <AcceptedDomain>(this.DataObject.Id.Parent, QueryScope.OneLevel, null, null, 0);
                foreach (AcceptedDomain acceptedDomain in adpagedReader)
                {
                    if (acceptedDomain.Default)
                    {
                        acceptedDomain.Default = false;
                        base.DataSession.Save(acceptedDomain);
                    }
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.IsCoexistenceDomain) && this.DataObject.IsCoexistenceDomain != this.IsCoexistenceDomain)
            {
                if (!this.IsCoexistenceDomain)
                {
                    try
                    {
                        AcceptedDomainUtility.DeregisterCoexistenceDomain(this.DataObject.DomainName.Domain);
                        goto IL_162;
                    }
                    catch (TimeoutException exception)
                    {
                        base.WriteError(exception, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (InvalidOperationException exception2)
                    {
                        base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (SecurityAccessDeniedException exception3)
                    {
                        base.WriteError(exception3, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (CommunicationException exception4)
                    {
                        base.WriteError(exception4, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                }
                try
                {
                    AcceptedDomainUtility.RegisterCoexistenceDomain(this.DataObject.DomainName.Domain);
                }
                catch (TimeoutException exception5)
                {
                    base.WriteError(exception5, ErrorCategory.InvalidArgument, null);
                }
                catch (InvalidOperationException exception6)
                {
                    base.WriteError(exception6, ErrorCategory.InvalidArgument, null);
                }
                catch (SecurityAccessDeniedException exception7)
                {
                    base.WriteError(exception7, ErrorCategory.InvalidArgument, null);
                }
                catch (CommunicationException exception8)
                {
                    base.WriteError(exception8, ErrorCategory.InvalidArgument, null);
                }
IL_162:
                this.DataObject.IsCoexistenceDomain = this.IsCoexistenceDomain;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.RawAuthenticationType))
            {
                this.DataObject.RawAuthenticationType = this.AuthenticationType;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.InitialDomain))
            {
                this.DataObject.InitialDomain = this.InitialDomain;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.RawLiveIdInstanceType))
            {
                this.DataObject.RawLiveIdInstanceType = this.LiveIdInstanceType;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.EnableNego2Authentication))
            {
                this.DataObject.EnableNego2Authentication = this.EnableNego2Authentication;
                if (ManagementEndpointBase.IsGlobalDirectoryConfigured())
                {
                    IGlobalDirectorySession globalSession = DirectorySessionFactory.GetGlobalSession(null);
                    globalSession.SetDomainFlag(this.DataObject.Name, GlsDomainFlags.Nego2Enabled, this.EnableNego2Authentication);
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient))
            {
                if (this.resolvedCatchAllRecipient != null)
                {
                    this.DataObject.CatchAllRecipientID = this.resolvedCatchAllRecipient.OriginalId;
                }
                else
                {
                    this.DataObject.CatchAllRecipientID = null;
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains))
            {
                this.DataObject.MatchSubDomains = this.MatchSubDomains;
            }
            base.InternalProcessRecord();
            FfoDualWriter.SaveToFfo <AcceptedDomain>(this, this.DataObject, TenantSettingSyncLogType.SYNCACCEPTEDDOM, null);
            TaskLogger.LogExit();
        }