private bool DoTenantConnectorsNeedConfiguration() { this.onPremisesOrganizationOperation = MailFlowTask.Operation.NOP; this.inboundConnectorOperation = MailFlowTask.Operation.NOP; this.outboundConnectorOperation = MailFlowTask.Operation.NOP; this.onPremisesOrganization = base.TenantSession.GetOnPremisesOrganization(this.OnPremOrgConfig.Guid); string identity = this.DefaultInboundConnectorName; string identity2 = this.DefaultOutboundConnectorName; if (this.onPremisesOrganization == null) { this.onPremisesOrganizationOperation = MailFlowTask.Operation.New; } else { if (this.onPremisesOrganization.InboundConnector != null) { identity = this.onPremisesOrganization.InboundConnector.ToString(); } if (this.onPremisesOrganization.OutboundConnector != null) { identity2 = this.onPremisesOrganization.OutboundConnector.ToString(); } } this.inboundConnector = base.TenantSession.GetInboundConnector(identity); if (this.inboundConnector == null) { if (this.EnableSecureMail) { this.inboundConnectorOperation = MailFlowTask.Operation.New; } } else if (this.EnableSecureMail) { IInboundConnector obj = this.BuildExpectedInboundConnector(null); if (!this.inboundConnector.Equals(obj)) { this.inboundConnectorOperation = MailFlowTask.Operation.Update; } } else { this.inboundConnectorOperation = MailFlowTask.Operation.Remove; } this.outboundConnector = base.TenantSession.GetOutboundConnector(identity2); if (this.outboundConnector == null) { if (this.EnableSecureMail) { this.outboundConnectorOperation = MailFlowTask.Operation.New; } } else if (this.EnableSecureMail) { IOutboundConnector obj2 = this.BuildExpectedOutboundConnector(null); if (!this.outboundConnector.Equals(obj2)) { this.outboundConnectorOperation = MailFlowTask.Operation.Update; } } else { this.outboundConnectorOperation = MailFlowTask.Operation.Remove; } if (this.onPremisesOrganization != null) { ADObjectId b = (this.inboundConnector == null) ? null : this.inboundConnector.Identity; ADObjectId b2 = (this.outboundConnector == null) ? null : this.outboundConnector.Identity; if (this.inboundConnectorOperation == MailFlowTask.Operation.New || this.inboundConnectorOperation == MailFlowTask.Operation.Remove || this.outboundConnectorOperation == MailFlowTask.Operation.New || this.outboundConnectorOperation == MailFlowTask.Operation.Remove || !TaskCommon.AreEqual(this.onPremisesOrganization.InboundConnector, b) || !TaskCommon.AreEqual(this.onPremisesOrganization.OutboundConnector, b2) || !TaskCommon.ContainsSame <SmtpDomain>(this.onPremisesOrganization.HybridDomains, this.HybridDomains) || !string.Equals(this.onPremisesOrganization.OrganizationName, this.OnPremOrgConfig.Name, StringComparison.InvariantCultureIgnoreCase) || !TaskCommon.AreEqual(this.onPremisesOrganization.OrganizationRelationship, (ADObjectId)this.TenantOrganizationRelationship.Identity)) { this.onPremisesOrganizationOperation = MailFlowTask.Operation.Update; } } return(this.onPremisesOrganizationOperation != MailFlowTask.Operation.NOP || this.inboundConnectorOperation != MailFlowTask.Operation.NOP || this.outboundConnectorOperation != MailFlowTask.Operation.NOP); }
private bool NeedProvisionOrganizationRelationship(ICommonSession session, OrganizationRelationship existingOrgRel, IFederationInformation federationInfo, IEnumerable <SmtpDomain> domains, string relationshipName) { return(existingOrgRel == null || !TaskCommon.ContainsSame <SmtpDomain>(existingOrgRel.DomainNames, domains) || (this.RequiresFederationTrust() && (!string.Equals(TaskCommon.ToStringOrNull(existingOrgRel.TargetApplicationUri), federationInfo.TargetApplicationUri, StringComparison.InvariantCultureIgnoreCase) || !string.Equals(TaskCommon.ToStringOrNull(existingOrgRel.TargetAutodiscoverEpr), federationInfo.TargetAutodiscoverEpr, StringComparison.InvariantCultureIgnoreCase)))); }